improve default_models

This commit is contained in:
LUIS NOVO 2024-11-01 22:38:21 -03:00
parent 4f586ad513
commit 223f1bdaf5
4 changed files with 20 additions and 5 deletions

View file

@ -105,6 +105,22 @@ class ModelManager:
raise RuntimeError("Failed to initialize default models configuration")
return self._default_models
@property
def speech_to_text(self, **kwargs) -> SpeechToTextModel:
"""Get the default speech-to-text model"""
model = self.get_default_model("speech_to_text", **kwargs)
if not isinstance(model, SpeechToTextModel):
raise TypeError(f"Expected SpeechToTextModel but got {type(model)}")
return model
@property
def text_to_speech(self, **kwargs) -> TextToSpeechModel:
"""Get the default text-to-speech model"""
model = self.get_default_model("text_to_speech", **kwargs)
if not isinstance(model, TextToSpeechModel):
raise TypeError(f"Expected TextToSpeechModel but got {type(model)}")
return model
@property
def embedding_model(self, **kwargs) -> EmbeddingModel:
"""Get the default embedding model"""