Perform a token count in express mode.
Endpoint
posthttps://aiplatform.googleapis.com/v1/{model}:countTokens
Path parameters
model
string
Required. The name of the model requested to perform token counting. Format: /publishers/google/models/*
Request body
The request body contains data with the following structure:
model
string
Optional. The name of the publisher model requested to serve the prediction. Format: publishers/*/models/*
Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.
Optional. Input content.
Optional. A list of Tools
the model may use to generate the next response.
A Tool
is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.
Optional. The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph.
Optional. Generation config that the model will use to generate the response.
Response body
If successful, the response body contains an instance of CountTokensResponse
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-17 UTC.