IGenerativeModelStreamContentAsync(String, String, String, CancellationToken) Method

Streams content generation asynchronously based on the given input prompt, file URI, and MIME type.

Definition

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

Parameters

prompt  String
The input string used as a prompt for generating and streaming content.
fileUri  String
The URI of the file to be used for content generation.
mimeType  String
The MIME type associated with the provided file URI.
cancellationToken  CancellationToken  (Optional)
Token to monitor for cancellation requests.

Return Value

IAsyncEnumerableGenerateContentResponse
An asynchronous enumerable of GenerateContentResponse instances representing the streamed content responses.

See Also