Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,24 +127,6 @@
"llama-3.1-70b-instruct",
]

GroqChatModels = Literal[
"llama-3.1-405b-reasoning",
"llama-3.1-8b-instant",
"llama-3.3-70b-versatile",
"llama3-groq-70b-8192-tool-use-preview",
"llama3-groq-8b-8192-tool-use-preview",
"llama-guard-3-8b",
"llama3-70b-8192",
"llama3-8b-8192",
"mixtral-8x7b-32768",
"gemma-7b-it",
"gemma2-9b-it",
]

GroqAudioModels = Literal[
"whisper-large-v3", "distil-whisper-large-v3-en", "whisper-large-v3-turbo"
]

DeepSeekChatModels = Literal[
"deepseek-coder",
"deepseek-chat",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
)

from .log import logger
from .models import GroqAudioModels, STTModels
from .models import STTModels
from .utils import AsyncAzureADTokenProvider

# OpenAI Realtime API has a timeout of 15 mins, we'll attempt to restart the session
Expand Down Expand Up @@ -228,41 +228,6 @@ def with_azure(
use_realtime=use_realtime,
)

@staticmethod
def with_groq(
*,
model: GroqAudioModels | str = "whisper-large-v3-turbo",
api_key: NotGivenOr[str] = NOT_GIVEN,
base_url: NotGivenOr[str] = NOT_GIVEN,
client: openai.AsyncClient | None = None,
language: str = "en",
detect_language: bool = False,
prompt: NotGivenOr[str] = NOT_GIVEN,
) -> STT:
"""
Create a new instance of Groq STT.

``api_key`` must be set to your Groq API key, either using the argument or by setting
the ``GROQ_API_KEY`` environmental variable.
"""
groq_api_key = api_key if is_given(api_key) else os.environ.get("GROQ_API_KEY")
if not groq_api_key:
raise ValueError("Groq API key is required")

if not is_given(base_url):
base_url = "https://api.groq.com/openai/v1"

return STT(
model=model,
api_key=groq_api_key,
base_url=base_url,
client=client,
language=language,
detect_language=detect_language,
prompt=prompt,
use_realtime=False,
)

@staticmethod
def with_ovhcloud(
*,
Expand Down Expand Up @@ -314,7 +279,7 @@ def stream(
def update_options(
self,
*,
model: NotGivenOr[STTModels | GroqAudioModels | str] = NOT_GIVEN,
model: NotGivenOr[STTModels | str] = NOT_GIVEN,
language: NotGivenOr[str] = NOT_GIVEN,
detect_language: NotGivenOr[bool] = NOT_GIVEN,
prompt: NotGivenOr[str] = NOT_GIVEN,
Expand Down
Loading
Loading