enforce vertex streaming to use sse for streaming

This commit is contained in:
Ishaan Jaff 2024-11-21 18:31:29 -08:00
parent 088532082e
commit 8c68979274
2 changed files with 6 additions and 13 deletions

View file

@ -4,15 +4,6 @@ model_list:
model: openai/gpt-4o
api_key: os.environ/OPENAI_API_KEY
router_settings:
provider_budget_config:
openai:
budget_limit: 0.000000000001 # float of $ value budget for time period
time_period: 1d # can be 1d, 2d, 30d
azure:
budget_limit: 100
time_period: 1d
litellm_settings:
callbacks: ["prometheus"]
default_vertex_config:
vertex_project: "adroit-crow-413218"
vertex_location: "us-central1"

View file

@ -194,14 +194,16 @@ async def vertex_proxy_route(
verbose_proxy_logger.debug("updated url %s", updated_url)
## check for streaming
target = str(updated_url)
is_streaming_request = False
if "stream" in str(updated_url):
is_streaming_request = True
target += "?alt=sse"
## CREATE PASS-THROUGH
endpoint_func = create_pass_through_route(
endpoint=endpoint,
target=str(updated_url),
target=target,
custom_headers=headers,
) # dynamically construct pass-through endpoint based on incoming path
received_value = await endpoint_func(