Skip to content

Commit 299e4bd

Browse files
fix(agentkit): resolve provider config type checks
1 parent 420547b commit 299e4bd

4 files changed

Lines changed: 88 additions & 8 deletions

File tree

src/agora_agent/agentkit/agent.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,41 @@ class SessionOptions(typing_extensions.TypedDict, total=False):
246246
]
247247

248248
DEFAULT_INTERACTION_LANGUAGE: InteractionLanguage = "en-US"
249-
_INTERACTION_LANGUAGES = set(InteractionLanguage.__args__)
249+
INTERACTION_LANGUAGE_VALUES: typing.Tuple[InteractionLanguage, ...] = (
250+
"ar-EG",
251+
"ar-JO",
252+
"ar-SA",
253+
"ar-AE",
254+
"bn-IN",
255+
"zh-CN",
256+
"zh-HK",
257+
"zh-TW",
258+
"nl-NL",
259+
"en-IN",
260+
"en-US",
261+
"fil-PH",
262+
"fr-FR",
263+
"de-DE",
264+
"gu-IN",
265+
"he-IL",
266+
"hi-IN",
267+
"id-ID",
268+
"it-IT",
269+
"ja-JP",
270+
"kn-IN",
271+
"ko-KR",
272+
"ms-MY",
273+
"fa-IR",
274+
"pt-PT",
275+
"ru-RU",
276+
"es-ES",
277+
"ta-IN",
278+
"te-IN",
279+
"th-TH",
280+
"tr-TR",
281+
"vi-VN",
282+
)
283+
_INTERACTION_LANGUAGES = set(INTERACTION_LANGUAGE_VALUES)
250284

251285

252286
def _dump_optional_model(value: typing.Any) -> typing.Any:

src/agora_agent/agentkit/vendors/llm.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, List, Optional, Union
1+
from typing import Any, Dict, List, Optional
22

33
from pydantic import BaseModel, ConfigDict, Field, model_validator
44

@@ -384,17 +384,29 @@ def to_config(self) -> Dict[str, Any]:
384384
return config
385385

386386

387-
class AmazonBedrockOptions(AnthropicOptions):
387+
class AmazonBedrockOptions(BaseModel):
388388
model_config = ConfigDict(extra="forbid")
389389

390390
access_key: str = Field(..., description="AWS access key ID")
391391
secret_key: str = Field(..., description="AWS secret access key")
392392
region: str = Field(..., description="AWS region")
393393
model: str = Field(..., description="Amazon Bedrock model identifier")
394394
max_tokens: Optional[int] = Field(default=None, gt=0)
395-
api_key: Optional[str] = Field(default=None, description="Unused; kept for AnthropicOptions compatibility")
396-
url: Optional[str] = Field(default=None, description="Unused; kept for AnthropicOptions compatibility")
395+
url: Optional[str] = Field(default=None, description="Amazon Bedrock converse stream endpoint URL")
396+
temperature: Optional[float] = Field(default=None, ge=0.0, le=1.0)
397+
top_p: Optional[float] = Field(default=None, ge=0.0, le=1.0)
398+
system_messages: Optional[List[Dict[str, Any]]] = Field(default=None)
399+
greeting_message: Optional[str] = Field(default=None)
400+
failure_message: Optional[str] = Field(default=None)
401+
input_modalities: Optional[List[str]] = Field(default=None)
402+
params: Optional[Dict[str, Any]] = Field(default=None)
397403
headers: Optional[Dict[str, str]] = Field(default=None)
404+
output_modalities: Optional[List[str]] = Field(default=None)
405+
greeting_configs: Optional[LlmGreetingConfigs] = Field(default=None)
406+
template_variables: Optional[Dict[str, str]] = Field(default=None)
407+
vendor: Optional[str] = Field(default=None)
408+
mcp_servers: Optional[List[Dict[str, Any]]] = Field(default=None)
409+
max_history: Optional[int] = Field(default=None, gt=0, description="Maximum number of conversation history messages to cache")
398410

399411

400412
class AmazonBedrock(BaseLLM):

src/agora_agent/agentkit/vendors/mllm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def to_config(self) -> Dict[str, Any]:
4444
or self.options.instructions is not None
4545
or self.options.input_audio_transcription is not None
4646
):
47-
params = {}
47+
params: Dict[str, Any] = {}
4848
if self.options.model is not None:
4949
params["model"] = self.options.model
5050
if self.options.params is not None:

src/agora_agent/agentkit/vendors/stt.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, Optional
1+
from typing import Any, Dict, Optional, Tuple
22

33
from pydantic import BaseModel, ConfigDict, Field, model_validator
44
from typing_extensions import Literal
@@ -40,7 +40,41 @@
4040
"vi-VN",
4141
]
4242

43-
_INTERACTION_LANGUAGES = set(InteractionLanguage.__args__)
43+
INTERACTION_LANGUAGE_VALUES: Tuple[InteractionLanguage, ...] = (
44+
"ar-EG",
45+
"ar-JO",
46+
"ar-SA",
47+
"ar-AE",
48+
"bn-IN",
49+
"zh-CN",
50+
"zh-HK",
51+
"zh-TW",
52+
"nl-NL",
53+
"en-IN",
54+
"en-US",
55+
"fil-PH",
56+
"fr-FR",
57+
"de-DE",
58+
"gu-IN",
59+
"he-IL",
60+
"hi-IN",
61+
"id-ID",
62+
"it-IT",
63+
"ja-JP",
64+
"kn-IN",
65+
"ko-KR",
66+
"ms-MY",
67+
"fa-IR",
68+
"pt-PT",
69+
"ru-RU",
70+
"es-ES",
71+
"ta-IN",
72+
"te-IN",
73+
"th-TH",
74+
"tr-TR",
75+
"vi-VN",
76+
)
77+
_INTERACTION_LANGUAGES = set(INTERACTION_LANGUAGE_VALUES)
4478
_DEEPGRAM_MANAGED_MODELS = {"nova-2", "nova-3"}
4579

4680

0 commit comments

Comments
 (0)