llm/tts/mod.rs
1use crate::error::LLMError;
2use async_trait::async_trait;
3
4/// Trait implemented by all text to speech backends
5///
6/// This trait defines the interface for text-to-speech conversion services.
7/// Implementors must provide functionality to convert text into audio data.
8#[async_trait]
9pub trait TextToSpeechProvider: Send + Sync {
10 /// Convert the given text into speech audio
11 ///
12 /// # Arguments
13 ///
14 /// * `text` - A string containing the text to convert to speech
15 ///
16 /// # Returns
17 ///
18 /// * `Result<Vec<u8>, LLMError>` - On success, returns the audio data as a vector of bytes.
19 /// On failure, returns an LLMError describing what went wrong.
20 #[allow(unused)]
21 async fn speech(&self, text: &str) -> Result<Vec<u8>, LLMError> {
22 Err(LLMError::ProviderError(
23 "Phind does not implement text to speech endpoint yet.".into(),
24 ))
25 }
26}