fix(logging): clarify ValueError message in google_genai generate_content else branch

The else branch triggers when both httpx_response is invalid (None or
wrong type) and result is not a dict. Previous message implied
httpx_response was always None; new message explicitly names both
failed conditions, making it easier to diagnose unexpected result types.
This commit is contained in:
Charles Cheng 2026-06-19 17:57:28 +08:00 • committed by Charles Cheng
parent 311039d2cb
commit 556592573d

View file

@ -3305,7 +3305,11 @@ class Logging(LiteLLMLoggingBaseClass):
elif isinstance(result, dict):
dict_result = result
else:
raise ValueError("Google GenAI Generate Content: httpx_response is None")
raise ValueError(
f"Google GenAI Generate Content: no valid httpx_response "
f"(got {type(httpx_response).__name__!r}) and result is not a dict "
f"(got {type(result).__name__!r}); cannot log response"
)
result = litellm.VertexGeminiConfig()._transform_google_generate_content_to_openai_model_response(
completion_response=dict_result,
model_response=litellm.ModelResponse(),