pub struct TtsManager { /* private fields */ }Expand description
Central manager for per-agent TTS synthesis.
tts_providers are keyed by their dotted alias (<type>.<alias>).
Per-instance voice overrides come from the voice field on each
TtsProviderConfig. The agent_tts_provider field carries the
resolved alias for the agent that owns this manager instance — empty
means the agent doesn’t want TTS, and synthesize_for_agent fails
loud rather than silently pick a default.
Implementations§
Source§impl TtsManager
impl TtsManager
Sourcepub fn from_config(config: &Config) -> Result<Self>
pub fn from_config(config: &Config) -> Result<Self>
Build a TtsManager from [tts_providers.<type>.<alias>] instances
in Config. Each instance is registered under its dotted alias key
(<type>.<alias>). Failures to construct a particular instance are
logged at warn but do not abort the manager.
Build a TtsManager from [tts_providers.<type>.<alias>] instances.
The manager’s resolved alias comes from the runtime-active agent’s
tts_provider field — there is no global default-provider concept,
so when no agent-bound resolution is available the manager refuses
to silently pick a provider (synthesize fails loud).
Sourcepub async fn synthesize(&self, text: &str) -> Result<Vec<u8>>
pub async fn synthesize(&self, text: &str) -> Result<Vec<u8>>
Synthesize text using the runtime-active agent’s resolved
tts_provider reference and the per-instance voice override (or
default_voice as the per-instance fallback). Fails loud when the
agent has no tts_provider configured — there is no global
default-provider concept and this manager refuses to silently pick
one.
Sourcepub async fn synthesize_with_provider(
&self,
text: &str,
provider_alias: &str,
voice: &str,
) -> Result<Vec<u8>>
pub async fn synthesize_with_provider( &self, text: &str, provider_alias: &str, voice: &str, ) -> Result<Vec<u8>>
Synthesize text using a specific dotted-alias model_provider and voice.
Sourcepub fn available_providers(&self) -> Vec<String>
pub fn available_providers(&self) -> Vec<String>
List dotted aliases of all initialized tts_providers.
Auto Trait Implementations§
impl Freeze for TtsManager
impl !RefUnwindSafe for TtsManager
impl Send for TtsManager
impl Sync for TtsManager
impl Unpin for TtsManager
impl UnsafeUnpin for TtsManager
impl !UnwindSafe for TtsManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more