pub trait Extractor {
// Required method
fn extract(&self, text: &str) -> Result<Vec<ExtractedFact>, ExtractError>;
// Provided method
fn extract_graph(&self, text: &str) -> Result<Extraction, ExtractError> { ... }
}Expand description
Turns a passage of raw text into atomic, graph-ready facts.
Implement this to plug in any model — a local LLM, a hosted API, or a
deterministic rule set — and feed the result straight into
crate::MemoryService::remember_extracted.
Required Methods§
Sourcefn extract(&self, text: &str) -> Result<Vec<ExtractedFact>, ExtractError>
fn extract(&self, text: &str) -> Result<Vec<ExtractedFact>, ExtractError>
Extract the atomic facts a reader would remember from text.
§Errors
Returns ExtractError if the backend fails or its output cannot be
parsed into facts.
Provided Methods§
Sourcefn extract_graph(&self, text: &str) -> Result<Extraction, ExtractError>
fn extract_graph(&self, text: &str) -> Result<Extraction, ExtractError>
Extract the facts and the entity→entity edges and entity attributes the passage states.
Defaults to Self::extract with no relations and no attributes, so
every backend written against the fact-only contract keeps compiling
and keeps working — it simply builds the bipartite fact↔topic graph it
always did. A backend that can read structure overrides this.
§Errors
Returns ExtractError if the backend fails or its output cannot be
parsed.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T: Extractor + ?Sized> Extractor for Arc<T>
Forward Extractor through an Arc, so a shared Arc<dyn Extractor>
(e.g. one held by the MCP server) satisfies the X: Extractor bound on
crate::MemoryService::remember_extracted.
impl<T: Extractor + ?Sized> Extractor for Arc<T>
Forward Extractor through an Arc, so a shared Arc<dyn Extractor>
(e.g. one held by the MCP server) satisfies the X: Extractor bound on
crate::MemoryService::remember_extracted.
Both methods are forwarded. Forwarding only extract would silently route
every Arc-held backend — which is every backend the MCP server and the
bindings use — through the fact-only default, discarding the relations and
attributes the inner extractor actually produced.
fn extract(&self, text: &str) -> Result<Vec<ExtractedFact>, ExtractError>
fn extract_graph(&self, text: &str) -> Result<Extraction, ExtractError>
Implementors§
impl Extractor for OllamaExtractor
extractor-http only.impl Extractor for OpenAiExtractor
extractor-http only.