Class GoogleGenAIExtensions
- Namespace
- Microsoft.Extensions.AI
- Assembly
- Google.GenAI.dll
Provides implementations of Microsoft.Extensions.AI abstractions based on Client.
public static class GoogleGenAIExtensions
- Inheritance
-
GoogleGenAIExtensions
- Inherited Members
Methods
AsIChatClient(Client, string?)
Creates an Microsoft.Extensions.AI.IChatClient wrapper around the specified Client.
public static IChatClient AsIChatClient(this Client client, string? defaultModelId = null)
Parameters
clientClientThe Client to wrap.
defaultModelIdstringThe default model ID to use for chat requests if not specified in Microsoft.Extensions.AI.ChatOptions.ModelId.
Returns
- IChatClient
An Microsoft.Extensions.AI.IChatClient that wraps the specified client.
Exceptions
- ArgumentNullException
clientis null.
AsIChatClient(Models, string?)
Creates an Microsoft.Extensions.AI.IChatClient wrapper around the specified Models.
public static IChatClient AsIChatClient(this Models models, string? defaultModelId = null)
Parameters
modelsModelsThe Models client to wrap.
defaultModelIdstringThe default model ID to use for chat requests if not specified in Microsoft.Extensions.AI.ChatOptions.ModelId.
Returns
- IChatClient
An Microsoft.Extensions.AI.IChatClient that wraps the specified Models client.
Exceptions
- ArgumentNullException
modelsis null.
AsIEmbeddingGenerator(Client, string?, int?)
Creates an Microsoft.Extensions.AI.IEmbeddingGenerator wrapper around the specified Client.
public static IEmbeddingGenerator<string, Embedding<float>> AsIEmbeddingGenerator(this Client client, string? defaultModelId = null, int? defaultModelDimensions = null)
Parameters
clientClientThe Client to wrap.
defaultModelIdstringThe default model ID to use for image generation requests if not specified in Microsoft.Extensions.AI.ImageGenerationOptions.ModelId.
defaultModelDimensionsint?The number of dimensions to generate in each embedding.
Returns
- IEmbeddingGenerator<string, Embedding<float>>
An Microsoft.Extensions.AI.IEmbeddingGenerator that wraps the specified client.
Exceptions
- ArgumentNullException
clientis null.
AsIEmbeddingGenerator(Models, string?, int?)
Creates an Microsoft.Extensions.AI.IEmbeddingGenerator wrapper around the specified Models.
public static IEmbeddingGenerator<string, Embedding<float>> AsIEmbeddingGenerator(this Models models, string? defaultModelId = null, int? defaultModelDimensions = null)
Parameters
modelsModelsThe Models client to wrap.
defaultModelIdstringThe default model ID to use for image generation requests if not specified in Microsoft.Extensions.AI.ImageGenerationOptions.ModelId.
defaultModelDimensionsint?The number of dimensions to generate in each embedding.
Returns
- IEmbeddingGenerator<string, Embedding<float>>
An Microsoft.Extensions.AI.IEmbeddingGenerator that wraps the specified Models client.
Exceptions
- ArgumentNullException
modelsis null.
AsIHostedFileClient(Client)
Creates an Microsoft.Extensions.AI.IHostedFileClient wrapper around the specified Client.
public static IHostedFileClient AsIHostedFileClient(this Client client)
Parameters
Returns
- IHostedFileClient
An Microsoft.Extensions.AI.IHostedFileClient that wraps the specified client.
Remarks
The hosted file client is only supported with the Gemini Developer API, not Vertex AI.
Exceptions
- ArgumentNullException
clientis null.
AsIHostedFileClient(Files)
Creates an Microsoft.Extensions.AI.IHostedFileClient wrapper around the specified Files.
public static IHostedFileClient AsIHostedFileClient(this Files files)
Parameters
Returns
- IHostedFileClient
An Microsoft.Extensions.AI.IHostedFileClient that wraps the specified Files client.
Remarks
The hosted file client is only supported with the Gemini Developer API, not Vertex AI.
Exceptions
- ArgumentNullException
filesis null.
AsIImageGenerator(Client, string?)
Creates an Microsoft.Extensions.AI.IImageGenerator wrapper around the specified Client.
public static IImageGenerator AsIImageGenerator(this Client client, string? defaultModelId = null)
Parameters
clientClientThe Client to wrap.
defaultModelIdstringThe default model ID to use for image generation requests if not specified in Microsoft.Extensions.AI.ImageGenerationOptions.ModelId.
Returns
- IImageGenerator
An Microsoft.Extensions.AI.IImageGenerator that wraps the specified client.
Exceptions
- ArgumentNullException
clientis null.
AsIImageGenerator(Models, string?)
Creates an Microsoft.Extensions.AI.IImageGenerator wrapper around the specified Models.
public static IImageGenerator AsIImageGenerator(this Models models, string? defaultModelId = null)
Parameters
modelsModelsThe Models client to wrap.
defaultModelIdstringThe default model ID to use for image generation requests if not specified in Microsoft.Extensions.AI.ImageGenerationOptions.ModelId.
Returns
- IImageGenerator
An Microsoft.Extensions.AI.IImageGenerator that wraps the specified Models client.
Exceptions
- ArgumentNullException
modelsis null.
AsIRealtimeClient(Client, string?)
Creates an Microsoft.Extensions.AI.IRealtimeClient wrapper around the specified Client for use with the Google GenAI Live API.
public static IRealtimeClient AsIRealtimeClient(this Client client, string? defaultModelId = null)
Parameters
clientClientThe Client to wrap.
defaultModelIdstringThe default model ID to use for realtime sessions.
Returns
- IRealtimeClient
An Microsoft.Extensions.AI.IRealtimeClient that wraps the specified client.
Exceptions
- ArgumentNullException
clientis null.