@mastra/mongodb 1.24.0 → 1.24.1-alpha.0
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/_types/@internal_core/dist/memory/index.d.ts +12 -13
- 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 +2 -2
- package/dist/docs/references/docs-memory-working-memory.md +2 -2
- package/dist/docs/references/docs-storage.md +1 -1
- package/dist/docs/references/integrations-databases-mongodb.md +1 -1
- package/dist/docs/references/reference-rag-retrieval.md +13 -13
- package/dist/docs/references/reference-vectors-mongodb.md +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/vector/index.d.ts.map +1 -1
- package/package.json +7 -6
|
@@ -9,18 +9,18 @@
|
|
|
9
9
|
* into the table schema they get from `@mastra/core`, so the columns exist even when the
|
|
10
10
|
* installed core predates them.
|
|
11
11
|
*/
|
|
12
|
-
declare const OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS: {
|
|
12
|
+
export declare const OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS: {
|
|
13
13
|
readonly supersededBy: {
|
|
14
14
|
readonly type: 'text';
|
|
15
15
|
readonly nullable: true;
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
18
|
/** `schema` plus {@link OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS}; `undefined` when `schema` is. */
|
|
19
|
-
declare function withObservationalMemoryLifecycleColumns<T extends object>(schema: T | undefined): (T & typeof OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS) | undefined;
|
|
19
|
+
export declare function withObservationalMemoryLifecycleColumns<T extends object>(schema: T | undefined): (T & typeof OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS) | undefined;
|
|
20
20
|
/**
|
|
21
21
|
* Result of `commitActiveObservations`.
|
|
22
22
|
*/
|
|
23
|
-
interface UpdateActiveObservationsResult {
|
|
23
|
+
export interface UpdateActiveObservationsResult {
|
|
24
24
|
/** Whether the observations were written. */
|
|
25
25
|
applied: boolean;
|
|
26
26
|
/**
|
|
@@ -38,14 +38,14 @@ interface UpdateActiveObservationsResult {
|
|
|
38
38
|
* the head's cursor. Chunks carry `lastObservedAt = max message time + 1ms`, so a chunk is
|
|
39
39
|
* wholly covered iff `head.lastObservedAt >= chunk.lastObservedAt - 1ms`.
|
|
40
40
|
*/
|
|
41
|
-
interface UpdateBufferedObservationsResult {
|
|
41
|
+
export interface UpdateBufferedObservationsResult {
|
|
42
42
|
/** Whether the chunk was stored. */
|
|
43
43
|
persisted: boolean;
|
|
44
44
|
/** The record the chunk was written to (or would have been written to). */
|
|
45
45
|
recordId: string;
|
|
46
46
|
}
|
|
47
47
|
/** The fields of an observational memory record that decide head order. */
|
|
48
|
-
interface ObservationalMemoryHeadOrderFields {
|
|
48
|
+
export interface ObservationalMemoryHeadOrderFields {
|
|
49
49
|
generationCount: number;
|
|
50
50
|
createdAt: Date | string;
|
|
51
51
|
id: string;
|
|
@@ -54,16 +54,16 @@ interface ObservationalMemoryHeadOrderFields {
|
|
|
54
54
|
* Canonical head order: `generationCount DESC, createdAt ASC, id ASC`.
|
|
55
55
|
* Returns a negative number when `a` sorts before `b` (i.e. `a` is the better head candidate).
|
|
56
56
|
*/
|
|
57
|
-
declare function compareObservationalMemoryHeadOrder(a: ObservationalMemoryHeadOrderFields, b: ObservationalMemoryHeadOrderFields): number;
|
|
57
|
+
export declare function compareObservationalMemoryHeadOrder(a: ObservationalMemoryHeadOrderFields, b: ObservationalMemoryHeadOrderFields): number;
|
|
58
58
|
/**
|
|
59
59
|
* A buffered chunk stores `lastObservedAt = max message time + 1ms`. It is wholly covered
|
|
60
60
|
* (every message it observed is already at or before the cursor) iff
|
|
61
61
|
* `cursor >= chunk.lastObservedAt - 1ms`.
|
|
62
62
|
*/
|
|
63
|
-
declare function isBufferedChunkCoveredByCursor(chunkLastObservedAt: Date | string, cursor: Date | string | null | undefined): boolean;
|
|
63
|
+
export declare function isBufferedChunkCoveredByCursor(chunkLastObservedAt: Date | string, cursor: Date | string | null | undefined): boolean;
|
|
64
64
|
/** The later of two cursors; `undefined` only when both are absent. */
|
|
65
|
-
declare function maxObservationCursor(a: Date | string | null | undefined, b: Date | string | null | undefined): Date | undefined;
|
|
66
|
-
interface ReflectionTextPlan {
|
|
65
|
+
export declare function maxObservationCursor(a: Date | string | null | undefined, b: Date | string | null | undefined): Date | undefined;
|
|
66
|
+
export interface ReflectionTextPlan {
|
|
67
67
|
/** `equal`: stored text equals the snapshot. `append`: observations were appended after the snapshot. */
|
|
68
68
|
mode: 'equal' | 'append';
|
|
69
69
|
observations: string;
|
|
@@ -78,7 +78,7 @@ interface ReflectionTextPlan {
|
|
|
78
78
|
* after the reflection, and its tokens are added.
|
|
79
79
|
* - Anything else (a non-append rewrite): `null` — the reflection must not be applied.
|
|
80
80
|
*/
|
|
81
|
-
declare function planReflectionGenerationText(input: {
|
|
81
|
+
export declare function planReflectionGenerationText(input: {
|
|
82
82
|
storedObservations: string;
|
|
83
83
|
storedObservationTokenCount: number;
|
|
84
84
|
snapshotObservations: string;
|
|
@@ -91,12 +91,11 @@ declare function planReflectionGenerationText(input: {
|
|
|
91
91
|
* Callers of `updateActiveObservations` (which resolves `void`) can't see a commit result, so a
|
|
92
92
|
* write that was not applied throws instead of resolving as if it had committed.
|
|
93
93
|
*/
|
|
94
|
-
declare function assertActiveObservationsApplied(result: UpdateActiveObservationsResult, id: string): void;
|
|
94
|
+
export declare function assertActiveObservationsApplied(result: UpdateActiveObservationsResult, id: string): void;
|
|
95
95
|
/**
|
|
96
96
|
* Whether the stored text can still accept a reflection built from `snapshot`
|
|
97
97
|
* (equal, or only appended to since).
|
|
98
98
|
*/
|
|
99
|
-
declare function isAppendOnlySince(storedObservations: string, snapshotObservations: string): boolean;
|
|
99
|
+
export declare function isAppendOnlySince(storedObservations: string, snapshotObservations: string): boolean;
|
|
100
100
|
//#endregion
|
|
101
|
-
export { OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS, ObservationalMemoryHeadOrderFields, ReflectionTextPlan, UpdateActiveObservationsResult, UpdateBufferedObservationsResult, assertActiveObservationsApplied, compareObservationalMemoryHeadOrder, isAppendOnlySince, isBufferedChunkCoveredByCursor, maxObservationCursor, planReflectionGenerationText, withObservationalMemoryLifecycleColumns };
|
|
102
101
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -34,7 +34,7 @@ const agent = new Agent({
|
|
|
34
34
|
id: 'support-agent',
|
|
35
35
|
name: 'SupportAgent',
|
|
36
36
|
instructions: 'You are a helpful support agent.',
|
|
37
|
-
model: 'openai/gpt-
|
|
37
|
+
model: 'openai/gpt-6.1-sol',
|
|
38
38
|
memory: new Memory({
|
|
39
39
|
storage: new LibSQLStore({
|
|
40
40
|
id: 'agent-storage',
|
|
@@ -64,7 +64,7 @@ const agent = new Agent({
|
|
|
64
64
|
id: 'support-agent',
|
|
65
65
|
name: 'SupportAgent',
|
|
66
66
|
instructions: 'You are a helpful support agent.',
|
|
67
|
-
model: 'openai/gpt-
|
|
67
|
+
model: 'openai/gpt-6.1-sol',
|
|
68
68
|
memory: new Memory({
|
|
69
69
|
storage: new MongoDBStore({
|
|
70
70
|
id: 'agent-storage',
|
|
@@ -34,7 +34,7 @@ const agent = new Agent({
|
|
|
34
34
|
id: 'personal-assistant',
|
|
35
35
|
name: 'PersonalAssistant',
|
|
36
36
|
instructions: 'You are a helpful personal assistant.',
|
|
37
|
-
model: 'openai/gpt-
|
|
37
|
+
model: 'openai/gpt-6.1-sol',
|
|
38
38
|
memory: new Memory({
|
|
39
39
|
options: {
|
|
40
40
|
workingMemory: {
|
|
@@ -418,7 +418,7 @@ const response = await agent.generate('What do you know about me?', {
|
|
|
418
418
|
|
|
419
419
|
## Opt in to state signals (experimental)
|
|
420
420
|
|
|
421
|
-
By default, working memory reaches the model as part of the system message. You can opt into delivering it as a [state signal](https://mastra.ai/docs/
|
|
421
|
+
By default, working memory reaches the model as part of the system message. You can opt into delivering it as a [state signal](https://mastra.ai/docs/signals/state-signals) instead by setting `useStateSignals: true`:
|
|
422
422
|
|
|
423
423
|
```typescript
|
|
424
424
|
const memory = new Memory({
|
|
@@ -146,7 +146,7 @@ export const supportAgent = new Agent({
|
|
|
146
146
|
id: 'support-agent',
|
|
147
147
|
name: 'Support agent',
|
|
148
148
|
instructions: 'Answer customer support questions.',
|
|
149
|
-
model: 'openai/gpt-
|
|
149
|
+
model: 'openai/gpt-6.1-sol',
|
|
150
150
|
memory: new Memory({
|
|
151
151
|
storage: new PostgresStore({
|
|
152
152
|
id: 'support-agent-storage',
|
|
@@ -212,7 +212,7 @@ export const mongodbAgent = new Agent({
|
|
|
212
212
|
name: 'mongodb-agent',
|
|
213
213
|
instructions:
|
|
214
214
|
'You are an AI agent with the ability to automatically recall memories from previous interactions.',
|
|
215
|
-
model: 'openai/gpt-
|
|
215
|
+
model: 'openai/gpt-6.1-sol',
|
|
216
216
|
memory: new Memory({
|
|
217
217
|
storage: new MongoDBStore({
|
|
218
218
|
id: 'mongodb-storage',
|
|
@@ -386,7 +386,7 @@ import { MONGODB_PROMPT } from '@mastra/mongodb'
|
|
|
386
386
|
export const ragAgent = new Agent({
|
|
387
387
|
id: 'rag-agent',
|
|
388
388
|
name: 'RAG Agent',
|
|
389
|
-
model: 'openai/gpt-
|
|
389
|
+
model: 'openai/gpt-6.1-sol',
|
|
390
390
|
instructions: `
|
|
391
391
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
392
392
|
${MONGODB_PROMPT}
|
|
@@ -403,7 +403,7 @@ import { PGVECTOR_PROMPT } from '@mastra/pg'
|
|
|
403
403
|
export const ragAgent = new Agent({
|
|
404
404
|
id: 'rag-agent',
|
|
405
405
|
name: 'RAG Agent',
|
|
406
|
-
model: 'openai/gpt-
|
|
406
|
+
model: 'openai/gpt-6.1-sol',
|
|
407
407
|
instructions: `
|
|
408
408
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
409
409
|
${PGVECTOR_PROMPT}
|
|
@@ -420,7 +420,7 @@ import { PINECONE_PROMPT } from '@mastra/pinecone'
|
|
|
420
420
|
export const ragAgent = new Agent({
|
|
421
421
|
id: 'rag-agent',
|
|
422
422
|
name: 'RAG Agent',
|
|
423
|
-
model: 'openai/gpt-
|
|
423
|
+
model: 'openai/gpt-6.1-sol',
|
|
424
424
|
instructions: `
|
|
425
425
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
426
426
|
${PINECONE_PROMPT}
|
|
@@ -437,7 +437,7 @@ import { QDRANT_PROMPT } from '@mastra/qdrant'
|
|
|
437
437
|
export const ragAgent = new Agent({
|
|
438
438
|
id: 'rag-agent',
|
|
439
439
|
name: 'RAG Agent',
|
|
440
|
-
model: 'openai/gpt-
|
|
440
|
+
model: 'openai/gpt-6.1-sol',
|
|
441
441
|
instructions: `
|
|
442
442
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
443
443
|
${QDRANT_PROMPT}
|
|
@@ -454,7 +454,7 @@ import { CHROMA_PROMPT } from '@mastra/chroma'
|
|
|
454
454
|
export const ragAgent = new Agent({
|
|
455
455
|
id: 'rag-agent',
|
|
456
456
|
name: 'RAG Agent',
|
|
457
|
-
model: 'openai/gpt-
|
|
457
|
+
model: 'openai/gpt-6.1-sol',
|
|
458
458
|
instructions: `
|
|
459
459
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
460
460
|
${CHROMA_PROMPT}
|
|
@@ -471,7 +471,7 @@ import { ASTRA_PROMPT } from '@mastra/astra'
|
|
|
471
471
|
export const ragAgent = new Agent({
|
|
472
472
|
id: 'rag-agent',
|
|
473
473
|
name: 'RAG Agent',
|
|
474
|
-
model: 'openai/gpt-
|
|
474
|
+
model: 'openai/gpt-6.1-sol',
|
|
475
475
|
instructions: `
|
|
476
476
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
477
477
|
${ASTRA_PROMPT}
|
|
@@ -488,7 +488,7 @@ import { LIBSQL_PROMPT } from '@mastra/libsql'
|
|
|
488
488
|
export const ragAgent = new Agent({
|
|
489
489
|
id: 'rag-agent',
|
|
490
490
|
name: 'RAG Agent',
|
|
491
|
-
model: 'openai/gpt-
|
|
491
|
+
model: 'openai/gpt-6.1-sol',
|
|
492
492
|
instructions: `
|
|
493
493
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
494
494
|
${LIBSQL_PROMPT}
|
|
@@ -505,7 +505,7 @@ import { UPSTASH_PROMPT } from '@mastra/upstash'
|
|
|
505
505
|
export const ragAgent = new Agent({
|
|
506
506
|
id: 'rag-agent',
|
|
507
507
|
name: 'RAG Agent',
|
|
508
|
-
model: 'openai/gpt-
|
|
508
|
+
model: 'openai/gpt-6.1-sol',
|
|
509
509
|
instructions: `
|
|
510
510
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
511
511
|
${UPSTASH_PROMPT}
|
|
@@ -522,7 +522,7 @@ import { VECTORIZE_PROMPT } from '@mastra/vectorize'
|
|
|
522
522
|
export const ragAgent = new Agent({
|
|
523
523
|
id: 'rag-agent',
|
|
524
524
|
name: 'RAG Agent',
|
|
525
|
-
model: 'openai/gpt-
|
|
525
|
+
model: 'openai/gpt-6.1-sol',
|
|
526
526
|
instructions: `
|
|
527
527
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
528
528
|
${VECTORIZE_PROMPT}
|
|
@@ -539,7 +539,7 @@ import { OPENSEARCH_PROMPT } from '@mastra/opensearch'
|
|
|
539
539
|
export const ragAgent = new Agent({
|
|
540
540
|
id: 'rag-agent',
|
|
541
541
|
name: 'RAG Agent',
|
|
542
|
-
model: 'openai/gpt-
|
|
542
|
+
model: 'openai/gpt-6.1-sol',
|
|
543
543
|
instructions: `
|
|
544
544
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
545
545
|
${OPENSEARCH_PROMPT}
|
|
@@ -556,7 +556,7 @@ import { ORACLEDB_PROMPT } from '@mastra/oracledb'
|
|
|
556
556
|
export const ragAgent = new Agent({
|
|
557
557
|
id: 'rag-agent',
|
|
558
558
|
name: 'RAG Agent',
|
|
559
|
-
model: 'openai/gpt-
|
|
559
|
+
model: 'openai/gpt-6.1-sol',
|
|
560
560
|
instructions: `
|
|
561
561
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
562
562
|
${ORACLEDB_PROMPT}
|
|
@@ -573,7 +573,7 @@ import { S3VECTORS_PROMPT } from '@mastra/s3vectors'
|
|
|
573
573
|
export const ragAgent = new Agent({
|
|
574
574
|
id: 'rag-agent',
|
|
575
575
|
name: 'RAG Agent',
|
|
576
|
-
model: 'openai/gpt-
|
|
576
|
+
model: 'openai/gpt-6.1-sol',
|
|
577
577
|
instructions: `
|
|
578
578
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
579
579
|
${S3VECTORS_PROMPT}
|
|
@@ -605,7 +605,7 @@ const initialResults = await pgVector.query({
|
|
|
605
605
|
// Create a relevance scorer
|
|
606
606
|
const relevanceProvider = new MastraAgentRelevanceScorer(
|
|
607
607
|
'relevance-scorer',
|
|
608
|
-
'openai/gpt-
|
|
608
|
+
'openai/gpt-6.1-sol',
|
|
609
609
|
)
|
|
610
610
|
|
|
611
611
|
// Re-rank the results
|
|
@@ -558,7 +558,7 @@ export const mongodbAgent = new Agent({
|
|
|
558
558
|
name: 'mongodb-agent',
|
|
559
559
|
instructions:
|
|
560
560
|
'You are an AI agent with the ability to automatically recall memories from previous interactions.',
|
|
561
|
-
model: 'openai/gpt-
|
|
561
|
+
model: 'openai/gpt-6.1-sol',
|
|
562
562
|
memory: new Memory({
|
|
563
563
|
storage: new MongoDBStore({
|
|
564
564
|
id: 'mongodb-storage',
|
|
@@ -623,7 +623,7 @@ export const mongodbVoyageAgent = new Agent({
|
|
|
623
623
|
id: 'mongodb-voyage-agent',
|
|
624
624
|
name: 'MongoDB VoyageAI Agent',
|
|
625
625
|
instructions: 'You are an AI agent with semantic recall powered by VoyageAI and MongoDB.',
|
|
626
|
-
model: 'openai/gpt-
|
|
626
|
+
model: 'openai/gpt-6.1-sol',
|
|
627
627
|
memory: new Memory({
|
|
628
628
|
storage: new MongoDBStore({
|
|
629
629
|
id: 'mongodb-storage',
|
package/dist/index.cjs
CHANGED
|
@@ -10,7 +10,7 @@ let _mastra_core_agent = require("@mastra/core/agent");
|
|
|
10
10
|
let _mastra_core_evals = require("@mastra/core/evals");
|
|
11
11
|
let _mastra_core_storage_domains_skills = require("@mastra/core/storage/domains/skills");
|
|
12
12
|
//#region package.json
|
|
13
|
-
var version = "1.24.0";
|
|
13
|
+
var version = "1.24.1-alpha.0";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/vector/filter.ts
|
|
16
16
|
/**
|