Share via


OpenAIKernelBuilderExtensions.AddOpenAITextEmbeddingGeneration Method

Definition

Overloads

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

Adds the OpenAITextEmbeddingGenerationService to the Services.

AddOpenAITextEmbeddingGeneration(IKernelBuilder, String, String, String, String, HttpClient, Nullable<Int32>)

Adds OpenAITextEmbeddingGenerationService to the Services.

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

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

Parameters

builder
IKernelBuilder

The IServiceCollection instance to augment.

modelId
String

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

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 builder.

Applies to

AddOpenAITextEmbeddingGeneration(IKernelBuilder, String, String, String, String, HttpClient, Nullable<Int32>)

public static Microsoft.SemanticKernel.IKernelBuilder AddOpenAITextEmbeddingGeneration (this Microsoft.SemanticKernel.IKernelBuilder builder, string modelId, string apiKey, string? orgId = default, string? serviceId = default, System.Net.Http.HttpClient? httpClient = default, int? dimensions = default);
static member AddOpenAITextEmbeddingGeneration : Microsoft.SemanticKernel.IKernelBuilder * string * string * string * string * System.Net.Http.HttpClient * Nullable<int> -> Microsoft.SemanticKernel.IKernelBuilder
<Extension()>
Public Function AddOpenAITextEmbeddingGeneration (builder As IKernelBuilder, modelId As String, apiKey As String, Optional orgId As String = Nothing, Optional serviceId As String = Nothing, Optional httpClient As HttpClient = Nothing, Optional dimensions As Nullable(Of Integer) = Nothing) As IKernelBuilder

Parameters

builder
IKernelBuilder

The IKernelBuilder 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

httpClient
HttpClient

The HttpClient to use with this 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 builder.

Applies to