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.
pub fn with_dimension(self, dimension: usize) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OpenAiEmbedding
impl !RefUnwindSafe for OpenAiEmbedding
impl Send for OpenAiEmbedding
impl Sync for OpenAiEmbedding
impl Unpin for OpenAiEmbedding
impl UnsafeUnpin for OpenAiEmbedding
impl !UnwindSafe for OpenAiEmbedding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more