GenerativeModelCountTokensAsync(IEnumerableContent) Method

Asynchronously counts the tokens in the given contents.

Definition

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

Parameters

contents  IEnumerableContent
A collection of Content objects representing the input for which tokens need to be counted.

Return Value

TaskCountTokensResponse
A task representing the asynchronous operation, containing the CountTokensResponse with the resulting token count.

Implements

IGenerativeModelCountTokensAsync(IEnumerableContent)

See Also