Skip to main content

Module extracting_backend

Module extracting_backend 

Source
Expand description

LLM fact-extraction wrapper around any oxicode_agent::tools::MemoryBackend.

When settings.memory_llm_extract = true, every put(content, …) is sent through a structured extraction prompt and the model’s JSON response is fanned out into one inner.put(fact_text, …) per atomic fact.

Gap-2 design: the LLM call must run inside the async runtime. The LLM extractor is implemented directly as an async function that awaits the provider stream. The sync FactExtractor trait is retained only for the heuristic path (pure CPU, no I/O).

Failure policy: when the extractor errors, returns no facts, or returns malformed JSON, the wrapper falls back to storing content verbatim so memory_retain never silently drops user input.

Structs§

ExtractedFact
One atomic fact returned by the LLM extractor.
ExtractingMemoryBackend
Wrapper around any MemoryBackend.
HeuristicFactExtractor
Default heuristic — splits on sentence boundaries.
LlmExtractor
Async LLM fact extractor. Owns a Provider and a Model.

Constants§

STAGE_ONE_SYSTEM_PROMPT
omp stage_one_system.md, truncated to the parts that drive our extraction contract (we don’t need rollout_slug here — we only store a flat list of facts).
STAGE_ONE_USER_TEMPLATE
omp stage_one_input.md user template ({{content}}).

Traits§

FactExtractor
Sync, no-IO extractor (heuristic). Safe to call anywhere.

Functions§

try_make_llm_extractor
Resolve the LLM extractor from the wired Oxicode engine. Returns None when the user hasn’t configured memory_llm_extract_model or the pattern doesn’t resolve.
wrap_with_extractor
Wire the wrapper on top of an existing memory backend.