GeminiModelGenerateContentAsync(String, String, CancellationToken) Method

Generates content asynchronously based on the given text prompt and the specified file path.

Definition

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

Parameters

prompt  String
The textual input used as the basis for content generation.
filePath  String
The path to the file that should be included in the content generation request.
cancellationToken  CancellationToken  (Optional)
A cancellation token used to propagate notifications that the operation should be canceled.

Return Value

TaskGenerateContentResponse
A task representing the asynchronous operation, containing the GenerateContentResponse or null if the operation fails.

See Also