pub struct EmbeddingsSection {
pub backend: Option<String>,
pub url: Option<String>,
pub base_url: Option<String>,
pub model: Option<String>,
pub api_key: Option<String>,
pub api_key_env: Option<String>,
pub api_key_file: Option<String>,
pub dim: Option<u32>,
pub backfill_batch: Option<u32>,
}Expand description
v0.7.x (#1146) — [embeddings] sectioned embedding-model
configuration.
Wire format:
[embeddings]
backend = "openrouter" # ollama (default) or any
# #1067 API alias /
# openai-compatible (#1598)
base_url = "https://openrouter.ai/api/v1"
model = "google/gemini-embedding-2"
api_key_env = "OPENROUTER_API_KEY" # mutually exclusive with
# api_key_file = "/etc/ai-memory/keys/embed.key" # mode 0400 enforced
dim = 3072 # only needed for models
# outside the known-dims table
backfill_batch = 100 # 1-10000 (env override:
# AI_MEMORY_EMBED_BACKFILL_BATCH)Fields§
§backend: Option<String>Embedding backend. ollama (the default — local /api/embed
wire shape) or, since #1598, any #1067 OpenAI-compatible alias
(openrouter, openai, gemini, …) or the generic
openai-compatible escape hatch for self-hosted endpoints
(HF TEI, vLLM).
url: Option<String>Embedding endpoint URL. Defaults to http://localhost:11434
when unset (ollama backend) or to the backend alias’s default
base URL (API backends, #1598). Synonym of Self::base_url;
base_url wins when both are set.
base_url: Option<String>#1598 — embedding endpoint base URL. Synonym of Self::url
(named to match [llm].base_url); when both are set,
base_url wins.
model: Option<String>Embedding model identifier. Legacy values nomic_embed_v15
(alias for nomic-embed-text-v1.5) and mini_lm_l6_v2 (alias
for sentence-transformers/all-MiniLM-L6-v2) are honored at
parse time.
api_key: Option<String>#1598 — inline API-key literal. ALWAYS REJECTED at config load
(mirrors [llm].api_key): config.toml is typically
world-readable, so inline secrets are a credential leak. The
field exists solely so the rejection is loud instead of a
silent unknown-key skip. Use Self::api_key_env or
Self::api_key_file.
api_key_env: Option<String>#1598 — name of the process env var holding the embedding API
key. Mutually exclusive with Self::api_key_file.
api_key_file: Option<String>#1598 — path of a file holding the embedding API key (mode
0400 enforced, mirroring [llm].api_key_file). Mutually
exclusive with Self::api_key_env.
dim: Option<u32>#1598 — explicit vector-dim override for embedding models not
in KNOWN_EMBEDDING_DIMS. Takes precedence over the table
lookup; non-positive values are ignored.
backfill_batch: Option<u32>Backfill batch size. Bounded 1..=10000; out-of-range values
fall back to the compiled default (100) with a WARN. Env
override: AI_MEMORY_EMBED_BACKFILL_BATCH (#38).
Trait Implementations§
Source§impl Clone for EmbeddingsSection
impl Clone for EmbeddingsSection
Source§fn clone(&self) -> EmbeddingsSection
fn clone(&self) -> EmbeddingsSection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EmbeddingsSection
impl Debug for EmbeddingsSection
Source§impl Default for EmbeddingsSection
impl Default for EmbeddingsSection
Source§fn default() -> EmbeddingsSection
fn default() -> EmbeddingsSection
Source§impl<'de> Deserialize<'de> for EmbeddingsSection
impl<'de> Deserialize<'de> for EmbeddingsSection
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for EmbeddingsSection
Source§impl PartialEq for EmbeddingsSection
impl PartialEq for EmbeddingsSection
Source§fn eq(&self, other: &EmbeddingsSection) -> bool
fn eq(&self, other: &EmbeddingsSection) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for EmbeddingsSection
impl Serialize for EmbeddingsSection
impl StructuralPartialEq for EmbeddingsSection
Auto Trait Implementations§
impl Freeze for EmbeddingsSection
impl RefUnwindSafe for EmbeddingsSection
impl Send for EmbeddingsSection
impl Sync for EmbeddingsSection
impl Unpin for EmbeddingsSection
impl UnsafeUnpin for EmbeddingsSection
impl UnwindSafe for EmbeddingsSection
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more