Share via


OpenAIMemoryBuilderExtensions.WithOpenAITextEmbeddingGeneration Method

Definition

Adds the OpenAI text embeddings service. See https://platform.openai.com/docs for service details.

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

Parameters

builder
MemoryBuilder

The MemoryBuilder instance

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.

httpClient
HttpClient

Custom HttpClient for HTTP requests.

dimensions
Nullable<Int32>

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

Returns

Self instance

Applies to