CountTokensRequest interface Stay organized with collections Save and categorize content based on your preferences.
Params for callingGenerativeModel.countTokens()
Signature:
exportinterfaceCountTokensRequestProperties
| Property | Type | Description |
|---|---|---|
| contents | Content[] | |
| generationConfig | GenerationConfig | Configuration options that control how the model generates a response. |
| systemInstruction | string |Part |Content | Instructions that direct the model to behave a certain way. |
| tools | Tool[] | Tool configuration. |
CountTokensRequest.contents
Signature:
contents:Content[];CountTokensRequest.generationConfig
Configuration options that control how the model generates a response.
Signature:
generationConfig?:GenerationConfig;CountTokensRequest.systemInstruction
Instructions that direct the model to behave a certain way.
Signature:
systemInstruction?:string|Part|Content;CountTokensRequest.tools
Tool configuration.
Signature:
tools?:Tool[];Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-20 UTC.