compute Tokens
public CompletableFuture<ComputeTokensResponse> computeTokens(String model, List<Content> contents, ComputeTokensConfig config)
Asynchronously 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
public CompletableFuture<ComputeTokensResponse> computeTokens(String model, String text, ComputeTokensConfig config)
Asynchronously 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 count tokens for.
config
a com.google.genai.types.ComputeTokensConfig instance that specifies the optional configurations