@mastra/libsql 1.27.1-alpha.1 → 1.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-memory-semantic-recall.md +4 -2
- package/dist/docs/references/reference-memory-memory-class.md +8 -6
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/vector/sql-builder.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/docs/SKILL.md
CHANGED
|
@@ -456,8 +456,10 @@ const agent = new Agent({
|
|
|
456
456
|
indexConfig: {
|
|
457
457
|
type: 'hnsw', // Use HNSW for better performance
|
|
458
458
|
metric: 'dotproduct', // Best for OpenAI embeddings
|
|
459
|
-
|
|
460
|
-
|
|
459
|
+
hnsw: {
|
|
460
|
+
m: 16, // Number of bi-directional links (default: 16)
|
|
461
|
+
efConstruction: 64, // Size of candidate list during construction (default: 64)
|
|
462
|
+
},
|
|
461
463
|
},
|
|
462
464
|
},
|
|
463
465
|
},
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Memory class
|
|
6
6
|
|
|
7
|
-
The `Memory` class provides a reliable system for managing conversation history and thread-based message storage in Mastra. It enables persistent storage of conversations, semantic search capabilities, and efficient message retrieval. You must configure a storage provider for conversation history, and if you enable semantic recall you will also need to provide a vector store and embedder.
|
|
7
|
+
The `Memory` class provides a reliable system for managing conversation history and thread-based message storage in Mastra. It enables persistent storage of conversations, semantic search capabilities, and efficient message retrieval. You must configure a storage provider for conversation history, and if you enable semantic recall you will also need to provide a vector store and, unless that vector store embeds text itself, an embedder.
|
|
8
8
|
|
|
9
9
|
## Usage example
|
|
10
10
|
|
|
@@ -31,11 +31,11 @@ export const agent = new Agent({
|
|
|
31
31
|
|
|
32
32
|
## Constructor parameters
|
|
33
33
|
|
|
34
|
-
**storage** (`MastraCompositeStore`): Storage implementation for persisting memory data.
|
|
34
|
+
**storage** (`MastraCompositeStore`): Storage implementation for persisting memory data. Optional: when omitted, an agent uses the storage of the Mastra instance it belongs to. If neither is configured, accessing memory.storage throws Memory requires a storage provider to function.
|
|
35
35
|
|
|
36
36
|
**vector** (`MastraVector | false`): Vector store for semantic search capabilities. Set to false to disable vector operations.
|
|
37
37
|
|
|
38
|
-
**embedder** (`EmbeddingModel<string> | EmbeddingModelV2<string>`): Embedder
|
|
38
|
+
**embedder** (`string | EmbeddingModel<string> | EmbeddingModelV2<string>`): Embedder for vector embeddings, as a model-router ID string (for example "openai/text-embedding-3-small"), an EmbeddingModel, or an EmbeddingModelV2. Required when semantic recall is enabled and the vector store doesn't generate embeddings itself (vector.isSelfEmbedding is false).
|
|
39
39
|
|
|
40
40
|
**embeddingDimension** (`number`): Output dimension of the embedder, as a positive integer. When set, Memory uses it to name the semantic recall index instead of embedding a probe string on first use. It must match the vectors the embedder returns: a mismatch throws a MASTRA_MEMORY_EMBEDDING_DIMENSION_MISMATCH error before any index is created. See Setting the embedding dimension.
|
|
41
41
|
|
|
@@ -49,7 +49,7 @@ export const agent = new Agent({
|
|
|
49
49
|
|
|
50
50
|
**options.retainFullInput** (`boolean`): When true, the request input is processed exactly as supplied instead of being filtered against stored history. Use this when you assemble the input yourself and need the message sequence preserved. Stored history is still loaded underneath, and every input message that isn't already stored is saved to the thread, including few-shot examples. Can be set per call on memory.options or agent-wide in the memory constructor options.
|
|
51
51
|
|
|
52
|
-
**options.semanticRecall** (`boolean | { topK: number; messageRange: number | { before: number; after: number }; scope?: 'thread' | 'resource' }`): Enable semantic search in message history. Can be a boolean or an object with configuration options. When enabled, requires
|
|
52
|
+
**options.semanticRecall** (`boolean | { topK: number; messageRange: number | { before: number; after: number }; scope?: 'thread' | 'resource' }`): Enable semantic search in message history. Can be a boolean or an object with configuration options. When enabled, requires a vector store, and an embedder unless the vector store embeds text itself (isSelfEmbedding). Default topK is 4, default messageRange is {before: 1, after: 1}.
|
|
53
53
|
|
|
54
54
|
**options.workingMemory** (`WorkingMemory`): Configuration for working memory feature. Can be { enabled: boolean; template?: string; schema?: ZodObject\<any> | JSONSchema7; scope?: 'thread' | 'resource' } or { enabled: boolean } to disable.
|
|
55
55
|
|
|
@@ -128,8 +128,10 @@ export const agent = new Agent({
|
|
|
128
128
|
indexConfig: {
|
|
129
129
|
type: 'hnsw', // Use HNSW for better performance
|
|
130
130
|
metric: 'dotproduct', // Optimal for OpenAI embeddings
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
hnsw: {
|
|
132
|
+
m: 16, // Number of bi-directional links
|
|
133
|
+
efConstruction: 64, // Construction-time candidate list size
|
|
134
|
+
},
|
|
133
135
|
},
|
|
134
136
|
},
|
|
135
137
|
workingMemory: {
|
package/dist/index.cjs
CHANGED
|
@@ -501,7 +501,7 @@ const createNumericOperator = (symbol) => {
|
|
|
501
501
|
sql: `CAST(json_extract(metadata, ${jsonPath}) AS NUMERIC) ${symbol} ?`,
|
|
502
502
|
needsValue: true
|
|
503
503
|
};
|
|
504
|
-
|
|
504
|
+
return {
|
|
505
505
|
sql: `CAST(json_extract(metadata, ${jsonPath}) AS TEXT) ${symbol} ?`,
|
|
506
506
|
needsValue: true
|
|
507
507
|
};
|
|
@@ -528,7 +528,8 @@ function buildElemMatchConditions(value) {
|
|
|
528
528
|
sql: sql.replace(pattern, `json_extract(elem.value, '$.${jsonPath}')`),
|
|
529
529
|
values
|
|
530
530
|
};
|
|
531
|
-
}
|
|
531
|
+
}
|
|
532
|
+
return {
|
|
532
533
|
sql: `json_extract(elem.value, '$.${parseJsonPathKey(field)}') = ?`,
|
|
533
534
|
values: [fieldValue]
|
|
534
535
|
};
|