IGenerativeModelStreamContentAsync(GenerateContentRequest, CancellationToken) Method

Streams content generation results asynchronously based on a given request and optional cancellation token.

Definition

Namespace: GenerativeAI
Assembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
C#
IAsyncEnumerable<GenerateContentResponse> StreamContentAsync(
	GenerateContentRequest request,
	CancellationToken cancellationToken = default
)

Parameters

request  GenerateContentRequest
The content generation request containing input configurations and options.
cancellationToken  CancellationToken  (Optional)
An optional token to monitor for cancellation requests.

Return Value

IAsyncEnumerableGenerateContentResponse
An asynchronous enumerable of GenerateContentResponse objects containing the streamed generation results.

See Also