mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-09 22:31:41 +00:00
revert rename http client in llm_passthrough_route
This commit is contained in:
parent
c5e8a498b2
commit
e1e56961a3
3 changed files with 16 additions and 16 deletions
|
|
@ -108,7 +108,7 @@ async def allm_passthrough_route(
|
|||
json: Optional[Any] = None,
|
||||
params: Optional[QueryParamTypes] = None,
|
||||
cookies: Optional[CookieTypes] = None,
|
||||
http_client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None,
|
||||
client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None,
|
||||
**kwargs,
|
||||
) -> Union[httpx.Response, AsyncIterator[bytes]]:
|
||||
"""
|
||||
|
|
@ -154,7 +154,7 @@ async def allm_passthrough_route(
|
|||
json=json,
|
||||
params=params,
|
||||
cookies=cookies,
|
||||
http_client=http_client,
|
||||
client=client,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
|
@ -234,7 +234,7 @@ def llm_passthrough_route(
|
|||
json: Optional[Any] = None,
|
||||
params: Optional[QueryParamTypes] = None,
|
||||
cookies: Optional[CookieTypes] = None,
|
||||
http_client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None,
|
||||
client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None,
|
||||
**kwargs,
|
||||
) -> Union[
|
||||
httpx.Response,
|
||||
|
|
@ -256,11 +256,11 @@ def llm_passthrough_route(
|
|||
|
||||
_is_async = allm_passthrough_route
|
||||
|
||||
if http_client is None:
|
||||
if client is None:
|
||||
if _is_async:
|
||||
http_client = litellm.module_level_aclient
|
||||
client = litellm.module_level_aclient
|
||||
else:
|
||||
http_client = litellm.module_level_client
|
||||
client = litellm.module_level_client
|
||||
|
||||
litellm_logging_obj = cast("LiteLLMLoggingObj", kwargs.get("litellm_logging_obj"))
|
||||
|
||||
|
|
@ -342,7 +342,7 @@ def llm_passthrough_route(
|
|||
if json and isinstance(json, dict) and "model" in json:
|
||||
json["model"] = model
|
||||
|
||||
request = http_client.client.build_request(
|
||||
request = client.client.build_request(
|
||||
method=method,
|
||||
url=updated_url,
|
||||
content=signed_json_body if signed_json_body is not None else content,
|
||||
|
|
@ -379,7 +379,7 @@ def llm_passthrough_route(
|
|||
if _is_async:
|
||||
# Return the coroutine to be awaited by the caller
|
||||
return _async_passthrough_request(
|
||||
client=http_client,
|
||||
client=client,
|
||||
request=request,
|
||||
is_streaming_request=is_streaming_request,
|
||||
litellm_logging_obj=litellm_logging_obj,
|
||||
|
|
@ -387,7 +387,7 @@ def llm_passthrough_route(
|
|||
)
|
||||
else:
|
||||
# Sync path - client.client.send returns Response directly
|
||||
response: httpx.Response = http_client.client.send(request=request, stream=is_streaming_request) # type: ignore
|
||||
response: httpx.Response = client.client.send(request=request, stream=is_streaming_request) # type: ignore
|
||||
response.raise_for_status()
|
||||
|
||||
if (
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ async def test_allm_passthrough_route_with_hosted_vllm_model_does_not_raise():
|
|||
"model": "anything", # will be replaced internally with normalized model
|
||||
"messages": [{"role": "user", "content": "Hello"}],
|
||||
},
|
||||
http_client=client,
|
||||
client=client,
|
||||
)
|
||||
|
||||
# Then it should not raise and return a successful httpx.Response
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ def test_llm_passthrough_route():
|
|||
"model": "my-custom-model",
|
||||
"messages": [{"role": "user", "content": "Hello, world!"}],
|
||||
},
|
||||
http_client=client,
|
||||
client=client,
|
||||
)
|
||||
|
||||
mock_post.call_args.kwargs[
|
||||
|
|
@ -94,7 +94,7 @@ def test_bedrock_application_inference_profile_url_encoding():
|
|||
endpoint="model/arn:aws:bedrock:us-east-1:123456789123:application-inference-profile/r742sbn2zckd/converse",
|
||||
method="POST",
|
||||
custom_llm_provider="bedrock",
|
||||
http_client=client,
|
||||
client=client,
|
||||
litellm_logging_obj=mock_logging_obj,
|
||||
)
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ def test_bedrock_non_application_inference_profile_no_encoding():
|
|||
endpoint="model/anthropic.claude-3-sonnet-20240229-v1:0/converse",
|
||||
method="POST",
|
||||
custom_llm_provider="bedrock",
|
||||
http_client=client,
|
||||
client=client,
|
||||
litellm_logging_obj=mock_logging_obj,
|
||||
)
|
||||
|
||||
|
|
@ -511,7 +511,7 @@ def test_azure_with_custom_api_base_and_key():
|
|||
"model": "gpt-4.1",
|
||||
"messages": [{"role": "user", "content": "Hello!"}],
|
||||
},
|
||||
http_client=client,
|
||||
client=client,
|
||||
litellm_logging_obj=mock_logging_obj,
|
||||
)
|
||||
|
||||
|
|
@ -592,7 +592,7 @@ def test_content_param_forwarded_to_build_request():
|
|||
content=raw_content,
|
||||
data=None,
|
||||
json=None,
|
||||
http_client=client,
|
||||
client=client,
|
||||
litellm_logging_obj=mock_logging_obj,
|
||||
)
|
||||
|
||||
|
|
@ -717,7 +717,7 @@ async def test_allm_passthrough_route_429_streaming_raises():
|
|||
api_base="https://my-azure.openai.azure.com",
|
||||
api_key="fake-azure-key",
|
||||
json={"model": "gpt-4", "input": "hello", "stream": True},
|
||||
http_client=async_client,
|
||||
client=async_client,
|
||||
litellm_logging_obj=mock_logging_obj,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue