@mastra/rag 2.7.0 → 2.7.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-guides-context-engineering.md +13 -6
- package/dist/docs/references/reference-rag-chunking-and-embedding.md +2 -2
- package/dist/docs/references/reference-rag-database-config.md +20 -15
- package/dist/docs/references/reference-rag-extract-params.md +2 -2
- package/dist/docs/references/reference-rag-graph-rag-guide.md +2 -2
- package/dist/docs/references/reference-rag-graph-rag.md +5 -1
- package/dist/docs/references/reference-rag-rerank.md +1 -1
- package/dist/docs/references/reference-rag-retrieval.md +24 -13
- package/dist/docs/references/reference-tools-bedrock-kb-tool.md +2 -2
- package/dist/docs/references/reference-tools-document-chunker-tool.md +1 -1
- package/dist/docs/references/reference-tools-vector-query-tool.md +2 -1
- package/dist/docs/references/reference-vectors-oracledb.md +2 -2
- package/dist/document/transformers/json.d.ts.map +1 -1
- package/dist/document/transformers/markdown.d.ts.map +1 -1
- package/dist/index.cjs +45 -89
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +45 -89
- package/dist/index.js.map +1 -1
- package/package.json +16 -16
package/dist/docs/SKILL.md
CHANGED
|
@@ -33,9 +33,8 @@ export const supportAgent = new Agent({
|
|
|
33
33
|
id: 'support-agent',
|
|
34
34
|
name: 'Support Agent',
|
|
35
35
|
instructions: `You help customers understand their account.
|
|
36
|
-
Today is ${new Date().toDateString()}.
|
|
37
36
|
Use plain language and don't invent account details.`,
|
|
38
|
-
model: 'openai/gpt-
|
|
37
|
+
model: 'openai/gpt-6.1-sol',
|
|
39
38
|
})
|
|
40
39
|
```
|
|
41
40
|
|
|
@@ -51,7 +50,15 @@ instructions: ({ requestContext }) => {
|
|
|
51
50
|
}
|
|
52
51
|
```
|
|
53
52
|
|
|
54
|
-
Use `RequestContext` when instructions depend on data that changes with each request, such as the current user, tenant, locale, role, or feature flags.
|
|
53
|
+
Use `RequestContext` when instructions depend on data that changes with each request, such as the current user, tenant, locale, role, or feature flags. Anything evaluated when the agent is constructed, including an interpolated `new Date()`, is fixed for the life of the process, so compute time-dependent values inside a callback and pass an explicit timezone:
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
instructions: () =>
|
|
57
|
+
`You help customers understand their account.
|
|
58
|
+
Today is ${new Date().toLocaleDateString('en-US', { timeZone: 'America/New_York' })}.`
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Resolving the date in the callback means a long-running server picks up the new day after midnight, and the explicit `timeZone` keeps the date stable regardless of the host's timezone. If the date must refresh across tool continuations or coexist with Studio instruction overrides, use a [`processInputStep`](https://mastra.ai/reference/processors/processor-interface) processor instead.
|
|
55
62
|
|
|
56
63
|
> **Tip:** If the resolved instructions change often, the model provider may not be able to reuse the same prompt cache prefix. Keep the stable part first, and pass frequently changing background through messages or signals instead.
|
|
57
64
|
>
|
|
@@ -160,7 +167,7 @@ import { Memory } from '@mastra/memory'
|
|
|
160
167
|
export const assistant = new Agent({
|
|
161
168
|
id: 'assistant',
|
|
162
169
|
name: 'Assistant',
|
|
163
|
-
model: 'openai/gpt-
|
|
170
|
+
model: 'openai/gpt-6.1-sol',
|
|
164
171
|
memory: new Memory({
|
|
165
172
|
options: {
|
|
166
173
|
lastMessages: 20,
|
|
@@ -195,7 +202,7 @@ import { Memory } from '@mastra/memory'
|
|
|
195
202
|
export const assistant = new Agent({
|
|
196
203
|
id: 'assistant',
|
|
197
204
|
name: 'Assistant',
|
|
198
|
-
model: 'openai/gpt-
|
|
205
|
+
model: 'openai/gpt-6.1-sol',
|
|
199
206
|
memory: new Memory({
|
|
200
207
|
options: {
|
|
201
208
|
observationalMemory: true,
|
|
@@ -210,7 +217,7 @@ Observations are added in stable chunks, which helps providers reuse the existin
|
|
|
210
217
|
|
|
211
218
|
## Signals
|
|
212
219
|
|
|
213
|
-
[Signals](https://mastra.ai/docs/
|
|
220
|
+
[Signals](https://mastra.ai/docs/signals/overview) add messages or system-generated context to a memory-backed thread. Delivery depends on the thread's state: a signal can wake an idle agent or enter an active loop. It can also wait for the next turn or persist without waking the agent.
|
|
214
221
|
|
|
215
222
|
State signals require memory and an existing thread. Notification inbox signals require a storage adapter with notification support.
|
|
216
223
|
|
|
@@ -63,7 +63,7 @@ For markdown documents where preserving the semantic relationships between secti
|
|
|
63
63
|
const chunks = await doc.chunk({
|
|
64
64
|
strategy: 'semantic-markdown',
|
|
65
65
|
joinThreshold: 500,
|
|
66
|
-
modelName: 'gpt-5',
|
|
66
|
+
modelName: 'gpt-5.6',
|
|
67
67
|
})
|
|
68
68
|
```
|
|
69
69
|
|
|
@@ -118,7 +118,7 @@ const { embeddings } = await embedMany({
|
|
|
118
118
|
})
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
Google (
|
|
121
|
+
Google (gemini-embedding-001):
|
|
122
122
|
|
|
123
123
|
```ts
|
|
124
124
|
const { embeddings } = await embedMany({
|
|
@@ -67,7 +67,7 @@ Configuration options specific to Chroma vector store.
|
|
|
67
67
|
|
|
68
68
|
**where** (`Where`): Metadata filtering conditions. Each field maps to a literal value or an operator expression ($gt, $gte, $lt, $lte, $ne, $eq, $in, $nin). Combine conditions with $and and $or.
|
|
69
69
|
|
|
70
|
-
**whereDocument** (`WhereDocument`): Document content filtering conditions using $contains and $
|
|
70
|
+
**whereDocument** (`WhereDocument`): Document content filtering conditions using $contains and $not_contains. Combine conditions with $and and $or.
|
|
71
71
|
|
|
72
72
|
**Filter Syntax Examples:**
|
|
73
73
|
|
|
@@ -172,26 +172,31 @@ await vectorTool.execute({ queryText: 'search query' }, { mastra, requestContext
|
|
|
172
172
|
### Multi-Database Configuration
|
|
173
173
|
|
|
174
174
|
```typescript
|
|
175
|
+
import { RequestContext } from '@mastra/core/request-context'
|
|
176
|
+
|
|
175
177
|
const vectorTool = createVectorQueryTool({
|
|
176
|
-
vectorStoreName: '
|
|
178
|
+
vectorStoreName: 'pinecone',
|
|
177
179
|
indexName: 'documents',
|
|
178
180
|
model: embedModel,
|
|
179
|
-
databaseConfig: {
|
|
180
|
-
pinecone: {
|
|
181
|
-
namespace: 'default',
|
|
182
|
-
},
|
|
183
|
-
pgvector: {
|
|
184
|
-
minScore: 0.8,
|
|
185
|
-
ef: 150,
|
|
186
|
-
},
|
|
187
|
-
chroma: {
|
|
188
|
-
where: { type: 'documentation' },
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
181
|
})
|
|
182
|
+
|
|
183
|
+
// Select the store per request and pass only its matching config block
|
|
184
|
+
const pineconeContext = new RequestContext()
|
|
185
|
+
pineconeContext.set('vectorStoreName', 'pinecone')
|
|
186
|
+
pineconeContext.set('databaseConfig', {
|
|
187
|
+
pinecone: { namespace: 'default' },
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
const pgVectorContext = new RequestContext()
|
|
191
|
+
pgVectorContext.set('vectorStoreName', 'pgVector')
|
|
192
|
+
pgVectorContext.set('databaseConfig', {
|
|
193
|
+
pgvector: { minScore: 0.8, ef: 150 },
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
await vectorTool.execute({ queryText: 'search query' }, { mastra, requestContext: pgVectorContext })
|
|
192
197
|
```
|
|
193
198
|
|
|
194
|
-
> **Note:** **Multi-Database Support**:
|
|
199
|
+
> **Note:** **Multi-Database Support**: Settings from every database block you configure are merged into the query parameters, regardless of which vector store is queried. Shared keys apply to whichever store runs the query. For example, `pgvector.minScore` is passed as `minScore`, which other stores such as LibSQL also read to filter results. Pass only the block for the vector store you query.
|
|
195
200
|
|
|
196
201
|
**Performance Tuning**:
|
|
197
202
|
|
|
@@ -70,7 +70,7 @@ The `extract` parameter accepts the following fields:
|
|
|
70
70
|
|
|
71
71
|
**promptTemplate** (`string`): Custom prompt template for question generation. Must include both {context} and {numQuestions} placeholders
|
|
72
72
|
|
|
73
|
-
**embeddingOnly** (`boolean`):
|
|
73
|
+
**embeddingOnly** (`boolean`): Accepted but currently has no effect. Questions are still generated and returned in questionsThisExcerptCanAnswer
|
|
74
74
|
|
|
75
75
|
### `KeywordExtractArgs`
|
|
76
76
|
|
|
@@ -84,7 +84,7 @@ The `extract` parameter accepts the following fields:
|
|
|
84
84
|
|
|
85
85
|
**schema** (`ZodType`): Zod schema defining the structure of the data to extract.
|
|
86
86
|
|
|
87
|
-
**llm** (`MastraLanguageModel`): AI SDK language model to use for extraction.
|
|
87
|
+
**llm** (`MastraLanguageModel | MastraLegacyLanguageModel`): AI SDK language model to use for extraction.
|
|
88
88
|
|
|
89
89
|
**instructions** (`string`): Instructions for the LLM on what to extract.
|
|
90
90
|
|
|
@@ -79,7 +79,7 @@ const ragAgent = new Agent({
|
|
|
79
79
|
instructions: `You are a helpful assistant that answers questions based on the provided context.
|
|
80
80
|
When answering questions, use the graph query tool to find relevant information and relationships.
|
|
81
81
|
Base your answers on the context provided by the tool, and clearly state if the context doesn't contain enough information.`,
|
|
82
|
-
model: 'openai/gpt-
|
|
82
|
+
model: 'openai/gpt-6.1-sol',
|
|
83
83
|
tools: {
|
|
84
84
|
graphQueryTool,
|
|
85
85
|
},
|
|
@@ -201,7 +201,7 @@ const agent = new Agent({
|
|
|
201
201
|
name: 'RAG Agent',
|
|
202
202
|
instructions: `Use vector search for simple fact-finding queries.
|
|
203
203
|
Use graph search when you need to understand relationships or find connected information.`,
|
|
204
|
-
model: 'openai/gpt-
|
|
204
|
+
model: 'openai/gpt-6.1-sol',
|
|
205
205
|
tools: {
|
|
206
206
|
vectorQueryTool,
|
|
207
207
|
graphQueryTool,
|
|
@@ -56,12 +56,14 @@ query({
|
|
|
56
56
|
query,
|
|
57
57
|
topK = 10,
|
|
58
58
|
randomWalkSteps = 100,
|
|
59
|
-
restartProb = 0.15
|
|
59
|
+
restartProb = 0.15,
|
|
60
|
+
filter
|
|
60
61
|
}: {
|
|
61
62
|
query: number[];
|
|
62
63
|
topK?: number;
|
|
63
64
|
randomWalkSteps?: number;
|
|
64
65
|
restartProb?: number;
|
|
66
|
+
filter?: Partial<Record<string, any>>;
|
|
65
67
|
}): RankedNode[]
|
|
66
68
|
```
|
|
67
69
|
|
|
@@ -75,6 +77,8 @@ query({
|
|
|
75
77
|
|
|
76
78
|
**restartProb** (`number`): Probability of restarting walk from query node (Default: `0.15`)
|
|
77
79
|
|
|
80
|
+
**filter** (`Partial<Record<string, any>>`): Restricts the search to nodes whose metadata matches every given key/value pair. Similarity search and the random walk both stay within matching nodes.
|
|
81
|
+
|
|
78
82
|
#### Returns
|
|
79
83
|
|
|
80
84
|
Returns an array of `RankedNode` objects, where each node contains:
|
|
@@ -21,7 +21,7 @@ function rerank(
|
|
|
21
21
|
import { ModelRouterLanguageModel } from '@mastra/core/llm'
|
|
22
22
|
import { rerank } from '@mastra/rag'
|
|
23
23
|
|
|
24
|
-
const model = new ModelRouterLanguageModel('openai/gpt-
|
|
24
|
+
const model = new ModelRouterLanguageModel('openai/gpt-6.1-sol')
|
|
25
25
|
|
|
26
26
|
const rerankedResults = await rerank(vectorSearchResults, 'How do I deploy to production?', model, {
|
|
27
27
|
weights: {
|
|
@@ -382,11 +382,12 @@ Vector store prompts define query patterns and filtering capabilities for each v
|
|
|
382
382
|
|
|
383
383
|
```ts
|
|
384
384
|
import { MONGODB_PROMPT } from '@mastra/mongodb'
|
|
385
|
+
import { Agent } from '@mastra/core/agent'
|
|
385
386
|
|
|
386
387
|
export const ragAgent = new Agent({
|
|
387
388
|
id: 'rag-agent',
|
|
388
389
|
name: 'RAG Agent',
|
|
389
|
-
model: 'openai/gpt-
|
|
390
|
+
model: 'openai/gpt-6.1-sol',
|
|
390
391
|
instructions: `
|
|
391
392
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
392
393
|
${MONGODB_PROMPT}
|
|
@@ -403,7 +404,7 @@ import { PGVECTOR_PROMPT } from '@mastra/pg'
|
|
|
403
404
|
export const ragAgent = new Agent({
|
|
404
405
|
id: 'rag-agent',
|
|
405
406
|
name: 'RAG Agent',
|
|
406
|
-
model: 'openai/gpt-
|
|
407
|
+
model: 'openai/gpt-6.1-sol',
|
|
407
408
|
instructions: `
|
|
408
409
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
409
410
|
${PGVECTOR_PROMPT}
|
|
@@ -416,11 +417,12 @@ export const ragAgent = new Agent({
|
|
|
416
417
|
|
|
417
418
|
```ts
|
|
418
419
|
import { PINECONE_PROMPT } from '@mastra/pinecone'
|
|
420
|
+
import { Agent } from '@mastra/core/agent'
|
|
419
421
|
|
|
420
422
|
export const ragAgent = new Agent({
|
|
421
423
|
id: 'rag-agent',
|
|
422
424
|
name: 'RAG Agent',
|
|
423
|
-
model: 'openai/gpt-
|
|
425
|
+
model: 'openai/gpt-6.1-sol',
|
|
424
426
|
instructions: `
|
|
425
427
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
426
428
|
${PINECONE_PROMPT}
|
|
@@ -433,11 +435,12 @@ export const ragAgent = new Agent({
|
|
|
433
435
|
|
|
434
436
|
```ts
|
|
435
437
|
import { QDRANT_PROMPT } from '@mastra/qdrant'
|
|
438
|
+
import { Agent } from '@mastra/core/agent'
|
|
436
439
|
|
|
437
440
|
export const ragAgent = new Agent({
|
|
438
441
|
id: 'rag-agent',
|
|
439
442
|
name: 'RAG Agent',
|
|
440
|
-
model: 'openai/gpt-
|
|
443
|
+
model: 'openai/gpt-6.1-sol',
|
|
441
444
|
instructions: `
|
|
442
445
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
443
446
|
${QDRANT_PROMPT}
|
|
@@ -450,11 +453,12 @@ export const ragAgent = new Agent({
|
|
|
450
453
|
|
|
451
454
|
```ts
|
|
452
455
|
import { CHROMA_PROMPT } from '@mastra/chroma'
|
|
456
|
+
import { Agent } from '@mastra/core/agent'
|
|
453
457
|
|
|
454
458
|
export const ragAgent = new Agent({
|
|
455
459
|
id: 'rag-agent',
|
|
456
460
|
name: 'RAG Agent',
|
|
457
|
-
model: 'openai/gpt-
|
|
461
|
+
model: 'openai/gpt-6.1-sol',
|
|
458
462
|
instructions: `
|
|
459
463
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
460
464
|
${CHROMA_PROMPT}
|
|
@@ -467,11 +471,12 @@ export const ragAgent = new Agent({
|
|
|
467
471
|
|
|
468
472
|
```ts
|
|
469
473
|
import { ASTRA_PROMPT } from '@mastra/astra'
|
|
474
|
+
import { Agent } from '@mastra/core/agent'
|
|
470
475
|
|
|
471
476
|
export const ragAgent = new Agent({
|
|
472
477
|
id: 'rag-agent',
|
|
473
478
|
name: 'RAG Agent',
|
|
474
|
-
model: 'openai/gpt-
|
|
479
|
+
model: 'openai/gpt-6.1-sol',
|
|
475
480
|
instructions: `
|
|
476
481
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
477
482
|
${ASTRA_PROMPT}
|
|
@@ -484,11 +489,12 @@ export const ragAgent = new Agent({
|
|
|
484
489
|
|
|
485
490
|
```ts
|
|
486
491
|
import { LIBSQL_PROMPT } from '@mastra/libsql'
|
|
492
|
+
import { Agent } from '@mastra/core/agent'
|
|
487
493
|
|
|
488
494
|
export const ragAgent = new Agent({
|
|
489
495
|
id: 'rag-agent',
|
|
490
496
|
name: 'RAG Agent',
|
|
491
|
-
model: 'openai/gpt-
|
|
497
|
+
model: 'openai/gpt-6.1-sol',
|
|
492
498
|
instructions: `
|
|
493
499
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
494
500
|
${LIBSQL_PROMPT}
|
|
@@ -501,11 +507,12 @@ export const ragAgent = new Agent({
|
|
|
501
507
|
|
|
502
508
|
```ts
|
|
503
509
|
import { UPSTASH_PROMPT } from '@mastra/upstash'
|
|
510
|
+
import { Agent } from '@mastra/core/agent'
|
|
504
511
|
|
|
505
512
|
export const ragAgent = new Agent({
|
|
506
513
|
id: 'rag-agent',
|
|
507
514
|
name: 'RAG Agent',
|
|
508
|
-
model: 'openai/gpt-
|
|
515
|
+
model: 'openai/gpt-6.1-sol',
|
|
509
516
|
instructions: `
|
|
510
517
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
511
518
|
${UPSTASH_PROMPT}
|
|
@@ -518,11 +525,12 @@ export const ragAgent = new Agent({
|
|
|
518
525
|
|
|
519
526
|
```ts
|
|
520
527
|
import { VECTORIZE_PROMPT } from '@mastra/vectorize'
|
|
528
|
+
import { Agent } from '@mastra/core/agent'
|
|
521
529
|
|
|
522
530
|
export const ragAgent = new Agent({
|
|
523
531
|
id: 'rag-agent',
|
|
524
532
|
name: 'RAG Agent',
|
|
525
|
-
model: 'openai/gpt-
|
|
533
|
+
model: 'openai/gpt-6.1-sol',
|
|
526
534
|
instructions: `
|
|
527
535
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
528
536
|
${VECTORIZE_PROMPT}
|
|
@@ -535,11 +543,12 @@ export const ragAgent = new Agent({
|
|
|
535
543
|
|
|
536
544
|
```ts
|
|
537
545
|
import { OPENSEARCH_PROMPT } from '@mastra/opensearch'
|
|
546
|
+
import { Agent } from '@mastra/core/agent'
|
|
538
547
|
|
|
539
548
|
export const ragAgent = new Agent({
|
|
540
549
|
id: 'rag-agent',
|
|
541
550
|
name: 'RAG Agent',
|
|
542
|
-
model: 'openai/gpt-
|
|
551
|
+
model: 'openai/gpt-6.1-sol',
|
|
543
552
|
instructions: `
|
|
544
553
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
545
554
|
${OPENSEARCH_PROMPT}
|
|
@@ -552,11 +561,12 @@ export const ragAgent = new Agent({
|
|
|
552
561
|
|
|
553
562
|
```ts
|
|
554
563
|
import { ORACLEDB_PROMPT } from '@mastra/oracledb'
|
|
564
|
+
import { Agent } from '@mastra/core/agent'
|
|
555
565
|
|
|
556
566
|
export const ragAgent = new Agent({
|
|
557
567
|
id: 'rag-agent',
|
|
558
568
|
name: 'RAG Agent',
|
|
559
|
-
model: 'openai/gpt-
|
|
569
|
+
model: 'openai/gpt-6.1-sol',
|
|
560
570
|
instructions: `
|
|
561
571
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
562
572
|
${ORACLEDB_PROMPT}
|
|
@@ -569,11 +579,12 @@ export const ragAgent = new Agent({
|
|
|
569
579
|
|
|
570
580
|
```ts
|
|
571
581
|
import { S3VECTORS_PROMPT } from '@mastra/s3vectors'
|
|
582
|
+
import { Agent } from '@mastra/core/agent'
|
|
572
583
|
|
|
573
584
|
export const ragAgent = new Agent({
|
|
574
585
|
id: 'rag-agent',
|
|
575
586
|
name: 'RAG Agent',
|
|
576
|
-
model: 'openai/gpt-
|
|
587
|
+
model: 'openai/gpt-6.1-sol',
|
|
577
588
|
instructions: `
|
|
578
589
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
579
590
|
${S3VECTORS_PROMPT}
|
|
@@ -605,7 +616,7 @@ const initialResults = await pgVector.query({
|
|
|
605
616
|
// Create a relevance scorer
|
|
606
617
|
const relevanceProvider = new MastraAgentRelevanceScorer(
|
|
607
618
|
'relevance-scorer',
|
|
608
|
-
'openai/gpt-
|
|
619
|
+
'openai/gpt-6.1-sol',
|
|
609
620
|
)
|
|
610
621
|
|
|
611
622
|
// Re-rank the results
|
|
@@ -41,11 +41,11 @@ const agent = new Agent({
|
|
|
41
41
|
|
|
42
42
|
**knowledgeBaseId** (`string`): The ID of the Amazon Bedrock Knowledge Base to query.
|
|
43
43
|
|
|
44
|
-
**region** (`string`): AWS region where the Knowledge Base is deployed. Defaults to
|
|
44
|
+
**region** (`string`): AWS region where the Knowledge Base is deployed. Defaults to AWS_REGION environment variable or us-east-1.
|
|
45
45
|
|
|
46
46
|
**numberOfResults** (`number`): Maximum number of results to return. Defaults to 5.
|
|
47
47
|
|
|
48
|
-
**useAgenticRetrieval** (`boolean`): Use AgenticRetrieveStream for complex queries with query decomposition and managed reranking. Falls back to standard Retrieve on failure. Defaults to true (disable with
|
|
48
|
+
**useAgenticRetrieval** (`boolean`): Use AgenticRetrieveStream for complex queries with query decomposition and managed reranking. Falls back to standard Retrieve on failure. Defaults to true (disable with USE_AGENTIC_RETRIEVAL=false env var).
|
|
49
49
|
|
|
50
50
|
**userId** (`string`): Default AWS user ID for document-level access control. A userId in the Mastra request context takes precedence.
|
|
51
51
|
|
|
@@ -37,7 +37,7 @@ const { chunks } = await chunker.execute()
|
|
|
37
37
|
|
|
38
38
|
### `ChunkParams`
|
|
39
39
|
|
|
40
|
-
**strategy** (`'recursive'`): The chunking strategy to use (Default: `'recursive'`)
|
|
40
|
+
**strategy** (`'character' | 'recursive' | 'token' | 'markdown' | 'html' | 'json' | 'latex' | 'sentence' | 'semantic-markdown'`): The chunking strategy to use (Default: `'recursive'`)
|
|
41
41
|
|
|
42
42
|
**maxSize** (`number`): Maximum size of each chunk in tokens/characters (Default: `512`)
|
|
43
43
|
|
|
@@ -148,7 +148,7 @@ const queryTool = createVectorQueryTool({
|
|
|
148
148
|
indexName: 'documentation',
|
|
149
149
|
model: new ModelRouterEmbeddingModel('openai/text-embedding-3-small'),
|
|
150
150
|
reranker: {
|
|
151
|
-
model: 'openai/gpt-
|
|
151
|
+
model: 'openai/gpt-6.1-sol',
|
|
152
152
|
options: {
|
|
153
153
|
weights: {
|
|
154
154
|
semantic: 0.5, // Semantic relevance weight
|
|
@@ -436,6 +436,7 @@ For multi-tenant applications where each tenant has isolated data (e.g., separat
|
|
|
436
436
|
```typescript
|
|
437
437
|
import { createVectorQueryTool, VectorStoreResolver } from '@mastra/rag'
|
|
438
438
|
import { PgVector } from '@mastra/pg'
|
|
439
|
+
import { RequestContext } from '@mastra/core/request-context'
|
|
439
440
|
|
|
440
441
|
// Cache for tenant-specific vector stores
|
|
441
442
|
const vectorStoreCache = new Map<string, PgVector>()
|
|
@@ -283,7 +283,7 @@ const vectorQueryTool = createVectorQueryTool({
|
|
|
283
283
|
export const ragAgent = new Agent({
|
|
284
284
|
id: 'oracle-rag-agent',
|
|
285
285
|
name: 'Oracle RAG Agent',
|
|
286
|
-
model: 'openai/gpt-
|
|
286
|
+
model: 'openai/gpt-6.1-sol',
|
|
287
287
|
instructions: `
|
|
288
288
|
Use the retrieval tool when you need source context.
|
|
289
289
|
Available metadata fields: resource_id, thread_id, source, category, tags.
|
|
@@ -330,7 +330,7 @@ export const oracleAgent = new Agent({
|
|
|
330
330
|
id: 'oracle-agent',
|
|
331
331
|
name: 'Oracle Agent',
|
|
332
332
|
instructions: 'You are an assistant with OracleDB-backed memory and semantic recall.',
|
|
333
|
-
model: 'openai/gpt-
|
|
333
|
+
model: 'openai/gpt-6.1-sol',
|
|
334
334
|
memory: new Memory({
|
|
335
335
|
storage,
|
|
336
336
|
vector,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/document/transformers/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,qBAAa,wBAAwB;IACnC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,YAAY,CAAU;IAE9B,YAAY,EAAE,OAAc,EAAE,OAAO,EAAE,WAAmB,EAAE,YAAmB,EAAE,EAAE,gBAAgB,EAKlG;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ;IAoCvB;;OAEG;IACI,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAiC/D;IAED;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAS5B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAU/B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/document/transformers/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UA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