Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .fern/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
},
"exclude_types_from_init_exports": true
},
"originGitCommit": "5628d83c49f74825c20264a58866202f18d481ff"
"originGitCommit": "f4b5b1d56fb73c4e26c11486424723c12e6376bc"
}
10 changes: 8 additions & 2 deletions .fern/replay.lock

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

6 changes: 6 additions & 0 deletions src/agora_agent/agent_management/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,19 @@ def agent_think(
- `inject`: Inject the custom text instruction into the current turn without interrupting it.
- `interrupt`: Immediately interrupt the current flow and initiate a new round of dialogue.
- `ignore`: Ignore the request.
- `append`: Do not interrupt the user. Wait for the user's ASR text to be sent to the LLM and for the resulting response to finish, then send the custom text instruction to the LLM.

on_thinking_action : typing.Optional[AgentThinkAgentManagementRequestOnThinkingAction]
The action to take when the agent is in a thinking state:
- `interrupt`: Interrupt the current state and start a new conversation turn.
- `ignore`: Ignore the request.
- `append`: Do not interrupt the current LLM inference. Allow the current turn to finish generating and playing its response first. After the current turn's LLM output is complete, send the queued custom text instruction to the LLM.

on_speaking_action : typing.Optional[AgentThinkAgentManagementRequestOnSpeakingAction]
The action to take when the agent is in a speaking state:
- `interrupt`: Interrupt the current state and start a new conversation turn.
- `ignore`: Ignore the request.
- `append`: Do not interrupt the current TTS playback; the audio stream continues. After the current turn's LLM output is complete, send the custom text instruction directly to the LLM.

interruptable : typing.Optional[bool]
Whether user speech can interrupt the injected instruction:
Expand Down Expand Up @@ -189,16 +192,19 @@ async def agent_think(
- `inject`: Inject the custom text instruction into the current turn without interrupting it.
- `interrupt`: Immediately interrupt the current flow and initiate a new round of dialogue.
- `ignore`: Ignore the request.
- `append`: Do not interrupt the user. Wait for the user's ASR text to be sent to the LLM and for the resulting response to finish, then send the custom text instruction to the LLM.

on_thinking_action : typing.Optional[AgentThinkAgentManagementRequestOnThinkingAction]
The action to take when the agent is in a thinking state:
- `interrupt`: Interrupt the current state and start a new conversation turn.
- `ignore`: Ignore the request.
- `append`: Do not interrupt the current LLM inference. Allow the current turn to finish generating and playing its response first. After the current turn's LLM output is complete, send the queued custom text instruction to the LLM.

on_speaking_action : typing.Optional[AgentThinkAgentManagementRequestOnSpeakingAction]
The action to take when the agent is in a speaking state:
- `interrupt`: Interrupt the current state and start a new conversation turn.
- `ignore`: Ignore the request.
- `append`: Do not interrupt the current TTS playback; the audio stream continues. After the current turn's LLM output is complete, send the custom text instruction directly to the LLM.

interruptable : typing.Optional[bool]
Whether user speech can interrupt the injected instruction:
Expand Down
6 changes: 6 additions & 0 deletions src/agora_agent/agent_management/raw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,19 @@ def agent_think(
- `inject`: Inject the custom text instruction into the current turn without interrupting it.
- `interrupt`: Immediately interrupt the current flow and initiate a new round of dialogue.
- `ignore`: Ignore the request.
- `append`: Do not interrupt the user. Wait for the user's ASR text to be sent to the LLM and for the resulting response to finish, then send the custom text instruction to the LLM.

on_thinking_action : typing.Optional[AgentThinkAgentManagementRequestOnThinkingAction]
The action to take when the agent is in a thinking state:
- `interrupt`: Interrupt the current state and start a new conversation turn.
- `ignore`: Ignore the request.
- `append`: Do not interrupt the current LLM inference. Allow the current turn to finish generating and playing its response first. After the current turn's LLM output is complete, send the queued custom text instruction to the LLM.

on_speaking_action : typing.Optional[AgentThinkAgentManagementRequestOnSpeakingAction]
The action to take when the agent is in a speaking state:
- `interrupt`: Interrupt the current state and start a new conversation turn.
- `ignore`: Ignore the request.
- `append`: Do not interrupt the current TTS playback; the audio stream continues. After the current turn's LLM output is complete, send the custom text instruction directly to the LLM.

interruptable : typing.Optional[bool]
Whether user speech can interrupt the injected instruction:
Expand Down Expand Up @@ -170,16 +173,19 @@ async def agent_think(
- `inject`: Inject the custom text instruction into the current turn without interrupting it.
- `interrupt`: Immediately interrupt the current flow and initiate a new round of dialogue.
- `ignore`: Ignore the request.
- `append`: Do not interrupt the user. Wait for the user's ASR text to be sent to the LLM and for the resulting response to finish, then send the custom text instruction to the LLM.

on_thinking_action : typing.Optional[AgentThinkAgentManagementRequestOnThinkingAction]
The action to take when the agent is in a thinking state:
- `interrupt`: Interrupt the current state and start a new conversation turn.
- `ignore`: Ignore the request.
- `append`: Do not interrupt the current LLM inference. Allow the current turn to finish generating and playing its response first. After the current turn's LLM output is complete, send the queued custom text instruction to the LLM.

on_speaking_action : typing.Optional[AgentThinkAgentManagementRequestOnSpeakingAction]
The action to take when the agent is in a speaking state:
- `interrupt`: Interrupt the current state and start a new conversation turn.
- `ignore`: Ignore the request.
- `append`: Do not interrupt the current TTS playback; the audio stream continues. After the current turn's LLM output is complete, send the custom text instruction directly to the LLM.

interruptable : typing.Optional[bool]
Whether user speech can interrupt the injected instruction:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import typing

AgentThinkAgentManagementRequestOnListeningAction = typing.Union[
typing.Literal["inject", "interrupt", "ignore"], typing.Any
typing.Literal["inject", "interrupt", "ignore", "append"], typing.Any
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

import typing

AgentThinkAgentManagementRequestOnSpeakingAction = typing.Union[typing.Literal["interrupt", "ignore"], typing.Any]
AgentThinkAgentManagementRequestOnSpeakingAction = typing.Union[
typing.Literal["interrupt", "ignore", "append"], typing.Any
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

import typing

AgentThinkAgentManagementRequestOnThinkingAction = typing.Union[typing.Literal["interrupt", "ignore"], typing.Any]
AgentThinkAgentManagementRequestOnThinkingAction = typing.Union[
typing.Literal["interrupt", "ignore", "append"], typing.Any
]
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class StartAgentsRequestProperties(UncheckedBaseModel):
filler_words: typing.Optional[StartAgentsRequestPropertiesFillerWords] = pydantic.Field(default=None)
"""
Filler word configuration. Plays filler words while waiting for LLM responses to reduce user anxiety and improve conversation flow.
When `enable` is `true`, `content.static_config.phrases` must be present and non-empty, even when `content.mode` is `generated`, because generated mode still falls back to static filler words.
"""

parameters: typing.Optional[StartAgentsRequestPropertiesParameters] = pydantic.Field(default=None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
class StartAgentsRequestPropertiesFillerWords(UncheckedBaseModel):
"""
Filler word configuration. Plays filler words while waiting for LLM responses to reduce user anxiety and improve conversation flow.
When `enable` is `true`, `content.static_config.phrases` must be present and non-empty, even when `content.mode` is `generated`, because generated mode still falls back to static filler words.
"""

enable: typing.Optional[bool] = pydantic.Field(default=None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
import pydantic
from ...core.pydantic_utilities import IS_PYDANTIC_V2
from ...core.unchecked_base_model import UncheckedBaseModel
from .start_agents_request_properties_filler_words_content_generated_config import (
StartAgentsRequestPropertiesFillerWordsContentGeneratedConfig,
)
from .start_agents_request_properties_filler_words_content_mode import (
StartAgentsRequestPropertiesFillerWordsContentMode,
)
from .start_agents_request_properties_filler_words_content_static_config import (
StartAgentsRequestPropertiesFillerWordsContentStaticConfig,
)
Expand All @@ -15,17 +21,26 @@ class StartAgentsRequestPropertiesFillerWordsContent(UncheckedBaseModel):
Filler word content configuration. Defines the source and selection rules for filler words.
"""

mode: typing.Optional[typing.Literal["static"]] = pydantic.Field(default=None)
mode: typing.Optional[StartAgentsRequestPropertiesFillerWordsContentMode] = pydantic.Field(default=None)
"""
Filler word content mode:
- `static`: Static filler words. Uses a predefined list of filler words.
- `generated`: LLM-generated filler words based on the last user message. Falls back to static filler words when generation is not ready, fails, or returns empty text.
"""

static_config: typing.Optional[StartAgentsRequestPropertiesFillerWordsContentStaticConfig] = pydantic.Field(
default=None
)
"""
Static filler word configuration. Used when `mode` is `static`.
Static filler word configuration. Required when `mode` is `static`.
Also required whenever `filler_words.enable` is `true`, including when `mode` is `generated`, because generated mode uses static filler words as fallback.
"""

generated_config: typing.Optional[StartAgentsRequestPropertiesFillerWordsContentGeneratedConfig] = pydantic.Field(
default=None
)
"""
Generated filler word configuration. Required when `content.mode` is `generated`.
"""

if IS_PYDANTIC_V2:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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 .start_agents_request_properties_filler_words_content_generated_config_llm_provider import (
StartAgentsRequestPropertiesFillerWordsContentGeneratedConfigLlmProvider,
)


class StartAgentsRequestPropertiesFillerWordsContentGeneratedConfig(UncheckedBaseModel):
"""
Generated filler word configuration. Required when `content.mode` is `generated`.
"""

llm_provider: StartAgentsRequestPropertiesFillerWordsContentGeneratedConfigLlmProvider = pydantic.Field()
"""
OpenAI-compatible LLM provider used to generate filler words. Runs in parallel with the main business LLM and only uses the last user message as input.
"""

prompt: str = pydantic.Field()
"""
System prompt used to generate a short filler phrase based on the last user message. The generated text should be conversational and must not answer the user's question.
"""

fallback_strategy: typing.Literal["static"] = pydantic.Field(default="static")
"""
Fallback strategy when generated filler text is not ready, fails, or returns empty text. Phase 1 only supports `static`.
"""

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
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 StartAgentsRequestPropertiesFillerWordsContentGeneratedConfigLlmProvider(UncheckedBaseModel):
"""
OpenAI-compatible LLM provider used to generate filler words. Runs in parallel with the main business LLM and only uses the last user message as input.
"""

base_url: str = pydantic.Field()
"""
Base URL of the OpenAI-compatible chat completions endpoint. If the URL does not end with `/chat/completions`, the engine appends it automatically.
"""

api_key: str = pydantic.Field()
"""
API key for authenticating requests to the filler LLM provider.
"""

params: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
"""
Additional request parameters merged into the generated filler LLM request body, such as `model`.
"""

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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file was auto-generated by Fern from our API Definition.

import typing

StartAgentsRequestPropertiesFillerWordsContentMode = typing.Union[typing.Literal["static", "generated"], typing.Any]
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

class StartAgentsRequestPropertiesFillerWordsContentStaticConfig(UncheckedBaseModel):
"""
Static filler word configuration. Used when `mode` is `static`.
Static filler word configuration. Required when `mode` is `static`.
Also required whenever `filler_words.enable` is `true`, including when `mode` is `generated`, because generated mode uses static filler words as fallback.
"""

phrases: typing.List[str] = pydantic.Field()
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.6.0",
"User-Agent": "agora-agents/v2.7.0",
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "agora-agents",
"X-Fern-SDK-Version": "v2.6.0",
"X-Fern-SDK-Version": "v2.7.0",
**(self.get_custom_headers() or {}),
}
headers["Authorization"] = httpx.BasicAuth(self._get_username(), self._get_password())._auth_header
Expand Down
5 changes: 5 additions & 0 deletions src/agora_agent/types/ares_asr.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class AresAsr(UncheckedBaseModel):
"""

language: typing.Optional[AsrLanguage] = None
keywords: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
"""
A list of hotwords to improve ASR accuracy.
"""

params: typing.Optional[AresAsrParams] = None

if IS_PYDANTIC_V2:
Expand Down
24 changes: 1 addition & 23 deletions src/agora_agent/types/ares_asr_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,4 @@

import typing

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


class AresAsrParams(UncheckedBaseModel):
"""
ARES ASR configuration parameters.
"""

keywords: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
"""
A list of hotwords to improve ASR accuracy.
"""

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
AresAsrParams = typing.Dict[str, typing.Any]
2 changes: 2 additions & 0 deletions src/agora_agent/types/asr.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
class Asr_Ares(UncheckedBaseModel):
vendor: typing.Literal["ares"] = "ares"
language: typing.Optional[AsrLanguage] = None
keywords: typing.Optional[typing.List[str]] = None
params: typing.Optional[AresAsrParams] = None

if IS_PYDANTIC_V2:
Expand All @@ -44,6 +45,7 @@ class Config:
class Asr_Fengming(UncheckedBaseModel):
vendor: typing.Literal["fengming"] = "fengming"
language: typing.Optional[AsrLanguage] = None
keywords: typing.Optional[typing.List[str]] = None
params: typing.Optional[FengmingAsrParams] = None

if IS_PYDANTIC_V2:
Expand Down
5 changes: 5 additions & 0 deletions src/agora_agent/types/fengming_asr.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class FengmingAsr(UncheckedBaseModel):
"""

language: typing.Optional[AsrLanguage] = None
keywords: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
"""
A list of hotwords to improve ASR accuracy.
"""

params: typing.Optional[FengmingAsrParams] = None

if IS_PYDANTIC_V2:
Expand Down
24 changes: 1 addition & 23 deletions src/agora_agent/types/fengming_asr_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,4 @@

import typing

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


class FengmingAsrParams(UncheckedBaseModel):
"""
Agora Fengming ASR configuration parameters.
"""

keywords: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
"""
A list of hotwords to improve ASR accuracy.
"""

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
FengmingAsrParams = typing.Dict[str, typing.Any]
Loading
Loading