@mastra/upstash 1.0.0 → 1.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @mastra/upstash
2
2
 
3
+ ## 1.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - dependencies updates: ([#12783](https://github.com/mastra-ai/mastra/pull/12783))
8
+ - Updated dependency [`@upstash/redis@^1.36.2` ↗︎](https://www.npmjs.com/package/@upstash/redis/v/1.36.2) (from `^1.36.0`, in `dependencies`)
9
+ - Updated dependencies [[`717ffab`](https://github.com/mastra-ai/mastra/commit/717ffab42cfd58ff723b5c19ada4939997773004), [`b31c922`](https://github.com/mastra-ai/mastra/commit/b31c922215b513791d98feaea1b98784aa00803a), [`e4b6dab`](https://github.com/mastra-ai/mastra/commit/e4b6dab171c5960e340b3ea3ea6da8d64d2b8672), [`5719fa8`](https://github.com/mastra-ai/mastra/commit/5719fa8880e86e8affe698ec4b3807c7e0e0a06f), [`83cda45`](https://github.com/mastra-ai/mastra/commit/83cda4523e588558466892bff8f80f631a36945a), [`11804ad`](https://github.com/mastra-ai/mastra/commit/11804adf1d6be46ebe216be40a43b39bb8b397d7), [`aa95f95`](https://github.com/mastra-ai/mastra/commit/aa95f958b186ae5c9f4219c88e268f5565c277a2), [`90f7894`](https://github.com/mastra-ai/mastra/commit/90f7894568dc9481f40a4d29672234fae23090bb), [`f5501ae`](https://github.com/mastra-ai/mastra/commit/f5501aedb0a11106c7db7e480d6eaf3971b7bda8), [`44573af`](https://github.com/mastra-ai/mastra/commit/44573afad0a4bc86f627d6cbc0207961cdcb3bc3), [`00e3861`](https://github.com/mastra-ai/mastra/commit/00e3861863fbfee78faeb1ebbdc7c0223aae13ff), [`8109aee`](https://github.com/mastra-ai/mastra/commit/8109aeeab758e16cd4255a6c36f044b70eefc6a6), [`7bfbc52`](https://github.com/mastra-ai/mastra/commit/7bfbc52a8604feb0fff2c0a082c13c0c2a3df1a2), [`1445994`](https://github.com/mastra-ai/mastra/commit/1445994aee19c9334a6a101cf7bd80ca7ed4d186), [`61f44a2`](https://github.com/mastra-ai/mastra/commit/61f44a26861c89e364f367ff40825bdb7f19df55), [`37145d2`](https://github.com/mastra-ai/mastra/commit/37145d25f99dc31f1a9105576e5452609843ce32), [`fdad759`](https://github.com/mastra-ai/mastra/commit/fdad75939ff008b27625f5ec0ce9c6915d99d9ec), [`e4569c5`](https://github.com/mastra-ai/mastra/commit/e4569c589e00c4061a686c9eb85afe1b7050b0a8), [`7309a85`](https://github.com/mastra-ai/mastra/commit/7309a85427281a8be23f4fb80ca52e18eaffd596), [`99424f6`](https://github.com/mastra-ai/mastra/commit/99424f6862ffb679c4ec6765501486034754a4c2), [`44eb452`](https://github.com/mastra-ai/mastra/commit/44eb4529b10603c279688318bebf3048543a1d61), [`6c40593`](https://github.com/mastra-ai/mastra/commit/6c40593d6d2b1b68b0c45d1a3a4c6ac5ecac3937), [`8c1135d`](https://github.com/mastra-ai/mastra/commit/8c1135dfb91b057283eae7ee11f9ec28753cc64f), [`dd39e54`](https://github.com/mastra-ai/mastra/commit/dd39e54ea34532c995b33bee6e0e808bf41a7341), [`b6fad9a`](https://github.com/mastra-ai/mastra/commit/b6fad9a602182b1cc0df47cd8c55004fa829ad61), [`4129c07`](https://github.com/mastra-ai/mastra/commit/4129c073349b5a66643fd8136ebfe9d7097cf793), [`5b930ab`](https://github.com/mastra-ai/mastra/commit/5b930aba1834d9898e8460a49d15106f31ac7c8d), [`4be93d0`](https://github.com/mastra-ai/mastra/commit/4be93d09d68e20aaf0ea3f210749422719618b5f), [`047635c`](https://github.com/mastra-ai/mastra/commit/047635ccd7861d726c62d135560c0022a5490aec), [`8c90ff4`](https://github.com/mastra-ai/mastra/commit/8c90ff4d3414e7f2a2d216ea91274644f7b29133), [`ed232d1`](https://github.com/mastra-ai/mastra/commit/ed232d1583f403925dc5ae45f7bee948cf2a182b), [`3891795`](https://github.com/mastra-ai/mastra/commit/38917953518eb4154a984ee36e6ededdcfe80f72), [`4f955b2`](https://github.com/mastra-ai/mastra/commit/4f955b20c7f66ed282ee1fd8709696fa64c4f19d), [`55a4c90`](https://github.com/mastra-ai/mastra/commit/55a4c9044ac7454349b9f6aeba0bbab5ee65d10f)]:
10
+ - @mastra/core@1.3.0
11
+
12
+ ## 1.0.1-alpha.0
13
+
14
+ ### Patch Changes
15
+
16
+ - dependencies updates: ([#12783](https://github.com/mastra-ai/mastra/pull/12783))
17
+ - Updated dependency [`@upstash/redis@^1.36.2` ↗︎](https://www.npmjs.com/package/@upstash/redis/v/1.36.2) (from `^1.36.0`, in `dependencies`)
18
+ - Updated dependencies [[`717ffab`](https://github.com/mastra-ai/mastra/commit/717ffab42cfd58ff723b5c19ada4939997773004), [`e4b6dab`](https://github.com/mastra-ai/mastra/commit/e4b6dab171c5960e340b3ea3ea6da8d64d2b8672), [`5719fa8`](https://github.com/mastra-ai/mastra/commit/5719fa8880e86e8affe698ec4b3807c7e0e0a06f), [`83cda45`](https://github.com/mastra-ai/mastra/commit/83cda4523e588558466892bff8f80f631a36945a), [`11804ad`](https://github.com/mastra-ai/mastra/commit/11804adf1d6be46ebe216be40a43b39bb8b397d7), [`aa95f95`](https://github.com/mastra-ai/mastra/commit/aa95f958b186ae5c9f4219c88e268f5565c277a2), [`f5501ae`](https://github.com/mastra-ai/mastra/commit/f5501aedb0a11106c7db7e480d6eaf3971b7bda8), [`44573af`](https://github.com/mastra-ai/mastra/commit/44573afad0a4bc86f627d6cbc0207961cdcb3bc3), [`00e3861`](https://github.com/mastra-ai/mastra/commit/00e3861863fbfee78faeb1ebbdc7c0223aae13ff), [`7bfbc52`](https://github.com/mastra-ai/mastra/commit/7bfbc52a8604feb0fff2c0a082c13c0c2a3df1a2), [`1445994`](https://github.com/mastra-ai/mastra/commit/1445994aee19c9334a6a101cf7bd80ca7ed4d186), [`61f44a2`](https://github.com/mastra-ai/mastra/commit/61f44a26861c89e364f367ff40825bdb7f19df55), [`37145d2`](https://github.com/mastra-ai/mastra/commit/37145d25f99dc31f1a9105576e5452609843ce32), [`fdad759`](https://github.com/mastra-ai/mastra/commit/fdad75939ff008b27625f5ec0ce9c6915d99d9ec), [`e4569c5`](https://github.com/mastra-ai/mastra/commit/e4569c589e00c4061a686c9eb85afe1b7050b0a8), [`7309a85`](https://github.com/mastra-ai/mastra/commit/7309a85427281a8be23f4fb80ca52e18eaffd596), [`99424f6`](https://github.com/mastra-ai/mastra/commit/99424f6862ffb679c4ec6765501486034754a4c2), [`44eb452`](https://github.com/mastra-ai/mastra/commit/44eb4529b10603c279688318bebf3048543a1d61), [`6c40593`](https://github.com/mastra-ai/mastra/commit/6c40593d6d2b1b68b0c45d1a3a4c6ac5ecac3937), [`8c1135d`](https://github.com/mastra-ai/mastra/commit/8c1135dfb91b057283eae7ee11f9ec28753cc64f), [`dd39e54`](https://github.com/mastra-ai/mastra/commit/dd39e54ea34532c995b33bee6e0e808bf41a7341), [`b6fad9a`](https://github.com/mastra-ai/mastra/commit/b6fad9a602182b1cc0df47cd8c55004fa829ad61), [`4129c07`](https://github.com/mastra-ai/mastra/commit/4129c073349b5a66643fd8136ebfe9d7097cf793), [`5b930ab`](https://github.com/mastra-ai/mastra/commit/5b930aba1834d9898e8460a49d15106f31ac7c8d), [`4be93d0`](https://github.com/mastra-ai/mastra/commit/4be93d09d68e20aaf0ea3f210749422719618b5f), [`047635c`](https://github.com/mastra-ai/mastra/commit/047635ccd7861d726c62d135560c0022a5490aec), [`8c90ff4`](https://github.com/mastra-ai/mastra/commit/8c90ff4d3414e7f2a2d216ea91274644f7b29133), [`ed232d1`](https://github.com/mastra-ai/mastra/commit/ed232d1583f403925dc5ae45f7bee948cf2a182b), [`3891795`](https://github.com/mastra-ai/mastra/commit/38917953518eb4154a984ee36e6ededdcfe80f72), [`4f955b2`](https://github.com/mastra-ai/mastra/commit/4f955b20c7f66ed282ee1fd8709696fa64c4f19d), [`55a4c90`](https://github.com/mastra-ai/mastra/commit/55a4c9044ac7454349b9f6aeba0bbab5ee65d10f)]:
19
+ - @mastra/core@1.3.0-alpha.1
20
+
3
21
  ## 1.0.0
4
22
 
5
23
  ### Major Changes
@@ -1,35 +1,29 @@
1
1
  ---
2
- name: mastra-upstash-docs
3
- description: Documentation for @mastra/upstash. Includes links to type definitions and readable implementation code in dist/.
2
+ name: mastra-upstash
3
+ description: Documentation for @mastra/upstash. Use when working with @mastra/upstash APIs, configuration, or implementation.
4
+ metadata:
5
+ package: "@mastra/upstash"
6
+ version: "1.0.1"
4
7
  ---
5
8
 
6
- # @mastra/upstash Documentation
9
+ ## When to use
7
10
 
8
- > **Version**: 1.0.0
9
- > **Package**: @mastra/upstash
11
+ Use this skill whenever you are working with @mastra/upstash to obtain the domain-specific knowledge.
10
12
 
11
- ## Quick Navigation
13
+ ## How to use
12
14
 
13
- Use SOURCE_MAP.json to find any export:
15
+ Read the individual reference documents for detailed explanations and code examples.
14
16
 
15
- ```bash
16
- cat docs/SOURCE_MAP.json
17
- ```
17
+ ### Docs
18
18
 
19
- Each export maps to:
20
- - **types**: `.d.ts` file with JSDoc and API signatures
21
- - **implementation**: `.js` chunk file with readable source
22
- - **docs**: Conceptual documentation in `docs/`
19
+ - [Working Memory](references/docs-memory-working-memory.md) - Learn how to configure working memory in Mastra to store persistent user data, preferences.
20
+ - [Retrieval, Semantic Search, Reranking](references/docs-rag-retrieval.md) - Guide on retrieval processes in Mastra's RAG systems, including semantic search, filtering, and re-ranking.
21
+ - [Storing Embeddings in A Vector Database](references/docs-rag-vector-databases.md) - Guide on vector storage options in Mastra, including embedded and dedicated vector databases for similarity search.
23
22
 
24
- ## Top Exports
23
+ ### Reference
25
24
 
25
+ - [Reference: Upstash Storage](references/reference-storage-upstash.md) - Documentation for the Upstash storage implementation in Mastra.
26
+ - [Reference: Upstash Vector Store](references/reference-vectors-upstash.md) - Documentation for the UpstashVector class in Mastra, which provides vector search using Upstash Vector.
26
27
 
27
28
 
28
- See SOURCE_MAP.json for the complete list.
29
-
30
- ## Available Topics
31
-
32
- - [Memory](memory/) - 1 file(s)
33
- - [Rag](rag/) - 2 file(s)
34
- - [Storage](storage/) - 1 file(s)
35
- - [Vectors](vectors/) - 1 file(s)
29
+ Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.0",
2
+ "version": "1.0.1",
3
3
  "package": "@mastra/upstash",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -1,8 +1,6 @@
1
- > Learn how to configure working memory in Mastra to store persistent user data, preferences.
2
-
3
1
  # Working Memory
4
2
 
5
- While [message history](https://mastra.ai/docs/v1/memory/message-history) and [semantic recall](./semantic-recall) help agents remember conversations, working memory allows them to maintain persistent information about users across interactions.
3
+ While [message history](https://mastra.ai/docs/memory/message-history) and [semantic recall](https://mastra.ai/docs/memory/semantic-recall) help agents remember conversations, working memory allows them to maintain persistent information about users across interactions.
6
4
 
7
5
  Think of it as the agent's active thoughts or scratchpad – the key information they keep available about the user or task. It's similar to how a person would naturally remember someone's name, preferences, or important details during a conversation.
8
6
 
@@ -19,7 +17,7 @@ Working memory can persist at two different scopes:
19
17
 
20
18
  Here's a minimal example of setting up an agent with working memory:
21
19
 
22
- ```typescript {11-15}
20
+ ```typescript
23
21
  import { Agent } from "@mastra/core/agent";
24
22
  import { Memory } from "@mastra/memory";
25
23
 
@@ -43,7 +41,7 @@ const agent = new Agent({
43
41
 
44
42
  Working memory is a block of Markdown text that the agent is able to update over time to store continuously relevant information:
45
43
 
46
- <YouTube id="UMy_JHLf1n8" />
44
+ [YouTube video player](https://www.youtube-nocookie.com/embed/UMy_JHLf1n8)
47
45
 
48
46
  ## Memory Persistence Scopes
49
47
 
@@ -136,7 +134,7 @@ Templates guide the agent on what information to track and update in working mem
136
134
 
137
135
  Here's an example of a custom template. In this example the agent will store the users name, location, timezone, etc as soon as the user sends a message containing any of the info:
138
136
 
139
- ```typescript {5-28}
137
+ ```typescript
140
138
  const memory = new Memory({
141
139
  options: {
142
140
  workingMemory: {
@@ -172,19 +170,13 @@ const memory = new Memory({
172
170
 
173
171
  ## Designing Effective Templates
174
172
 
175
- A well-structured template keeps the information easy for the agent to parse and update. Treat the
176
- template as a short form that you want the assistant to keep up to date.
173
+ A well-structured template keeps the information easy for the agent to parse and update. Treat the template as a short form that you want the assistant to keep up to date.
177
174
 
178
- - **Short, focused labels.** Avoid paragraphs or very long headings. Keep labels brief (for example
179
- `## Personal Info` or `- Name:`) so updates are easy to read and less likely to be truncated.
180
- - **Use consistent casing.** Inconsistent capitalization (`Timezone:` vs `timezone:`) can cause messy
181
- updates. Stick to Title Case or lower case for headings and bullet labels.
182
- - **Keep placeholder text simple.** Use hints such as `[e.g., Formal]` or `[Date]` to help the LLM
183
- fill in the correct spots.
184
- - **Abbreviate very long values.** If you only need a short form, include guidance like
185
- `- Name: [First name or nickname]` or `- Address (short):` rather than the full legal text.
186
- - **Mention update rules in `instructions`.** You can instruct how and when to fill or clear parts of
187
- the template directly in the agent's `instructions` field.
175
+ - **Short, focused labels.** Avoid paragraphs or very long headings. Keep labels brief (for example `## Personal Info` or `- Name:`) so updates are easy to read and less likely to be truncated.
176
+ - **Use consistent casing.** Inconsistent capitalization (`Timezone:` vs `timezone:`) can cause messy updates. Stick to Title Case or lower case for headings and bullet labels.
177
+ - **Keep placeholder text simple.** Use hints such as `[e.g., Formal]` or `[Date]` to help the LLM fill in the correct spots.
178
+ - **Abbreviate very long values.** If you only need a short form, include guidance like `- Name: [First name or nickname]` or `- Address (short):` rather than the full legal text.
179
+ - **Mention update rules in `instructions`.** You can instruct how and when to fill or clear parts of the template directly in the agent's `instructions` field.
188
180
 
189
181
  ### Alternative Template Styles
190
182
 
@@ -281,8 +273,7 @@ Schema-based working memory uses **merge semantics**, meaning the agent only nee
281
273
 
282
274
  ## Example: Multi-step Retention
283
275
 
284
- Below is a simplified view of how the `User Profile` template updates across a short user
285
- conversation:
276
+ Below is a simplified view of how the `User Profile` template updates across a short user conversation:
286
277
 
287
278
  ```nohighlight
288
279
  # User Profile
@@ -308,11 +299,9 @@ conversation:
308
299
  - Timezone: CET
309
300
  ```
310
301
 
311
- The agent can now refer to `Sam` or `Berlin` in later responses without requesting the information
312
- again because it has been stored in working memory.
302
+ The agent can now refer to `Sam` or `Berlin` in later responses without requesting the information again because it has been stored in working memory.
313
303
 
314
- If your agent is not properly updating working memory when you expect it to, you can add system
315
- instructions on _how_ and _when_ to use this template in your agent's `instructions` setting.
304
+ If your agent is not properly updating working memory when you expect it to, you can add system instructions on _how_ and _when_ to use this template in your agent's `instructions` setting.
316
305
 
317
306
  ## Setting Initial Working Memory
318
307
 
@@ -322,7 +311,7 @@ While agents typically update working memory through the `updateWorkingMemory` t
322
311
 
323
312
  When creating a thread, you can provide initial working memory through the metadata's `workingMemory` key:
324
313
 
325
- ```typescript title="src/app/medical-consultation.ts"
314
+ ```typescript
326
315
  // Create a thread with initial working memory
327
316
  const thread = await memory.createThread({
328
317
  threadId: "thread-123",
@@ -353,7 +342,7 @@ await agent.generate("What's my blood type?", {
353
342
 
354
343
  You can also update an existing thread's working memory:
355
344
 
356
- ```typescript title="src/app/medical-consultation.ts"
345
+ ```typescript
357
346
  // Update thread metadata to add/modify working memory
358
347
  await memory.updateThread({
359
348
  id: "thread-123",
@@ -375,7 +364,7 @@ await memory.updateThread({
375
364
 
376
365
  Alternatively, use the `updateWorkingMemory` method directly:
377
366
 
378
- ```typescript title="src/app/medical-consultation.ts"
367
+ ```typescript
379
368
  await memory.updateWorkingMemory({
380
369
  threadId: "thread-123",
381
370
  resourceId: "user-456", // Required for resource-scoped memory
@@ -383,6 +372,27 @@ await memory.updateWorkingMemory({
383
372
  });
384
373
  ```
385
374
 
375
+ ## Read-Only Working Memory
376
+
377
+ In some scenarios, you may want an agent to have access to working memory data without the ability to modify it. This is useful for:
378
+
379
+ - **Routing agents** that need context but shouldn't update user profiles
380
+ - **Sub agents** in a multi-agent system that should reference but not own the memory
381
+
382
+ To enable read-only mode, set `readOnly: true` in the memory options:
383
+
384
+ ```typescript
385
+ const response = await agent.generate("What do you know about me?", {
386
+ memory: {
387
+ thread: "conversation-123",
388
+ resource: "user-alice-456",
389
+ options: {
390
+ readOnly: true, // Working memory is provided but cannot be updated
391
+ },
392
+ },
393
+ });
394
+ ```
395
+
386
396
  ## Examples
387
397
 
388
398
  - [Working memory with template](https://github.com/mastra-ai/mastra/tree/main/examples/memory-with-template)
@@ -1,5 +1,3 @@
1
- > Guide on retrieval processes in Mastra
2
-
3
1
  # Retrieval in RAG Systems
4
2
 
5
3
  After storing embeddings, you need to retrieve relevant chunks to answer user queries.
@@ -73,7 +71,7 @@ Filter results based on metadata fields to narrow down the search space. This ap
73
71
 
74
72
  This is useful when you have documents from different sources, time periods, or with specific attributes. Mastra provides a unified MongoDB-style query syntax that works across all supported vector stores.
75
73
 
76
- For detailed information about available operators and syntax, see the [Metadata Filters Reference](https://mastra.ai/reference/v1/rag/metadata-filters).
74
+ For detailed information about available operators and syntax, see the [Metadata Filters Reference](https://mastra.ai/reference/rag/metadata-filters).
77
75
 
78
76
  Basic filtering examples:
79
77
 
@@ -168,10 +166,9 @@ This is particularly useful when:
168
166
 
169
167
  The Vector Query Tool supports database-specific configurations that enable you to leverage unique features and optimizations of different vector stores.
170
168
 
171
- > **Note:**
172
- These configurations are for **query-time options** like namespaces, performance tuning, and filtering—not for database connection setup.
173
-
174
- Connection credentials (URLs, auth tokens) are configured when you instantiate the vector store class (e.g., `new LibSQLVector({ url: '...' })`).
169
+ > **Note:** These configurations are for **query-time options** like namespaces, performance tuning, and filtering—not for database connection setup.
170
+ >
171
+ > Connection credentials (URLs, auth tokens) are configured when you instantiate the vector store class (e.g., `new LibSQLVector({ url: '...' })`).
175
172
 
176
173
  ```ts
177
174
  import { createVectorQueryTool } from "@mastra/rag";
@@ -264,14 +261,13 @@ await pineconeQueryTool.execute(
264
261
  );
265
262
  ```
266
263
 
267
- For detailed configuration options and advanced usage, see the [Vector Query Tool Reference](https://mastra.ai/reference/v1/tools/vector-query-tool).
264
+ For detailed configuration options and advanced usage, see the [Vector Query Tool Reference](https://mastra.ai/reference/tools/vector-query-tool).
268
265
 
269
266
  ### Vector Store Prompts
270
267
 
271
- Vector store prompts define query patterns and filtering capabilities for each vector database implementation.
272
- When implementing filtering, these prompts are required in the agent's instructions to specify valid operators and syntax for each vector store implementation.
268
+ Vector store prompts define query patterns and filtering capabilities for each vector database implementation. When implementing filtering, these prompts are required in the agent's instructions to specify valid operators and syntax for each vector store implementation.
273
269
 
274
- **pgvector:**
270
+ **pgVector**:
275
271
 
276
272
  ```ts
277
273
  import { PGVECTOR_PROMPT } from "@mastra/pg";
@@ -288,11 +284,9 @@ export const ragAgent = new Agent({
288
284
  });
289
285
  ```
290
286
 
291
-
292
-
293
- **pinecone:**
287
+ **Pinecone**:
294
288
 
295
- ```ts title="vector-store.ts"
289
+ ```ts
296
290
  import { PINECONE_PROMPT } from "@mastra/pinecone";
297
291
 
298
292
  export const ragAgent = new Agent({
@@ -307,11 +301,9 @@ export const ragAgent = new Agent({
307
301
  });
308
302
  ```
309
303
 
310
-
311
-
312
- **qdrant:**
304
+ **Qdrant**:
313
305
 
314
- ```ts title="vector-store.ts"
306
+ ```ts
315
307
  import { QDRANT_PROMPT } from "@mastra/qdrant";
316
308
 
317
309
  export const ragAgent = new Agent({
@@ -326,11 +318,9 @@ export const ragAgent = new Agent({
326
318
  });
327
319
  ```
328
320
 
329
-
321
+ **Chroma**:
330
322
 
331
- **chroma:**
332
-
333
- ```ts title="vector-store.ts"
323
+ ```ts
334
324
  import { CHROMA_PROMPT } from "@mastra/chroma";
335
325
 
336
326
  export const ragAgent = new Agent({
@@ -345,11 +335,9 @@ export const ragAgent = new Agent({
345
335
  });
346
336
  ```
347
337
 
348
-
349
-
350
- **astra:**
338
+ **Astra**:
351
339
 
352
- ```ts title="vector-store.ts"
340
+ ```ts
353
341
  import { ASTRA_PROMPT } from "@mastra/astra";
354
342
 
355
343
  export const ragAgent = new Agent({
@@ -364,11 +352,9 @@ export const ragAgent = new Agent({
364
352
  });
365
353
  ```
366
354
 
367
-
368
-
369
- **libsql:**
355
+ **libSQL**:
370
356
 
371
- ```ts title="vector-store.ts"
357
+ ```ts
372
358
  import { LIBSQL_PROMPT } from "@mastra/libsql";
373
359
 
374
360
  export const ragAgent = new Agent({
@@ -383,11 +369,9 @@ export const ragAgent = new Agent({
383
369
  });
384
370
  ```
385
371
 
386
-
372
+ **Upstash**:
387
373
 
388
- **upstash:**
389
-
390
- ```ts title="vector-store.ts"
374
+ ```ts
391
375
  import { UPSTASH_PROMPT } from "@mastra/upstash";
392
376
 
393
377
  export const ragAgent = new Agent({
@@ -402,11 +386,9 @@ export const ragAgent = new Agent({
402
386
  });
403
387
  ```
404
388
 
405
-
406
-
407
- **vectorize:**
389
+ **Vectorize**:
408
390
 
409
- ```ts title="vector-store.ts"
391
+ ```ts
410
392
  import { VECTORIZE_PROMPT } from "@mastra/vectorize";
411
393
 
412
394
  export const ragAgent = new Agent({
@@ -421,11 +403,9 @@ export const ragAgent = new Agent({
421
403
  });
422
404
  ```
423
405
 
424
-
425
-
426
- **mongodb:**
406
+ **MongoDB**:
427
407
 
428
- ```ts title="vector-store.ts"
408
+ ```ts
429
409
  import { MONGODB_PROMPT } from "@mastra/mongodb";
430
410
 
431
411
  export const ragAgent = new Agent({
@@ -440,11 +420,9 @@ export const ragAgent = new Agent({
440
420
  });
441
421
  ```
442
422
 
443
-
423
+ **OpenSearch**:
444
424
 
445
- **opensearch:**
446
-
447
- ```ts title="vector-store.ts"
425
+ ```ts
448
426
  import { OPENSEARCH_PROMPT } from "@mastra/opensearch";
449
427
 
450
428
  export const ragAgent = new Agent({
@@ -459,11 +437,9 @@ export const ragAgent = new Agent({
459
437
  });
460
438
  ```
461
439
 
462
-
463
-
464
- **s3vectors:**
440
+ **S3Vectors**:
465
441
 
466
- ```ts title="vector-store.ts"
442
+ ```ts
467
443
  import { S3VECTORS_PROMPT } from "@mastra/s3vectors";
468
444
 
469
445
  export const ragAgent = new Agent({
@@ -478,8 +454,6 @@ export const ragAgent = new Agent({
478
454
  });
479
455
  ```
480
456
 
481
-
482
-
483
457
  ### Re-ranking
484
458
 
485
459
  Initial vector similarity search can sometimes miss nuanced relevance. Re-ranking is a more computationally expensive process, but more accurate algorithm that improves results by:
@@ -528,8 +502,7 @@ The weights control how different factors influence the final ranking:
528
502
  - `vector`: Higher values favor the original vector similarity scores
529
503
  - `position`: Higher values help maintain the original ordering of results
530
504
 
531
- > **Note:**
532
- For semantic scoring to work properly during re-ranking, each result must include the text content in its `metadata.text` field.
505
+ > **Note:** For semantic scoring to work properly during re-ranking, each result must include the text content in its `metadata.text` field.
533
506
 
534
507
  You can also use other relevance score providers like Cohere or ZeroEntropy:
535
508
 
@@ -543,6 +516,6 @@ const relevanceProvider = new ZeroEntropyRelevanceScorer("zerank-1");
543
516
 
544
517
  The re-ranked results combine vector similarity with semantic understanding to improve retrieval quality.
545
518
 
546
- For more details about re-ranking, see the [rerank()](https://mastra.ai/reference/v1/rag/rerankWithScorer) method.
519
+ For more details about re-ranking, see the [rerank()](https://mastra.ai/reference/rag/rerankWithScorer) method.
547
520
 
548
- For graph-based retrieval that follows connections between chunks, see the [GraphRAG](https://mastra.ai/docs/v1/rag/graph-rag) documentation.
521
+ For graph-based retrieval that follows connections between chunks, see the [GraphRAG](https://mastra.ai/docs/rag/graph-rag) documentation.