Merge pull request #9455 from BerriAI/litellm_contributor_fix_mar_21

fix(model_param_helper.py): update _get_litellm_supported_transcription_kwargs() to use proper annotations from TranscriptionCreateParamsNonStreaming & `TranscriptionCreateParamsStreaming
This commit is contained in:
Ishaan Jaff 2025-03-21 21:07:39 -07:00 committed by GitHub
commit 71d9ce00a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,5 @@
from typing import Set
from openai.types.audio.transcription_create_params import TranscriptionCreateParams
from openai.types.chat.completion_create_params import (
CompletionCreateParamsNonStreaming,
CompletionCreateParamsStreaming,
@ -13,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
@ -123,7 +123,19 @@ class ModelParamHelper:
This follows the OpenAI API Spec
"""
return set(TranscriptionCreateParams.__annotations__.keys())
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]: