_get_litellm_supported_transcription_kwargs

This commit is contained in:
Ishaan Jaff 2025-03-21 19:20:13 -07:00
parent 478d209a0c
commit c63217e4d4
2 changed files with 45 additions and 8 deletions

View file

@ -1,9 +1,5 @@
from typing import Set
from openai.types.audio.transcription_create_params import (
TranscriptionCreateParamsNonStreaming,
TranscriptionCreateParamsStreaming,
)
from openai.types.chat.completion_create_params import (
CompletionCreateParamsNonStreaming,
CompletionCreateParamsStreaming,
@ -16,6 +12,7 @@ from openai.types.completion_create_params import (
)
from openai.types.embedding_create_params import EmbeddingCreateParams
from litellm._logging import verbose_logger
from litellm.types.rerank import RerankRequest
@ -126,10 +123,19 @@ class ModelParamHelper:
This follows the OpenAI API Spec
"""
all_transcription_kwargs = set(
TranscriptionCreateParamsNonStreaming.__annotations__.keys()
).union(set(TranscriptionCreateParamsStreaming.__annotations__.keys()))
return all_transcription_kwargs
try:
from openai.types.audio.transcription_create_params import (
TranscriptionCreateParamsNonStreaming,
TranscriptionCreateParamsStreaming,
)
all_transcription_kwargs = set(
TranscriptionCreateParamsNonStreaming.__annotations__.keys()
).union(set(TranscriptionCreateParamsStreaming.__annotations__.keys()))
return all_transcription_kwargs
except Exception as e:
verbose_logger.warning("Error getting transcription kwargs %s", str(e))
return set()
@staticmethod
def _get_exclude_kwargs() -> Set[str]: