createMemoryEngineTool
createMemoryEngineTool(
storageCtx:StorageOperationsContext,embeddingOptions:MemoryEngineEmbeddingOptions,searchOptions?:Partial<MemoryEngineSearchOptions>,callbacks?:object):ToolConfig
Defined in: src/lib/memoryEngine/tool.ts:93
Creates a memory engine tool for use with chat completions.
The tool allows the LLM to search through past conversation messages using semantic similarity. Messages must have embeddings stored to be searchable.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
|
Storage operations context for database access | |
|
|
Options for embedding generation | |
|
|
|
Default search options (can be overridden per-call) |
|
|
|
‐ |
|
|
( |
Called after retrieval with the conversation IDs that were actually returned to the LLM. |
Returns
ToolConfig
A ToolConfig that can be passed to chat completion tools
Example
const tool = createMemoryEngineTool(
storageCtx,
{ getToken: () => getIdentityToken() },
{ limit: 5, minSimilarity: 0.4 }
);
// Use with chat completion
const result = await sendMessage({
messages: [...],
tools: [tool],
});