GenerativeModelCountTokensAsync(IEnumerablePart) Method

Asynchronously counts the tokens in the provided collection of parts.

Definition

Namespace: GenerativeAI
Assembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
C#
public Task<CountTokensResponse> CountTokensAsync(
	IEnumerable<Part> parts
)

Parameters

parts  IEnumerablePart
A collection of Part objects representing the input data for token counting.

Return Value

TaskCountTokensResponse
A task representing the asynchronous operation, containing the CountTokensResponse with the token counting results.

Implements

IGenerativeModelCountTokensAsync(IEnumerablePart)

See Also