Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
Expand All @@ -27,7 +27,7 @@ jobs:
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
Expand All @@ -45,7 +45,7 @@ jobs:
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
Expand Down
3 changes: 1 addition & 2 deletions compat/agora-agent-server-sdk/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ classifiers = [
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -34,7 +33,7 @@ packages = [
Repository = 'https://github.com/AgoraIO-Conversational-AI/agent-server-sdk-python'

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"
agora-agents = ">=2.2.0,<3.0.0"

[build-system]
Expand Down
9 changes: 3 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ classifiers = [
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -34,7 +33,7 @@ packages = [
Repository = 'https://github.com/AgoraIO-Conversational-AI/agent-server-sdk-python'

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"
httpx = ">=0.21.2"
pydantic = ">= 1.9.2"
pydantic-core = ">=2.18.2"
Expand Down
4 changes: 1 addition & 3 deletions src/agora_agent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@
if typing.TYPE_CHECKING:
from . import agents, agentkit, core, phone_numbers, telephony
from .core.domain import Area, Pool, create_pool
from .pool_client import Agora, AsyncAgora
from .pool_client import Agora, AsyncAgora, AgentClient, AsyncAgentClient
from .version import __version__
from .agentkit import (
Agent,
AgentSession,
AgentSessionOptions,
AgentClient,
AsyncAgentClient,
CNAgent,
GlobalAgent,
GenericAvatar,
Expand Down
57 changes: 6 additions & 51 deletions src/agora_agent/agentkit/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,54 +350,6 @@ class Agent:
... )
"""

if typing.TYPE_CHECKING:
_GlobalArea = typing_extensions.Literal[Area.US, Area.EU, Area.AP]

@typing.overload
def __new__(
cls,
client: "Agora[typing_extensions.Literal[Area.CN]]",
*args: typing.Any,
**kwargs: typing.Any,
) -> "CNAgent":
...

@typing.overload
def __new__(
cls,
client: "Agora[_GlobalArea]",
*args: typing.Any,
**kwargs: typing.Any,
) -> "GlobalAgent":
...

@typing.overload
def __new__(
cls,
client: "AsyncAgora[typing_extensions.Literal[Area.CN]]",
*args: typing.Any,
**kwargs: typing.Any,
) -> "CNAgent":
...

@typing.overload
def __new__(
cls,
client: "AsyncAgora[_GlobalArea]",
*args: typing.Any,
**kwargs: typing.Any,
) -> "GlobalAgent":
...

@typing.overload
def __new__(
cls,
client: typing.Any,
*args: typing.Any,
**kwargs: typing.Any,
) -> "Agent":
...

def __new__(
cls,
client: typing.Any = None,
Expand All @@ -422,7 +374,7 @@ def __init__(
self,
client: typing.Any,
instructions: typing.Optional[str] = None,
turn_detection: typing.Optional[TurnDetectionConfig] = None,
turn_detection: typing.Optional[typing.Union[TurnDetectionConfig, typing.Dict[str, typing.Any]]] = None,
interruption: typing.Optional[InterruptionConfig] = None,
sal: typing.Optional[SalConfig] = None,
advanced_features: typing.Optional[AdvancedFeatures] = None,
Expand Down Expand Up @@ -733,7 +685,7 @@ def mllm(self) -> typing.Optional[typing.Dict[str, typing.Any]]:
return self._mllm

@property
def turn_detection(self) -> typing.Optional[TurnDetectionConfig]:
def turn_detection(self) -> typing.Optional[typing.Union[TurnDetectionConfig, typing.Dict[str, typing.Any]]]:
return self._turn_detection

@property
Expand Down Expand Up @@ -1072,7 +1024,10 @@ def _resolve_llm_config(self) -> typing.Dict[str, typing.Any]:
llm_config["max_history"] = self._max_history
return llm_config

def _resolve_asr_config(self, turn_detection_config: TurnDetectionConfig) -> typing.Dict[str, typing.Any]:
def _resolve_asr_config(
self,
turn_detection_config: typing.Union[TurnDetectionConfig, typing.Dict[str, typing.Any]],
) -> typing.Dict[str, typing.Any]:
asr_config = dict(self._stt or {})
if not asr_config:
asr_config["vendor"] = "ares"
Expand Down
16 changes: 8 additions & 8 deletions src/agora_agent/agentkit/regional_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,30 +108,30 @@


class CNAgent(Agent):
def with_stt(self, vendor: CNSTT) -> "CNAgent":
def with_stt(self, vendor: CNSTT) -> "CNAgent": # type: ignore[override]
return typing.cast("CNAgent", super().with_stt(typing.cast(BaseSTT, vendor)))

def with_llm(self, vendor: CNLLM) -> "CNAgent":
def with_llm(self, vendor: CNLLM) -> "CNAgent": # type: ignore[override]
return typing.cast("CNAgent", super().with_llm(typing.cast(BaseLLM, vendor)))

def with_tts(self, vendor: CNTTS) -> "CNAgent":
def with_tts(self, vendor: CNTTS) -> "CNAgent": # type: ignore[override]
return typing.cast("CNAgent", super().with_tts(typing.cast(BaseTTS, vendor)))

def with_avatar(self, vendor: CNAvatar) -> "CNAgent":
def with_avatar(self, vendor: CNAvatar) -> "CNAgent": # type: ignore[override]
return typing.cast("CNAgent", super().with_avatar(typing.cast(BaseAvatar, vendor)))


class GlobalAgent(Agent):
def with_stt(self, vendor: GlobalSTT) -> "GlobalAgent":
def with_stt(self, vendor: GlobalSTT) -> "GlobalAgent": # type: ignore[override]
return typing.cast("GlobalAgent", super().with_stt(typing.cast(BaseSTT, vendor)))

def with_llm(self, vendor: GlobalLLM) -> "GlobalAgent":
def with_llm(self, vendor: GlobalLLM) -> "GlobalAgent": # type: ignore[override]
return typing.cast("GlobalAgent", super().with_llm(typing.cast(BaseLLM, vendor)))

def with_tts(self, vendor: GlobalTTS) -> "GlobalAgent":
def with_tts(self, vendor: GlobalTTS) -> "GlobalAgent": # type: ignore[override]
return typing.cast("GlobalAgent", super().with_tts(typing.cast(BaseTTS, vendor)))

def with_avatar(self, vendor: GlobalAvatar) -> "GlobalAgent":
def with_avatar(self, vendor: GlobalAvatar) -> "GlobalAgent": # type: ignore[override]
return typing.cast("GlobalAgent", super().with_avatar(typing.cast(BaseAvatar, vendor)))


Expand Down
Loading
Loading