pub struct LlmEmbedding { /* private fields */ }Expand description
LLM embedding client (headless claude / codex / opencode).
Implementations§
Source§impl LlmEmbedding
impl LlmEmbedding
Sourcepub async fn embed_batch_async(
&self,
prefix: &str,
batch: &[(usize, String)],
) -> Result<Vec<(usize, Vec<f32>)>, AppError>
pub async fn embed_batch_async( &self, prefix: &str, batch: &[(usize, String)], ) -> Result<Vec<(usize, Vec<f32>)>, AppError>
LLM call. Returns (global_index, vector) pairs. Async — this
is the unit of work scheduled by the bounded fan-out in
crate::embedder.
Cancel safety: the future owns its subprocess via
kill_on_drop(true), so dropping it (e.g. losing a
tokio::select! race against a cancellation token) kills the
child and leaks nothing.
Source§impl LlmEmbedding
impl LlmEmbedding
Sourcepub fn with_timeout_secs(self, secs: u64) -> Self
pub fn with_timeout_secs(self, secs: u64) -> Self
Apply a per-call timeout override (e.g. short budget for query Auto).
Sourcepub fn detect_available() -> Result<Self, AppError>
pub fn detect_available() -> Result<Self, AppError>
Detects which LLM CLI is available on PATH and returns the matching embedding client.
Prefers codex, then claude, then opencode (lighter context first).
Sourcepub fn with_codex() -> Result<Self, AppError>
pub fn with_codex() -> Result<Self, AppError>
With codex.
Sourcepub fn with_claude() -> Result<Self, AppError>
pub fn with_claude() -> Result<Self, AppError>
With claude.
Sourcepub fn with_codex_builder() -> LlmEmbeddingBuilder
pub fn with_codex_builder() -> LlmEmbeddingBuilder
Builder entry point for a codex-backed embedder.
Sourcepub fn with_claude_builder() -> LlmEmbeddingBuilder
pub fn with_claude_builder() -> LlmEmbeddingBuilder
Builder entry point for a claude-backed embedder.
Sourcepub fn with_opencode() -> Result<Self, AppError>
pub fn with_opencode() -> Result<Self, AppError>
With opencode.
Sourcepub fn with_opencode_builder() -> LlmEmbeddingBuilder
pub fn with_opencode_builder() -> LlmEmbeddingBuilder
Builder entry point for an opencode-backed embedder.
Sourcepub fn embed_passage(&self, text: &str) -> Result<Vec<f32>, AppError>
pub fn embed_passage(&self, text: &str) -> Result<Vec<f32>, AppError>
Embeds a single passage (chunk of a memory body).
Sourcepub fn embed_query(&self, text: &str) -> Result<Vec<f32>, AppError>
pub fn embed_query(&self, text: &str) -> Result<Vec<f32>, AppError>
Embeds a single query with the query prompt prefix.
Sourcepub fn model_label(&self) -> String
pub fn model_label(&self) -> String
Stable label for the active embedding model (flavour:model).
Sourcepub fn flavour(&self) -> EmbeddingFlavour
pub fn flavour(&self) -> EmbeddingFlavour
Returns the resolved embedding flavour of this client.
Trait Implementations§
Source§impl Clone for LlmEmbedding
impl Clone for LlmEmbedding
Source§fn clone(&self) -> LlmEmbedding
fn clone(&self) -> LlmEmbedding
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for LlmEmbedding
impl !UnwindSafe for LlmEmbedding
impl Freeze for LlmEmbedding
impl Send for LlmEmbedding
impl Sync for LlmEmbedding
impl Unpin for LlmEmbedding
impl UnsafeUnpin for LlmEmbedding
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> 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