次の方法で共有


OpenAIServiceCollectionExtensions.AddOpenAITextEmbeddingGeneration Method

Definition

Overloads

AddOpenAITextEmbeddingGeneration(IServiceCollection, String, OpenAIClient, String, Nullable<Int32>)

Adds the OpenAITextEmbeddingGenerationService to the IServiceCollection.

AddOpenAITextEmbeddingGeneration(IServiceCollection, String, String, String, String, Nullable<Int32>)

Adds the OpenAITextEmbeddingGenerationService to the IServiceCollection.

AddOpenAITextEmbeddingGeneration(IServiceCollection, String, OpenAIClient, String, Nullable<Int32>)

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddOpenAITextEmbeddingGeneration (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string modelId, OpenAI.OpenAIClient? openAIClient = default, string? serviceId = default, int? dimensions = default);
static member AddOpenAITextEmbeddingGeneration : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * OpenAI.OpenAIClient * string * Nullable<int> -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddOpenAITextEmbeddingGeneration (services As IServiceCollection, modelId As String, Optional openAIClient As OpenAIClient = Nothing, Optional serviceId As String = Nothing, Optional dimensions As Nullable(Of Integer) = Nothing) As IServiceCollection

Parameters

services
IServiceCollection

The IServiceCollection instance to augment.

modelId
String

The OpenAI model id.

openAIClient
OpenAI.OpenAIClient

OpenAI.OpenAIClient to use for the service. If null, one must be available in the service provider when this service is resolved.

serviceId
String

A local identifier for the given AI service

dimensions
Nullable<Int32>

The number of dimensions the resulting output embeddings should have. Only supported in "text-embedding-3" and later models.

Returns

The same instance as services.

Applies to

AddOpenAITextEmbeddingGeneration(IServiceCollection, String, String, String, String, Nullable<Int32>)

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddOpenAITextEmbeddingGeneration (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string modelId, string apiKey, string? orgId = default, string? serviceId = default, int? dimensions = default);
static member AddOpenAITextEmbeddingGeneration : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * string * string * string * Nullable<int> -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddOpenAITextEmbeddingGeneration (services As IServiceCollection, modelId As String, apiKey As String, Optional orgId As String = Nothing, Optional serviceId As String = Nothing, Optional dimensions As Nullable(Of Integer) = Nothing) As IServiceCollection

Parameters

services
IServiceCollection

The IServiceCollection instance to augment.

modelId
String

OpenAI model name, see https://platform.openai.com/docs/models

orgId
String

OpenAI organization id. This is usually optional unless your account belongs to multiple organizations.

serviceId
String

A local identifier for the given AI service

dimensions
Nullable<Int32>

The number of dimensions the resulting output embeddings should have. Only supported in "text-embedding-3" and later models.

Returns

The same instance as services.

Applies to