pub struct EmbedCmd { /* private fields */ }Expand description
Persistent-child-process adapter for a user-supplied embedder command. See the module docs for the protocol.
Implementations§
Source§impl EmbedCmd
impl EmbedCmd
Sourcepub fn new(cmd: &str, identity: EmbedderIdentity) -> Result<Self>
pub fn new(cmd: &str, identity: EmbedderIdentity) -> Result<Self>
Spawn cmd (a shell-style command string: "python3 embedder.py"
or "my-tool --model=foo") and prepare it to accept embed
requests. The command is split by whitespace and single/double
quotes — see [shlex_split] — and the program is launched
directly, not through a shell. On Windows this means
forward-slash paths work; on Unix it means no ~ expansion
and no environment-variable substitution.
identity is the EmbedderIdentity this adapter will report;
it is matched against the database’s manifest by
crate::Mnemo::set_embedder. Pick values that describe what
the child process actually computes — mismatched identities
would corrupt recall silently.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Replace the per-request timeout. See DEFAULT_EMBED_TIMEOUT.
Trait Implementations§
Source§impl Embedder for EmbedCmd
impl Embedder for EmbedCmd
Source§fn identity(&self) -> EmbedderIdentity
fn identity(&self) -> EmbedderIdentity
set_embedder and does not re-query per call.Source§fn embed(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>>
fn embed(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>>
texts, returning one vector per input in the same order.
Caller-level errors (network failure for a hosted embedder, OOM
in a local model) should bubble up as MnemoError::Invalid
with a short message — the specific crypto / page errors in
MnemoError are reserved for the engine’s own concerns.