CountTokensRequest interface

Params for callingGenerativeModel.countTokens()

Signature:

exportinterfaceCountTokensRequest

Properties

PropertyTypeDescription
contentsContent[]
generationConfigGenerationConfigConfiguration options that control how the model generates a response.
systemInstructionstring |Part |ContentInstructions that direct the model to behave a certain way.
toolsTool[]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.