ChatSessionGenerateContentAsync(GenerateContentRequest, CancellationToken) Method

Generates content asynchronously based on the given input parameters.

Definition

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

Parameters

request  GenerateContentRequest
An instance of GenerateContentRequest containing the input configuration and settings for content generation.
cancellationToken  CancellationToken  (Optional)
Token to monitor for cancellation requests.

Return Value

TaskGenerateContentResponse
A task that represents the asynchronous operation, containing the GenerateContentResponse with the generated content.

Implements

IGenerativeModelGenerateContentAsync(GenerateContentRequest, CancellationToken)

See Also