The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix the issue from the tests for pr review
Henry Wangfcd539af33e4
diff --git a/tests/test_litellm/google_genai/test_google_genai_adapter.py b/tests/test_litellm/google_genai/test_google_genai_adapter.pyindex 669e54638a5..626692cf47d 100644--- a/tests/test_litellm/google_genai/test_google_genai_adapter.py+++ b/tests/test_litellm/google_genai/test_google_genai_adapter.py@@ -1059,7 +1059,6 @@ async def test_google_generate_content_with_openai():"""import unittest.mock- from litellm.google_genai.adapters.transformation import GoogleGenAIAdapterfrom litellm.types.llms.openai import ChatCompletionAssistantMessagefrom litellm.types.router import GenericLiteLLMParamsfrom litellm.types.utils import Choices, ModelResponse, Usage@@ -1092,9 +1091,9 @@ async def test_google_generate_content_with_openai():)# Use AsyncMock for proper async function mocking- with unittest.mock.patch.object(GoogleGenAIAdapter, 'translate_completion_to_generate_content', new_callable=unittest.mock.AsyncMock) as mock_translate:- # Set the return value directly on the AsyncMock- mock_translate.return_value = {"candidates": []}+ with unittest.mock.patch("litellm.completion", new_callable=unittest.mock.MagicMock) as mock_completion:+ # Set the return value directly on the MagicMock+ mock_completion.return_value = mock_responseresponse = await agenerate_content(model="openai/gpt-4o-mini",@@ -1110,11 +1109,23 @@ async def test_google_generate_content_with_openai():])+ # Print the request args sent to litellm.completion+ call_args, call_kwargs = mock_completion.call_args+ print("Arguments sent to litellm.completion:")+ print(f"Args: {call_args}")+ print(f"Kwargs: {call_kwargs}")+# Verify the mock was called- mock_translate.assert_called_once()+ mock_completion.assert_called_once()# Print the response for verificationprint(f"Response: {response}")+ #########################################################+ # validate only expected fields were sent to litellm.completion+ passed_fields = set(call_kwargs.keys())+ # remove any GenericLiteLLMParams fields+ passed_fields = passed_fields - set(GenericLiteLLMParams.model_fields.keys())+ assert passed_fields == set(["model", "messages"]), f"Expected only model and messages to be passed through, got {passed_fields}"@pytest.mark.asyncioasync def test_agenerate_content_x_goog_api_key_header():"""