computeTokens

Computes tokens given a GenAI model and a list of content.

Return

a com.google.genai.types.ComputeTokensResponse instance that contains tokens results.

Parameters

model

the name of the GenAI model to use.

contents

a < to send to compute tokens for.

config

a com.google.genai.types.ComputeTokensConfig instance that specifies the optional configurations


Computes tokens given a GenAI model and a text string.

Return

a com.google.genai.types.ComputeTokensResponse instance that contains tokens results.

Parameters

model

the name of the GenAI model to use.

text

the text string to send to compute tokens for.

config

a com.google.genai.types.ComputeTokensConfig instance that specifies the optional configurations