Class OpenAiEmbeddingProvider
Transport for any OpenAI-compatible embeddings endpoint
(POST {baseUrl}/embeddings, body {"model":..,"input":[..]},
response {"data":[{"index":i,"embedding":[..]}]}).
One implementation, many providers — same
(Provider / BaseUrl / ApiKey / ModelId) as , so it
talks to OpenAI, Mistral, Together, DeepSeek, Gemini (compat), vLLM,
llama.cpp, Ollama, LM Studio, … Set
to the embedding model (e.g. text-embedding-3-small), not the chat model.
public sealed class OpenAiEmbeddingProvider : IEmbeddingProvider
Inheritance
Implements
Properties
ProviderId
Provider identifier ("openai", "mistral", "together", ...).
public string ProviderId { get; }
Methods
Create(LlmConnectionFactory)
Convenience constructor that builds an internal HttpClient. The factory's timeout is applied per call
public static OpenAiEmbeddingProvider Create(LlmConnectionFactory factory)
EmbedAsync(IReadOnlyList<string>, CancellationToken)
Embeds each input text and returns one vector per input, in the same order.
public Task<IReadOnlyList<float[]>> EmbedAsync(IReadOnlyList<string> inputs, CancellationToken ct = default)
Constructors
OpenAiEmbeddingProvider(LlmConnectionFactory, HttpClient)
Creates the provider with an externally owned http.