@@ -28,26 +28,26 @@ def to_config(self) -> Dict[str, Any]:
2828 """Serialize the LLM configuration to a dict for the REST API."""
2929
3030
31- class BaseTTS (ABC ):
31+ class BaseTTS (BaseModel , ABC ):
3232 """Abstract base class for all TTS vendor implementations.
3333
34- Subclasses must implement :meth:`to_config` and :attr:`sample_rate` .
34+ Subclasses must implement :meth:`to_config`.
3535
36- ``sample_rate`` is used by :class:`~agora_agent.agentkit.AgentSession` to
37- validate TTS/avatar compatibility at runtime (avatars require a specific
38- sample rate). Subclasses should return ``None`` when the user has not
39- explicitly configured a sample rate, which will cause a warning at session
40- start time rather than a hard error.
36+ :attr:`resolved_sample_rate` is used by
37+ :class:`~agora_agent.agentkit.AgentSession` to validate TTS/avatar
38+ compatibility at runtime (avatars require a specific sample rate). It
39+ returns ``None`` when the user has not explicitly configured a sample rate,
40+ which will cause a warning at session start time rather than a hard error.
4141 """
4242
4343 @abstractmethod
4444 def to_config (self ) -> Dict [str , Any ]:
4545 """Serialize the TTS configuration to a dict for the REST API."""
4646
4747 @property
48- @ abstractmethod
49- def sample_rate ( self ) -> Optional [ int ]:
50- """The configured sample rate in Hz, or ``None`` if not explicitly set."""
48+ def resolved_sample_rate ( self ) -> Optional [ int ]:
49+ """The effective configured sample rate in Hz, or None if not set."""
50+ return getattr ( self , "sample_rate" , None )
5151
5252
5353class BaseSTT (BaseModel , ABC ):
0 commit comments