mirror of
https://github.com/lfnovo/open-notebook.git
synced 2026-05-01 04:50:01 +00:00
add support for GROQ models
This commit is contained in:
parent
9ba5709a3c
commit
321234e485
6 changed files with 95 additions and 10 deletions
|
|
@ -40,3 +40,22 @@ class OpenAISpeechToTextModel(SpeechToTextModel):
|
|||
model=self.model_name, file=audio
|
||||
)
|
||||
return transcription.text
|
||||
|
||||
|
||||
@dataclass
|
||||
class GroqSpeechToTextModel(SpeechToTextModel):
|
||||
model_name: str
|
||||
|
||||
def transcribe(self, audio_file_path: str) -> str:
|
||||
"""
|
||||
Transcribes an audio file into text
|
||||
"""
|
||||
from groq import Groq
|
||||
|
||||
# todo: make this Singleton
|
||||
client = Groq()
|
||||
with open(audio_file_path, "rb") as audio:
|
||||
transcription = client.audio.transcriptions.create(
|
||||
model=self.model_name, file=audio
|
||||
)
|
||||
return transcription.text
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue