From 8ede32f91ddb94133591ec89da093583e9513fcb Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 2 Sep 2024 18:13:59 -0700 Subject: [PATCH 1/2] fix linting error --- litellm/proxy/pass_through_endpoints/streaming_handler.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/litellm/proxy/pass_through_endpoints/streaming_handler.py b/litellm/proxy/pass_through_endpoints/streaming_handler.py index 4420bd1d7..b7faa21e4 100644 --- a/litellm/proxy/pass_through_endpoints/streaming_handler.py +++ b/litellm/proxy/pass_through_endpoints/streaming_handler.py @@ -98,6 +98,8 @@ async def chunk_processor( complete_streaming_response: Optional[ Union[litellm.ModelResponse, litellm.TextCompletionResponse] ] = litellm.stream_chunk_builder(chunks=all_chunks) + if complete_streaming_response is None: + complete_streaming_response = litellm.ModelResponse() end_time = datetime.now() if passthrough_success_handler_obj.is_vertex_route(url_route): From e09db615aa55b8c7076af4f25a8bd3936a114885 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 2 Sep 2024 19:29:32 -0700 Subject: [PATCH 2/2] fix linting --- .../pass_through_endpoints/success_handler.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/litellm/proxy/pass_through_endpoints/success_handler.py b/litellm/proxy/pass_through_endpoints/success_handler.py index 5ed6a1948..a5ace49ed 100644 --- a/litellm/proxy/pass_through_endpoints/success_handler.py +++ b/litellm/proxy/pass_through_endpoints/success_handler.py @@ -111,18 +111,20 @@ class PassThroughEndpointLogging: model = self.extract_model_from_url(url_route) _json_response = httpx_response.json() - litellm_model_response = await transform_vertex_response_to_openai( - response=_json_response, - model=model, - model_response=litellm.EmbeddingResponse(), + litellm_embedding_response: litellm.EmbeddingResponse = ( + await transform_vertex_response_to_openai( + response=_json_response, + model=model, + model_response=litellm.EmbeddingResponse(), + ) ) - litellm_model_response.model = model - logging_obj.model = litellm_model_response.model + litellm_embedding_response.model = model + logging_obj.model = litellm_embedding_response.model logging_obj.model_call_details["model"] = logging_obj.model await logging_obj.async_success_handler( - result=litellm_model_response, + result=litellm_embedding_response, start_time=start_time, end_time=end_time, cache_hit=cache_hit,