Skip to content

Commit

Permalink
Update gapic lib to use 0.6.5 and fix tests (#390)
Browse files Browse the repository at this point in the history
Change-Id: Idd9b450daf8b0b2b09a07127aaa37f97e8b8cfbf
  • Loading branch information
mayureshagashe2105 authored Jun 11, 2024
1 parent b9d5bc0 commit 8713cfd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_version():
release_status = "Development Status :: 5 - Production/Stable"

dependencies = [
"google-ai-generativelanguage@https://storage.googleapis.com/generativeai-downloads/preview/ai-generativelanguage-v1beta-py.tar.gz",
"google-ai-generativelanguage==0.6.5",
"google-api-core",
"google-api-python-client",
"google-auth>=2.15.0", # 2.15 adds API key auth support
Expand Down
5 changes: 4 additions & 1 deletion tests/test_generative_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,10 @@ def test_count_tokens_smoke(self, kwargs):
self.responses["count_tokens"] = [protos.CountTokensResponse(total_tokens=7)]
model = generative_models.GenerativeModel("gemini-pro-vision", system_instruction=si)
response = model.count_tokens(**kwargs)
self.assertEqual(type(response).to_dict(response), {"total_tokens": 7})
self.assertEqual(
type(response).to_dict(response, including_default_value_fields=False),
{"total_tokens": 7},
)

@parameterized.named_parameters(
[
Expand Down
5 changes: 4 additions & 1 deletion tests/test_generative_models_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@ async def test_count_tokens_smoke(self, contents):
self.responses["count_tokens"] = [protos.CountTokensResponse(total_tokens=7)]
model = generative_models.GenerativeModel("gemini-pro-vision")
response = await model.count_tokens_async(contents)
self.assertEqual(type(response).to_dict(response), {"total_tokens": 7})
self.assertEqual(
type(response).to_dict(response, including_default_value_fields=False),
{"total_tokens": 7},
)

async def test_stream_generate_content_called_with_request_options(self):
self.client.stream_generate_content = unittest.mock.AsyncMock()
Expand Down

0 comments on commit 8713cfd

Please sign in to comment.