IGenerativeModelCountTokensAsync(CountTokensRequest) Method

Counts tokens asynchronously based on the provided request.

Definition

Namespace: GenerativeAI
Assembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
C#
Task<CountTokensResponse> CountTokensAsync(
	CountTokensRequest request
)

Parameters

request  CountTokensRequest
An instance of CountTokensRequest containing the details of contents or generation parameters for counting tokens.

Return Value

TaskCountTokensResponse
A task that represents the asynchronous operation, containing a CountTokensResponse with the token count details.

See Also