GenerativeModelStreamContentAsync(String, CancellationToken) Method

Streams content generation based on a string message.

Definition

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

Parameters

prompt  String
The input prompt to be processed and streamed.
cancellationToken  CancellationToken  (Optional)
A token to observe for cancellation requests.

Return Value

IAsyncEnumerableGenerateContentResponse
An asynchronous enumerable of generated content responses.

Implements

IGenerativeModelStreamContentAsync(String, CancellationToken)

See Also