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
1,017 changes: 205 additions & 812 deletions .fern/replay.lock

Large diffs are not rendered by default.

54 changes: 0 additions & 54 deletions scripts/check_release_workflow.py

This file was deleted.

19 changes: 19 additions & 0 deletions src/agora_agent/agentkit/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
from ..agents.types.start_agents_request_properties_filler_words_content_static_config import StartAgentsRequestPropertiesFillerWordsContentStaticConfig
from ..agents.types.start_agents_request_properties_filler_words_content_static_config_selection_rule import StartAgentsRequestPropertiesFillerWordsContentStaticConfigSelectionRule
from ..types.tts import Tts
from ..agents.types.start_agents_request_properties_filler_words_content_static_config_selection_rule import StartAgentsRequestPropertiesFillerWordsContentStaticConfigSelectionRule
from ..types.tts import Tts
from ..types.asr import Asr
from ..types.llm import Llm
from ..types.llm_style import LlmStyle as GeneratedLlmStyle
Expand Down Expand Up @@ -544,6 +546,23 @@ def with_audio_scenario(self, audio_scenario: ParametersAudioScenario) -> "Agent
)
return new_agent

def with_audio_scenario(self, audio_scenario: ParametersAudioScenario) -> "Agent":
"""Returns a new Agent with the specified RTC audio scenario."""
new_agent = self._clone()
if new_agent._parameters is None:
new_agent._parameters = StartAgentsRequestPropertiesParameters(audio_scenario=audio_scenario)
elif isinstance(new_agent._parameters, dict):
new_agent._parameters = typing.cast(
SessionParamsInput,
{**new_agent._parameters, "audio_scenario": audio_scenario},
)
else:
new_agent._parameters = self._copy_model_update(
new_agent._parameters,
{"audio_scenario": audio_scenario},
)
return new_agent

def with_failure_message(self, message: str) -> "Agent":
"""Deprecated. Configure the failure message on the LLM or MLLM vendor instead."""
new_agent = self._clone()
Expand Down
1 change: 1 addition & 0 deletions src/agora_agent/agentkit/agent_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
AgentThinkAgentManagementResponse as AgentThinkResponse,
)
from ..agents.types.get_turns_agents_response import GetTurnsAgentsResponse
from ..agents.types.get_turns_agents_response import GetTurnsAgentsResponse
from .agent import Agent, GetTurnsOptions, SayOptions, ThinkOptions, _start_properties_from_mapping
from .avatar_types import (
is_akool_avatar,
Expand Down
43 changes: 43 additions & 0 deletions src/agora_agent/agentkit/vendors/avatar.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,49 @@ def to_config(self) -> Dict[str, Any]:
return {"enable": enable, "vendor": "generic", "params": params}


class GenericAvatarOptions(BaseModel):
model_config = ConfigDict(extra="forbid")

api_key: str = Field(..., description="Generic avatar provider API key")
api_base_url: str = Field(..., description="Avatar provider API base URL")
avatar_id: str = Field(..., description="Avatar ID")
agora_uid: str = Field(..., description="Agora UID for the avatar video stream")
agora_appid: Optional[str] = Field(default=None, description="Agora App ID; filled by AgentSession when omitted")
agora_token: Optional[str] = Field(default=None, description="RTC token; generated by AgentSession when omitted")
agora_channel: Optional[str] = Field(default=None, description="Agora channel; filled by AgentSession when omitted")
enable: Optional[bool] = Field(default=None, description="Enable avatar (default: true)")
additional_params: Optional[Dict[str, Any]] = Field(default=None, description="Additional vendor-specific parameters")


class GenericAvatar(BaseAvatar):
def __init__(self, **kwargs: Any):
self.options = GenericAvatarOptions(**kwargs)

@property
def required_sample_rate(self) -> int:
return 0

def to_config(self) -> Dict[str, Any]:
params: Dict[str, Any] = {
"api_key": self.options.api_key,
"api_base_url": self.options.api_base_url,
"avatar_id": self.options.avatar_id,
"agora_uid": self.options.agora_uid,
}

if self.options.agora_appid is not None:
params["agora_appid"] = self.options.agora_appid
if self.options.agora_token is not None:
params["agora_token"] = self.options.agora_token
if self.options.agora_channel is not None:
params["agora_channel"] = self.options.agora_channel
if self.options.additional_params is not None:
params = {**self.options.additional_params, **params}

enable = self.options.enable if self.options.enable is not None else True
return {"enable": enable, "vendor": "generic", "params": params}


class AnamAvatarOptions(BaseModel):
model_config = ConfigDict(extra="forbid")

Expand Down
3 changes: 3 additions & 0 deletions src/agora_agent/agentkit/vendors/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

from pydantic import BaseModel, ConfigDict, Field, model_validator

from ...agents.types.start_agents_request_properties_llm_greeting_configs import (
StartAgentsRequestPropertiesLlmGreetingConfigs,
)
from .base import BaseLLM

LlmGreetingConfigs = Dict[str, Any]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class StartAgentsRequestPropertiesAvatar(UncheckedBaseModel):
- `liveavatar`: LiveAvatar (Beta)
- `anam`: Anam (Beta)
- `generic`: Generic (Beta)
- `sensetime`: SenseTime Avatar
"""

params: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import typing

StartAgentsRequestPropertiesAvatarVendor = typing.Union[
typing.Literal["akool", "liveavatar", "anam", "generic", "heygen"], typing.Any
typing.Literal["akool", "liveavatar", "anam", "generic", "sensetime", "heygen"], typing.Any
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pydantic
from ...core.pydantic_utilities import IS_PYDANTIC_V2
from ...core.unchecked_base_model import UncheckedBaseModel
from ...types.asr_language import AsrLanguage
from .start_agents_request_properties_turn_detection_config import StartAgentsRequestPropertiesTurnDetectionConfig
from .start_agents_request_properties_turn_detection_eagerness import StartAgentsRequestPropertiesTurnDetectionEagerness
from .start_agents_request_properties_turn_detection_interrupt_mode import (
Expand All @@ -19,11 +18,6 @@ class StartAgentsRequestPropertiesTurnDetection(UncheckedBaseModel):
Conversation turn detection settings. Controls the logic for voice activity detection and conversation turn determination. This object has no effect when `mllm.enable` is true; use `mllm.turn_detection` instead.
"""

language: typing.Optional[AsrLanguage] = pydantic.Field(default=None)
"""
BCP-47 language tag identifying the primary language used for agent interaction.
"""

mode: typing.Optional[typing.Literal["default"]] = pydantic.Field(default=None)
"""
Conversation turn detection mode:
Expand Down
4 changes: 2 additions & 2 deletions src/agora_agent/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ def __init__(

def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"User-Agent": "agora-agents/v2.2.0",
"User-Agent": "agora-agents/v2.2.1",
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "agora-agents",
"X-Fern-SDK-Version": "v2.2.0",
"X-Fern-SDK-Version": "v2.2.1",
**(self.get_custom_headers() or {}),
}
headers["Authorization"] = httpx.BasicAuth(self._get_username(), self._get_password())._auth_header
Expand Down
84 changes: 84 additions & 0 deletions src/agora_agent/types/asr.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
from .open_ai_asr_params import OpenAiAsrParams
from .sarvam_asr_params import SarvamAsrParams
from .speechmatics_asr_params import SpeechmaticsAsrParams
from .tencent_asr_params import TencentAsrParams
from .xfyun_asr_params import XfyunAsrParams
from .xfyun_bigmodel_asr_params import XfyunBigmodelAsrParams
from .xfyun_dialect_asr_params import XfyunDialectAsrParams


class Asr_Ares(UncheckedBaseModel):
Expand All @@ -35,6 +39,36 @@ class Config:
extra = pydantic.Extra.allow


class Asr_Fengming(UncheckedBaseModel):
vendor: typing.Literal["fengming"] = "fengming"
language: typing.Optional[AsrLanguage] = None
params: typing.Optional[typing.Dict[str, typing.Any]] = None

if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:

class Config:
frozen = True
smart_union = True
extra = pydantic.Extra.allow


class Asr_Tencent(UncheckedBaseModel):
vendor: typing.Literal["tencent"] = "tencent"
language: typing.Optional[AsrLanguage] = None
params: TencentAsrParams

if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:

class Config:
frozen = True
smart_union = True
extra = pydantic.Extra.allow


class Asr_Microsoft(UncheckedBaseModel):
vendor: typing.Literal["microsoft"] = "microsoft"
language: typing.Optional[AsrLanguage] = None
Expand Down Expand Up @@ -155,9 +189,56 @@ class Config:
extra = pydantic.Extra.allow


class Asr_Xfyun(UncheckedBaseModel):
vendor: typing.Literal["xfyun"] = "xfyun"
language: typing.Optional[AsrLanguage] = None
params: XfyunAsrParams

if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:

class Config:
frozen = True
smart_union = True
extra = pydantic.Extra.allow


class Asr_XfyunBigmodel(UncheckedBaseModel):
vendor: typing.Literal["xfyun_bigmodel"] = "xfyun_bigmodel"
language: typing.Optional[AsrLanguage] = None
params: XfyunBigmodelAsrParams

if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:

class Config:
frozen = True
smart_union = True
extra = pydantic.Extra.allow


class Asr_XfyunDialect(UncheckedBaseModel):
vendor: typing.Literal["xfyun_dialect"] = "xfyun_dialect"
language: typing.Optional[AsrLanguage] = None
params: XfyunDialectAsrParams

if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:

class Config:
frozen = True
smart_union = True
extra = pydantic.Extra.allow


Asr = typing_extensions.Annotated[
typing.Union[
Asr_Ares,
Asr_Fengming,
Asr_Tencent,
Asr_Microsoft,
Asr_Deepgram,
Asr_Openai,
Expand All @@ -166,6 +247,9 @@ class Config:
Asr_Assemblyai,
Asr_Speechmatics,
Asr_Sarvam,
Asr_Xfyun,
Asr_XfyunBigmodel,
Asr_XfyunDialect,
],
UnionMetadata(discriminant="vendor"),
]
29 changes: 29 additions & 0 deletions src/agora_agent/types/bytedance_duplex_tts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
from .bytedance_duplex_tts_params import BytedanceDuplexTtsParams


class BytedanceDuplexTts(UncheckedBaseModel):
"""
Bytedance duplex streaming Text-to-Speech configuration.
"""

params: BytedanceDuplexTtsParams
skip_patterns: typing.Optional[typing.List[int]] = pydantic.Field(default=None)
"""
Controls whether the TTS module skips bracketed content when reading LLM response text.
"""

if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:

class Config:
frozen = True
smart_union = True
extra = pydantic.Extra.allow
37 changes: 37 additions & 0 deletions src/agora_agent/types/bytedance_duplex_tts_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel


class BytedanceDuplexTtsParams(UncheckedBaseModel):
"""
Bytedance duplex streaming TTS configuration parameters.
"""

app_id: str = pydantic.Field()
"""
Bytedance application ID.
"""

token: str = pydantic.Field()
"""
Bytedance API token.
"""

speaker: str = pydantic.Field()
"""
Duplex TTS speaker identifier.
"""

if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:

class Config:
frozen = True
smart_union = True
extra = pydantic.Extra.allow
Loading
Loading