Skip to content
Tracon

GoogleImageBuilderExtensions

Namespace Tracon · Assembly Tracon.Google.dll

Adds Google image generation to the Tracon chain.

public static class GoogleImageBuilderExtensions
Inheritance
object ← GoogleImageBuilderExtensions
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

UseGoogleImages(ITraconBuilder, Action<TraconImageOptions>?)

Section titled “ UseGoogleImages(ITraconBuilder, Action<TraconImageOptions>?)”

Registers the Google image generator.

public static ITraconBuilder UseGoogleImages(this ITraconBuilder builder, Action<TraconImageOptions>? configure = null)

builder ITraconBuilder

The Tracon chain.

configure Action<TraconImageOptions>?

Optional image-tool settings.

ITraconBuilder

The continuation of the chain.

Call GoogleProviderExtensions.UseGoogle first. Google.GenAI has no Microsoft.Extensions.AI image adapter, so this call registers Tracon’s narrow GenerateAsync-only adapter.

The model must be one that generates images through generateContent, such as a Gemini image model. The older Imagen predict surface is not served by the Gemini API and a model that only supports it fails every request.

The adapter generates from a prompt only. Count is passed as the candidate count and an image model commonly returns one image whatever you ask for. A requested media type is passed to the model and the answer is checked: if the model returns another format the call fails rather than handing back bytes that do not match what was asked for. Omit it to accept the model’s own choice.

builder.AddTracon()
.UseGoogle(builder.Configuration["Google:ApiKey"]!)
.UseGoogleImages(options =>
{
options.Enabled = true;
options.Model = "gemini-2.5-flash-image";
});