Refactor client, timeout, and encoding parameters

This commit is contained in:
Praveen11558 2026-06-21 17:41:15 +05:30 • committed by GitHub
parent b6cba411ba
commit c9811ba0db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -189,9 +189,9 @@ class VertexGemmaConfig(OpenAIGPTConfig):
logging_obj: Any,
optional_params: dict,
litellm_params: dict,
client= Optional[Any],
timeout: Optional[Union[float, httpx.Timeout]],
encoding: Any,
client= Optional[Any] = None,
timeout: Optional[Union[float, httpx.Timeout]]= None,
encoding: Any= None,
):
"""Synchronous completion request"""
from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler
@ -230,14 +230,13 @@ class VertexGemmaConfig(OpenAIGPTConfig):
http_handler = HTTPHandler(concurrent_limit=1)
elif isinstance(client, httpx.Client):
http_handler = HTTPHandler(client=client)
else:
elif isinstance(client, HTTPHandler):
http_handler = client
response = http_handler.post(
url=api_base,
headers=headers,
json=request_data,
timeout=timeout,
)
else:
raise BaseLLMException(
status_code=400,
message=f"Invalid sync client type: {type(client)}. Expected HTTPHandler or httpx.Client.",
)
if response.status_code != 200:
raise BaseLLMException(
@ -287,9 +286,9 @@ class VertexGemmaConfig(OpenAIGPTConfig):
logging_obj: Any,
optional_params: dict,
litellm_params: dict,
client: Optional[Any],
timeout: Optional[Union[float, httpx.Timeout]],
encoding: Any,
client: Optional[Any]= None,
timeout: Optional[Union[float, httpx.Timeout]]= None,
encoding: Any= None,
):
"""Asynchronous completion request"""
from litellm.llms.custom_httpx.http_handler import (
@ -333,8 +332,13 @@ class VertexGemmaConfig(OpenAIGPTConfig):
http_handler = get_async_httpx_client(
llm_provider=LlmProviders.VERTEX_AI,
)
else:
elif isinstance(client, (httpx.AsyncClient, AsyncHTTPHandler)):
http_handler = client
else:
raise BaseLLMException(
status_code=400,
message=f"Invalid async client type: {type(client)}. Expected AsyncHTTPHandler or httpx.AsyncClient.",
)
response = await http_handler.post(
url=api_base,