Skip to content

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).

extraction: {
trigger: [new InvocationTrigger()],
extractor: new ModelExtractor({ model: cheapModel, systemPrompt: 'Extract user preferences.' }),
}
new ModelExtractor(options?): ModelExtractor;

Defined in: src/memory/extraction/model-extractor.ts:39

ParameterType
optionsModelExtractorOptions

ModelExtractor

extract(messages, context?): Promise<ExtractionResult[]>;

Defined in: src/memory/extraction/model-extractor.ts:46

Extract entries from a batch of messages.

ParameterTypeDescription
messagesMessageData[]The filtered messages to extract from
context?ExtractorContextOptional context (e.g. a fallback model)

Promise<ExtractionResult[]>

The entries to write to the store

Extractor.extract