GenerativeModelStreamContentAsync(IEnumerableContent, CancellationToken) Method

Streams generated content as an asynchronous enumerable based on the provided request.

Definition

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

Parameters

contents  IEnumerableContent

[Missing <param name="contents"/> documentation for "M:GenerativeAI.GenerativeModel.StreamContentAsync(System.Collections.Generic.IEnumerable{GenerativeAI.Types.Content},System.Threading.CancellationToken)"]

cancellationToken  CancellationToken  (Optional)
Optional token to cancel the streaming operation.

Return Value

IAsyncEnumerableGenerateContentResponse
An asynchronous enumerable of GenerateContentResponse objects.

Implements

IGenerativeModelStreamContentAsync(IEnumerableContent, CancellationToken)

See Also