Share via


LoggingImageGenerator Class

Definition

A delegating image generator that logs image generation operations to an ILogger.

public ref class LoggingImageGenerator : Microsoft::Extensions::AI::DelegatingImageGenerator
[System.Diagnostics.CodeAnalysis.Experimental("MEAI001")]
public class LoggingImageGenerator : Microsoft.Extensions.AI.DelegatingImageGenerator
public class LoggingImageGenerator : Microsoft.Extensions.AI.DelegatingImageGenerator
[<System.Diagnostics.CodeAnalysis.Experimental("MEAI001")>]
type LoggingImageGenerator = class
    inherit DelegatingImageGenerator
type LoggingImageGenerator = class
    inherit DelegatingImageGenerator
Public Class LoggingImageGenerator
Inherits DelegatingImageGenerator
Inheritance
LoggingImageGenerator
Attributes

Remarks

The provided implementation of IImageGenerator is thread-safe for concurrent use so long as the ILogger employed is also thread-safe for concurrent use.

When the employed ILogger enables Trace, the contents of prompts and options are logged. These prompts and options may contain sensitive application data. Trace is disabled by default and should never be enabled in a production environment. Prompts and options are not logged at other logging levels.

Constructors

LoggingImageGenerator(IImageGenerator, ILogger)

Initializes a new instance of the LoggingImageGenerator class.

Properties

InnerGenerator

Gets the inner IImageGenerator.

(Inherited from DelegatingImageGenerator)
JsonSerializerOptions

Gets or sets JSON serialization options to use when serializing logging data.

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

(Inherited from DelegatingImageGenerator)
Dispose(Boolean)

Provides a mechanism for releasing unmanaged resources.

(Inherited from DelegatingImageGenerator)
GenerateAsync(ImageGenerationRequest, ImageGenerationOptions, CancellationToken)

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

GetService(Type, Object)

Asks the IImageGenerator for an object of the specified type serviceType.

(Inherited from DelegatingImageGenerator)

Extension Methods

AsBuilder(IImageGenerator)

Creates a new ImageGeneratorBuilder using innerGenerator as its inner generator.

EditImageAsync(IImageGenerator, DataContent, String, ImageGenerationOptions, CancellationToken)

Edits a single image based on the original image and the specified prompt.

EditImageAsync(IImageGenerator, ReadOnlyMemory<Byte>, String, String, ImageGenerationOptions, CancellationToken)

Edits a single image based on a byte array and the specified prompt.

EditImagesAsync(IImageGenerator, IEnumerable<AIContent>, String, ImageGenerationOptions, CancellationToken)

Edits images based on original images and a text prompt.

GenerateImagesAsync(IImageGenerator, String, ImageGenerationOptions, CancellationToken)

Generates images based on a text prompt.

GetRequiredService(IImageGenerator, Type, Object)

Asks the IImageGenerator for an object of the specified type serviceType and throws an exception if one isn't available.

GetRequiredService<TService>(IImageGenerator, Object)

Asks the IImageGenerator for an object of type TService and throws an exception if one isn't available.

GetService<TService>(IImageGenerator, Object)

Asks the IImageGenerator for an object of type TService.

Applies to