Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

IImageGenerator.GenerateAsync Method

Definition

Namespace:
Microsoft.Extensions.AI
Assembly:
Microsoft.Extensions.AI.Abstractions.dll
Package:
Microsoft.Extensions.AI.Abstractions v10.7.0
Source:
IImageGenerator.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Sends an image generation request and returns the generated image as a ImageGenerationResponse.

public System.Threading.Tasks.Task<Microsoft.Extensions.AI.ImageGenerationResponse> GenerateAsync(Microsoft.Extensions.AI.ImageGenerationRequest request, Microsoft.Extensions.AI.ImageGenerationOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GenerateAsync : Microsoft.Extensions.AI.ImageGenerationRequest * Microsoft.Extensions.AI.ImageGenerationOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Extensions.AI.ImageGenerationResponse>
Public Function GenerateAsync (request As ImageGenerationRequest, Optional options As ImageGenerationOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ImageGenerationResponse)

Parameters

request
ImageGenerationRequest

The image generation request containing the prompt and optional original images for editing.

options
ImageGenerationOptions

The image generation options to configure the request.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

The images generated by the ImageGenerationRequest.

Exceptions

request is null.

Applies to


Feedback

Was this page helpful?