Skip to main content

ExtractionBackend

Trait ExtractionBackend 

Source
pub trait ExtractionBackend: Send + Sync {
    // Required methods
    fn kind(&self) -> BackendKind;
    fn model_name(&self) -> String;
    fn extract<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        content: &'life1 str,
        hints: &'life2 ExtractionHints,
    ) -> Pin<Box<dyn Future<Output = Result<ExtractionOutput, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn health<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<BackendHealth, AppError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait abstraction for any extraction backend (LLM, Embedding, None, Composite).

G21 HIGH solution: the trait allows the rest of the codebase to remain agnostic of the underlying extraction mechanism. New backends can be added without touching call sites.

Required Methods§

Source

fn kind(&self) -> BackendKind

Identify this backend (used in metrics, logs and ExtractionOutput)

Source

fn model_name(&self) -> String

Identify the underlying model/CLI being used (e.g. “codex-0.137.0”)

Source

fn extract<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, content: &'life1 str, hints: &'life2 ExtractionHints, ) -> Pin<Box<dyn Future<Output = Result<ExtractionOutput, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Extract entities and relationships from content.

hints provides optional context (memory name, type, etc.). Returns ExtractionOutput with entities, relationships, and optional embedding.

Source

fn health<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<BackendHealth, AppError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Health check: whether this backend is ready to operate.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§