pub struct OpenAiCompatEmbedder { /* private fields */ }Expand description
An /v1/embeddings client for any OpenAI-compatible server.
Implementations§
Source§impl OpenAiCompatEmbedder
impl OpenAiCompatEmbedder
Sourcepub fn new(endpoint_url: &str, model: &str, dim: usize) -> Self
pub fn new(endpoint_url: &str, model: &str, dim: usize) -> Self
Creates a client for the exact embeddings endpoint_url (e.g.
https://api.openai.com/v1/embeddings or
http://localhost:11434/v1/embeddings), a model name and the expected
dimension. The model name is also the default semantic-space id; use
Self::with_space_id to declare a stable revision or digest instead.
The URL is used as supplied; this constructor does not append or
otherwise rewrite a path. The dimension and identity are explicit — no
startup probe request, and a server disagreeing with the dimension is a
typed error, not a silently reconfigured database.
Sourcepub fn with_api_key(self, key: impl Into<String>) -> Self
pub fn with_api_key(self, key: impl Into<String>) -> Self
Adds a bearer API key (OpenAI et al.; local servers usually need none).
Sourcepub fn with_space_id(self, space_id: impl Into<String>) -> Self
pub fn with_space_id(self, space_id: impl Into<String>) -> Self
Overrides the semantic vector-space identity persisted in the
database. By default this is the model name passed to Self::new.
Use an explicit id when the provider’s request model is an alias, or when two differently named endpoints are known to produce compatible vectors. Plugmem trusts this declaration and never probes the provider to infer it. Invalid ids are rejected when the database first uses the embedder.