mod speech;
#[cfg(test)]
mod tests;
mod transcription;
mod translation;
pub mod types;
use crate::utils::error::gateway_error::Result;
use speech::SpeechService;
use transcription::TranscriptionService;
use translation::TranslationService;
use types::{
SpeechRequest, SpeechResponse, TranscriptionRequest, TranscriptionResponse, TranslationRequest,
TranslationResponse,
};
pub struct AudioService {
transcription_service: TranscriptionService,
translation_service: TranslationService,
speech_service: SpeechService,
}
impl Default for AudioService {
fn default() -> Self {
Self::new()
}
}
impl AudioService {
pub fn new() -> Self {
Self {
transcription_service: TranscriptionService::new(),
translation_service: TranslationService::new(),
speech_service: SpeechService::new(),
}
}
pub async fn transcribe(&self, request: TranscriptionRequest) -> Result<TranscriptionResponse> {
self.transcription_service.transcribe(request).await
}
pub async fn translate(&self, request: TranslationRequest) -> Result<TranslationResponse> {
self.translation_service.translate(request).await
}
pub async fn speech(&self, request: SpeechRequest) -> Result<SpeechResponse> {
self.speech_service.speech(request).await
}
}