mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
Fix all 130126 tests
This commit is contained in:
parent
8b987db26f
commit
d03548b064
6 changed files with 14 additions and 12 deletions
|
|
@ -1533,6 +1533,7 @@ class AWSEventStreamDecoder:
|
|||
)
|
||||
],
|
||||
id=self.response_id,
|
||||
model=self.model,
|
||||
usage=usage,
|
||||
provider_specific_fields=model_response_provider_specific_fields,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -236,6 +236,7 @@ class BedrockPassthroughConfig(
|
|||
if len(all_translated_chunks) > 0:
|
||||
model_response = stream_chunk_builder(
|
||||
chunks=all_translated_chunks,
|
||||
logging_obj=litellm_logging_obj,
|
||||
)
|
||||
return model_response
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ class OpenAIChatCompletionsHandler(BaseTranslation):
|
|||
if has_stream_ended:
|
||||
# convert to model response
|
||||
model_response = cast(
|
||||
ModelResponse, stream_chunk_builder(chunks=responses_so_far)
|
||||
ModelResponse, stream_chunk_builder(chunks=responses_so_far, logging_obj=litellm_logging_obj)
|
||||
)
|
||||
# run process_output_response
|
||||
await self.process_output_response(
|
||||
|
|
|
|||
|
|
@ -98,16 +98,16 @@ class IBMWatsonXAudioTranscriptionConfig(
|
|||
"""
|
||||
# Use common utility to process the audio file
|
||||
processed_audio = process_audio_file(audio_file)
|
||||
|
||||
# Get API params to extract project_id or space_id
|
||||
api_params = _get_api_params(params=optional_params.copy(), model=model)
|
||||
project_id = optional_params.get("project_id") or optional_params.get(
|
||||
"watsonx_project"
|
||||
)
|
||||
space_id = optional_params.get("space_id")
|
||||
api_params = _get_api_params(params=optional_params, model=model)
|
||||
|
||||
# Initialize form data with required fields
|
||||
form_data: WatsonXAudioTranscriptionRequestBody = {"model": model}
|
||||
|
||||
project_id = api_params.get("project_id")
|
||||
space_id = api_params.get("space_id")
|
||||
|
||||
# Only add project_id or space_id if they were explicitly provided by the user
|
||||
if project_id:
|
||||
form_data["project_id"] = project_id
|
||||
elif space_id:
|
||||
|
|
|
|||
|
|
@ -7094,8 +7094,8 @@ async def token_counter(request: TokenCountRequest, call_endpoint: bool = False)
|
|||
f"Provider token counting failed ({result.status_code}): {result.error_message}. "
|
||||
"Falling back to local tokenizer."
|
||||
)
|
||||
else:
|
||||
# Success - return the result
|
||||
elif result is not None:
|
||||
# Success - return the result (only if not None)
|
||||
return result
|
||||
|
||||
# Check if token counter is disabled before fallback
|
||||
|
|
|
|||
|
|
@ -1514,7 +1514,7 @@ class Router:
|
|||
|
||||
return FallbackStreamWrapper(stream_with_fallbacks())
|
||||
|
||||
async def _acompletion(
|
||||
async def _acompletion( # noqa: PLR0915
|
||||
self, model: str, messages: List[Dict[str, str]], **kwargs
|
||||
) -> Union[ModelResponse, CustomStreamWrapper,]:
|
||||
"""
|
||||
|
|
@ -1699,13 +1699,13 @@ class Router:
|
|||
per-deployment retry settings instead of the global setting.
|
||||
"""
|
||||
# Only set if exception doesn't already have num_retries
|
||||
if hasattr(exception, "num_retries") and exception.num_retries is not None:
|
||||
if hasattr(exception, "num_retries") and exception.num_retries is not None: # type: ignore
|
||||
return
|
||||
|
||||
litellm_params = deployment.get("litellm_params", {})
|
||||
dep_num_retries = litellm_params.get("num_retries")
|
||||
if dep_num_retries is not None and isinstance(dep_num_retries, int):
|
||||
exception.num_retries = dep_num_retries
|
||||
exception.num_retries = dep_num_retries # type: ignore
|
||||
|
||||
def _update_kwargs_with_default_litellm_params(
|
||||
self, kwargs: dict, metadata_variable_name: Optional[str] = "metadata"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue