ModelExtractor
Defined in: src/memory/extraction/model-extractor.ts:35
An Extractor that calls a language model to distill messages into discrete facts.
Use for self-managed stores that hold plain text and want automatic distillation. Backends that extract server-side should omit the extractor entirely (the no-extractor passthrough hands them raw messages instead).
Example
Section titled “Example”extraction: { trigger: [new InvocationTrigger()], extractor: new ModelExtractor({ model: cheapModel, systemPrompt: 'Extract user preferences.' }),}Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ModelExtractor(options?): ModelExtractor;Defined in: src/memory/extraction/model-extractor.ts:39
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options | ModelExtractorOptions |
Returns
Section titled “Returns”ModelExtractor
Methods
Section titled “Methods”extract()
Section titled “extract()”extract(messages, context?): Promise<ExtractionResult[]>;Defined in: src/memory/extraction/model-extractor.ts:46
Extract entries from a batch of messages.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
messages | MessageData[] | The filtered messages to extract from |
context? | ExtractorContext | Optional context (e.g. a fallback model) |
Returns
Section titled “Returns”Promise<ExtractionResult[]>
The entries to write to the store