Partager via


VertexAIServiceCollectionExtensions.AddVertexAIGeminiChatCompletion Method

Definition

Overloads

AddVertexAIGeminiChatCompletion(IServiceCollection, String, Func<ValueTask<String>>, String, String, VertexAIVersion, String)

Adds Vertex AI Gemini Chat Completion and Text Generation services to the specified service collection.

AddVertexAIGeminiChatCompletion(IServiceCollection, String, String, String, String, VertexAIVersion, String)

Adds Vertex AI Gemini Chat Completion and Text Generation services to the specified service collection.

AddVertexAIGeminiChatCompletion(IServiceCollection, String, Func<ValueTask<String>>, String, String, VertexAIVersion, String)

Adds Vertex AI Gemini Chat Completion and Text Generation services to the specified service collection.

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddVertexAIGeminiChatCompletion (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string modelId, Func<System.Threading.Tasks.ValueTask<string>> bearerTokenProvider, string location, string projectId, Microsoft.SemanticKernel.Connectors.Google.VertexAIVersion apiVersion = Microsoft.SemanticKernel.Connectors.Google.VertexAIVersion.V1, string? serviceId = default);
static member AddVertexAIGeminiChatCompletion : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Func<System.Threading.Tasks.ValueTask<string>> * string * string * Microsoft.SemanticKernel.Connectors.Google.VertexAIVersion * string -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddVertexAIGeminiChatCompletion (services As IServiceCollection, modelId As String, bearerTokenProvider As Func(Of ValueTask(Of String)), location As String, projectId As String, Optional apiVersion As VertexAIVersion = Microsoft.SemanticKernel.Connectors.Google.VertexAIVersion.V1, Optional serviceId As String = Nothing) As IServiceCollection

Parameters

services
IServiceCollection

The service collection to add the Gemini Text Generation service to.

modelId
String

The model for text generation.

bearerTokenProvider
Func<ValueTask<String>>

The Bearer Key provider for authentication.

location
String

The location to process the request

projectId
String

Your project ID

apiVersion
VertexAIVersion

The version of the Vertex API.

serviceId
String

Optional service ID.

Returns

The updated service collection.

Remarks

This bearerTokenProvider will be called on every request, when providing the token consider using caching strategy and refresh token logic when it is expired or close to expiration.

Applies to

AddVertexAIGeminiChatCompletion(IServiceCollection, String, String, String, String, VertexAIVersion, String)

Adds Vertex AI Gemini Chat Completion and Text Generation services to the specified service collection.

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddVertexAIGeminiChatCompletion (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string modelId, string bearerKey, string location, string projectId, Microsoft.SemanticKernel.Connectors.Google.VertexAIVersion apiVersion = Microsoft.SemanticKernel.Connectors.Google.VertexAIVersion.V1, string? serviceId = default);
static member AddVertexAIGeminiChatCompletion : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * string * string * string * Microsoft.SemanticKernel.Connectors.Google.VertexAIVersion * string -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddVertexAIGeminiChatCompletion (services As IServiceCollection, modelId As String, bearerKey As String, location As String, projectId As String, Optional apiVersion As VertexAIVersion = Microsoft.SemanticKernel.Connectors.Google.VertexAIVersion.V1, Optional serviceId As String = Nothing) As IServiceCollection

Parameters

services
IServiceCollection

The service collection to add the Gemini Text Generation service to.

modelId
String

The model for text generation.

bearerKey
String

The Bearer Key for authentication.

location
String

The location to process the request

projectId
String

Your project ID

apiVersion
VertexAIVersion

The version of the Vertex API.

serviceId
String

Optional service ID.

Returns

The updated service collection.

Applies to