Skip to main content

Extractor

Trait Extractor 

Source
pub trait Extractor:
    Send
    + Sync
    + 'static {
    // Required method
    fn extract<'life0, 'life1, 'async_trait>(
        &'life0 self,
        episode_id: Ulid,
        chunks: &'life1 [ChunkInput],
    ) -> Pin<Box<dyn Future<Output = Result<RawExtractionBatch, LunarisError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn applies(&self) -> bool { ... }
}
Expand description

Object-safe async extractor.

Since the llama.cpp-only cutover the shipped backends are OllamaExtractor (HTTP) and CloudApiExtractor (Anthropic / OpenAI / Gemini / MiniMax / OpenAI-compatible URL). All implementations MUST honour the per-batch timeout (D-02) by falling back to per-chunk extraction on timeout, and MUST emit either valid extractions or a sentinel recognized by validator::validate — never silently drop chunks.

Arc<dyn Extractor> is constructible (proven by the compile-time extractor_is_dyn_compat test), so the umbrella Lunaris::with_extractor builder accepts any backend without compile-time monomorphization.

Required Methods§

Source

fn extract<'life0, 'life1, 'async_trait>( &'life0 self, episode_id: Ulid, chunks: &'life1 [ChunkInput], ) -> Pin<Box<dyn Future<Output = Result<RawExtractionBatch, LunarisError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Extract entities + relations + facts from a batch of chunk inputs.

Returns a RawExtractionBatch — call validate downstream to flag NeedsReview cases (per EXTRACT-05). The Plan 03-03 ingest fan-out converts the validated batch into WriteOp::GraphNode / WriteOp::GraphEdge ops at the StoragePort::atomic_write boundary.

Provided Methods§

Source

fn applies(&self) -> bool

Returns true when this extractor produces real extractions; false for NoopExtractor so callers (Plan 03-03 ingest fan-out) can skip the GraphNode / GraphEdge WriteOps when applies() == false.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§