Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions google/generativeai/generative_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,13 @@ def count_tokens(
self, contents: content_types.ContentsType
) -> glm.CountTokensResponse:
contents = content_types.to_contents(contents)
return self._client.count_tokens(self.model_name, contents)
return self._client.count_tokens(model=self.model_name, contents=contents)

async def count_tokens_async(
self, contents: content_types.ContentsType
) -> glm.CountTokensResponse:
contents = content_types.to_contents(contents)
return await self._client.count_tokens(self.model_name, contents)
return await self._client.count_tokens(model=self.model_name, contents=contents)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe here should be self._async_client.count_tokens

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sending a PR for this, thanks.

# fmt: on

def start_chat(
Expand Down