GeminiModelStreamContentAsync(String, String, CancellationToken) Method

Streams content generation asynchronously based on the provided text prompt, file path, and cancellation token.

Definition

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

Parameters

prompt  String
The input text prompt used to guide the content generation process.
filePath  String
The local file path
cancellationToken  CancellationToken  (Optional)
A token to monitor for cancellation requests during the streaming process.

Return Value

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

See Also