Skip to content

Commit 1e5859b

Browse files
committed
Add Google to test_client.py
1 parent 29c3a8a commit 1e5859b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/client/test_client.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ class TestClient(unittest.TestCase):
1515
@patch(
1616
"aisuite.providers.anthropic_provider.AnthropicProvider.chat_completions_create"
1717
)
18+
@patch("aisuite.providers.google_provider.GoogleProvider.chat_completions_create")
1819
def test_client_chat_completions(
1920
self,
21+
mock_google,
2022
mock_anthropic,
2123
mock_azure,
2224
mock_bedrock,
@@ -31,6 +33,7 @@ def test_client_chat_completions(
3133
mock_anthropic.return_value = "Anthropic Response"
3234
mock_groq.return_value = "Groq Response"
3335
mock_mistral.return_value = "Mistral Response"
36+
mock_google.return_value = "Google Response"
3437

3538
# Provider configurations
3639
provider_configs = {
@@ -50,6 +53,11 @@ def test_client_chat_completions(
5053
ProviderNames.MISTRAL: {
5154
"api_key": "mistral-api-key",
5255
},
56+
ProviderNames.GOOGLE: {
57+
"project_id": "test_google_project_id",
58+
"region": "us-west4",
59+
"application_credentials": "test_google_application_credentials",
60+
},
5361
}
5462

5563
# Initialize the client
@@ -104,6 +112,14 @@ def test_client_chat_completions(
104112
self.assertEqual(mistral_response, "Mistral Response")
105113
mock_mistral.assert_called_once()
106114

115+
# Test Google model
116+
google_model = ProviderNames.GOOGLE + ":" + "google-model"
117+
google_response = client.chat.completions.create(
118+
google_model, messages=messages
119+
)
120+
self.assertEqual(google_response, "Google Response")
121+
mock_google.assert_called_once()
122+
107123
# Test that new instances of Completion are not created each time we make an inference call.
108124
compl_instance = client.chat.completions
109125
next_compl_instance = client.chat.completions

0 commit comments

Comments
 (0)