GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — docs: Update the docstring for compute_tokens method. · googleapis/python-aiplatform@849e8d4

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • vertexai/generative_models
    • _generative_models.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎vertexai/generative_models/_generative_models.py‎

Copy file name to clipboardExpand all lines: vertexai/generative_models/_generative_models.py
+16-8Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ async def count_tokens_async(
825825
def compute_tokens(
826826
self, contents: ContentsType
827827
) -> gapic_llm_utility_service_types.ComputeTokensResponse:
828-
"""Counts tokens.
828+
"""Computes tokens.
829829
830830
Args:
831831
contents: Contents to send to the model.
@@ -837,9 +837,13 @@ def compute_tokens(
837837
* List[Content]
838838
839839
Returns:
840-
A CountTokensResponse object that has the following attributes:
841-
total_tokens: The total number of tokens counted across all instances from the request.
842-
total_billable_characters: The total number of billable characters counted across all instances from the request.
840+
A ComputeTokensResponse object that has the following attributes:
841+
tokens_info: Lists of tokens_info from the input.
842+
The input `contents: ContentsType` could have
843+
multiple string instances and each tokens_info
844+
item represents each string instance. Each token
845+
info consists tokens list, token_ids list and
846+
a role.
843847
"""
844848
return self._llm_utility_client.compute_tokens(
845849
request=gapic_llm_utility_service_types.ComputeTokensRequest(
@@ -852,7 +856,7 @@ def compute_tokens(
852856
async def compute_tokens_async(
853857
self, contents: ContentsType
854858
) -> gapic_llm_utility_service_types.ComputeTokensResponse:
855-
"""Counts tokens asynchronously.
859+
"""Computes tokens asynchronously.
856860
857861
Args:
858862
contents: Contents to send to the model.
@@ -864,9 +868,13 @@ async def compute_tokens_async(
864868
* List[Content]
865869
866870
Returns:
867-
And awaitable for a CountTokensResponse object that has the following attributes:
868-
total_tokens: The total number of tokens counted across all instances from the request.
869-
total_billable_characters: The total number of billable characters counted across all instances from the request.
871+
And awaitable for a ComputeTokensResponse object that has the following attributes:
872+
tokens_info: Lists of tokens_info from the input.
873+
The input `contents: ContentsType` could have
874+
multiple string instances and each tokens_info
875+
item represents each string instance. Each token
876+
info consists tokens list, token_ids list and
877+
a role.
870878
"""
871879
return await self._llm_utility_async_client.compute_tokens(
872880
request=gapic_llm_utility_service_types.ComputeTokensRequest(

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.