From 8d053930e99494a77e69f4527d99febbaa035b41 Mon Sep 17 00:00:00 2001 From: sven Date: Thu, 13 Mar 2025 13:44:38 +0900 Subject: [PATCH] (gemini)Handle HTTP 201 status code in Vertex AI response --- .../vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py index 294939a3c57..9ac1b1ffc49 100644 --- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py +++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py @@ -846,7 +846,7 @@ async def make_call( message=VertexGeminiConfig().translate_exception_str(exception_string), headers=e.response.headers, ) - if response.status_code != 200: + if response.status_code != 200 and response.status_code != 201: raise VertexAIError( status_code=response.status_code, message=response.text, @@ -884,7 +884,7 @@ def make_sync_call( response = client.post(api_base, headers=headers, data=data, stream=True) - if response.status_code != 200: + if response.status_code != 200 and response.status_code != 201: raise VertexAIError( status_code=response.status_code, message=str(response.read()),