pub struct OpenAiEmbedding { /* private fields */ }Expand description
OpenAI-compatible embedding provider.
Calls POST /v1/embeddings with the configured model.
Works with OpenAI API and compatible endpoints.
Implementations§
Source§impl OpenAiEmbedding
impl OpenAiEmbedding
Sourcepub fn new(api_key: impl Into<String>, model: impl Into<String>) -> Self
pub fn new(api_key: impl Into<String>, model: impl Into<String>) -> Self
Create an OpenAiEmbedding provider.
SECURITY (F-MEM-4): the HTTP client is hardened with
redirect::Policy::none(), https_only(true),
connect_timeout(10s), timeout(60s), and .no_proxy(). Without
these, a slow-loris embedding endpoint wedges every memory_store,
and a redirect to a non-HTTPS host would leak the Bearer API key.
Sourcepub fn with_base_url(self, base_url: impl Into<String>) -> Self
pub fn with_base_url(self, base_url: impl Into<String>) -> Self
Override the base URL.
SECURITY (F-MEM-4): the URL must be HTTPS — https_only(true) is
already set on the client, so a plaintext URL here will fail at
request time. For local non-secret endpoints (Ollama embeddings,
vLLM), build a separate provider with a custom client.
Sourcepub fn with_dimension(self, dimension: usize) -> Self
pub fn with_dimension(self, dimension: usize) -> Self
Override the auto-detected embedding dimension.