mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 03:34:10 +00:00
feat(pass_through_endpoints.py): support streaming requests
This commit is contained in:
parent
29bedae79f
commit
b2ffa564d1
2 changed files with 70 additions and 12 deletions
|
@ -75,10 +75,22 @@ async def gemini_proxy_route(
|
|||
merged_params = dict(request.query_params)
|
||||
merged_params.update({"key": gemini_api_key})
|
||||
|
||||
## check for streaming
|
||||
is_streaming_request = False
|
||||
if "stream" in str(updated_url):
|
||||
is_streaming_request = True
|
||||
|
||||
## CREATE PASS-THROUGH
|
||||
endpoint_func = create_pass_through_route(
|
||||
endpoint=endpoint,
|
||||
target=str(updated_url),
|
||||
) # dynamically construct pass-through endpoint based on incoming path
|
||||
return await endpoint_func(
|
||||
request, fastapi_response, user_api_key_dict, query_params=merged_params
|
||||
received_value = await endpoint_func(
|
||||
request,
|
||||
fastapi_response,
|
||||
user_api_key_dict,
|
||||
query_params=merged_params,
|
||||
stream=is_streaming_request,
|
||||
)
|
||||
|
||||
return received_value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue