@mastra/mcp-docs-server 0.0.3 → 0.0.4-alpha.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/.docs/organized/changelogs/%40mastra%2Fastra.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +29 -29
- package/.docs/organized/changelogs/%40mastra%2Fcomposio.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +23 -23
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +36 -36
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +35 -35
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +35 -35
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +32 -32
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +29 -29
- package/.docs/organized/changelogs/%40mastra%2Fgithub.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +26 -0
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fpinecone.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +35 -35
- package/.docs/organized/changelogs/%40mastra%2Fqdrant.md +27 -27
- package/.docs/organized/changelogs/%40mastra%2Frag.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fragie.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fspeech-azure.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fspeech-deepgram.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fspeech-elevenlabs.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fspeech-google.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fspeech-ibm.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fspeech-murf.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fspeech-openai.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fspeech-playai.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fspeech-replicate.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fspeech-speechify.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fstabilityai.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fturbopuffer.md +25 -0
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +31 -31
- package/.docs/organized/changelogs/%40mastra%2Fvectorize.md +30 -30
- package/.docs/organized/changelogs/%40mastra%2Fvoice-azure.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +25 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +26 -26
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +27 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +26 -26
- package/.docs/organized/changelogs/create-mastra.md +22 -22
- package/.docs/organized/changelogs/mastra.md +47 -47
- package/.docs/organized/code-examples/ai-sdk-useChat.md +2 -1
- package/.docs/raw/agents/02-adding-tools.mdx +6 -0
- package/.docs/raw/agents/02a-mcp-guide.mdx +192 -0
- package/.docs/raw/agents/03-adding-voice.mdx +8 -8
- package/.docs/raw/deployment/deployment.mdx +5 -42
- package/.docs/raw/deployment/server.mdx +45 -3
- package/.docs/raw/evals/00-overview.mdx +2 -2
- package/.docs/raw/evals/03-running-in-ci.mdx +7 -4
- package/.docs/raw/getting-started/mcp-docs-server.mdx +5 -2
- package/.docs/raw/guides/04-research-assistant.mdx +273 -0
- package/.docs/raw/local-dev/mastra-dev.mdx +2 -2
- package/.docs/raw/observability/logging.mdx +38 -0
- package/.docs/raw/observability/nextjs-tracing.mdx +102 -0
- package/.docs/raw/observability/tracing.mdx +110 -0
- package/.docs/raw/rag/overview.mdx +3 -3
- package/.docs/raw/rag/retrieval.mdx +7 -4
- package/.docs/raw/rag/vector-databases.mdx +107 -40
- package/.docs/raw/reference/client-js/memory.mdx +6 -3
- package/.docs/raw/reference/client-js/workflows.mdx +1 -0
- package/.docs/raw/reference/observability/providers/langsmith.mdx +2 -0
- package/.docs/raw/reference/rag/libsql.mdx +3 -3
- package/.docs/raw/reference/rag/upstash.mdx +50 -1
- package/.docs/raw/reference/rag/vectorize.mdx +48 -3
- package/.docs/raw/reference/tools/client.mdx +10 -2
- package/.docs/raw/reference/tools/vector-query-tool.mdx +1 -1
- package/.docs/raw/reference/voice/sarvam.mdx +260 -0
- package/.docs/raw/reference/workflows/afterEvent.mdx +76 -0
- package/.docs/raw/reference/workflows/events.mdx +305 -0
- package/.docs/raw/reference/workflows/resumeWithEvent.mdx +134 -0
- package/.docs/raw/reference/workflows/snapshots.mdx +204 -0
- package/.docs/raw/reference/workflows/step-retries.mdx +203 -0
- package/.docs/raw/voice/overview.mdx +135 -0
- package/.docs/raw/voice/speech-to-text.mdx +45 -0
- package/.docs/raw/voice/text-to-speech.mdx +52 -0
- package/.docs/raw/voice/voice-to-voice.mdx +310 -0
- package/.docs/raw/workflows/dynamic-workflows.mdx +4 -0
- package/.docs/raw/workflows/error-handling.mdx +183 -0
- package/.docs/raw/workflows/steps.mdx +12 -2
- package/.docs/raw/workflows/suspend-and-resume.mdx +207 -2
- package/.docs/raw/workflows/variables.mdx +23 -3
- package/dist/_tsup-dts-rollup.d.ts +83 -0
- package/dist/chunk-YEOOTUPA.js +191 -0
- package/dist/prepare-docs/prepare.d.ts +1 -1
- package/dist/prepare-docs/prepare.js +1 -13
- package/dist/stdio.d.ts +0 -1
- package/dist/stdio.js +352 -5
- package/package.json +9 -15
- package/.docs/raw/deployment/logging-and-tracing.mdx +0 -242
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -19
- package/dist/prepare-docs/code-examples.d.ts +0 -4
- package/dist/prepare-docs/code-examples.js +0 -91
- package/dist/prepare-docs/copy-raw.d.ts +0 -1
- package/dist/prepare-docs/copy-raw.js +0 -41
- package/dist/prepare-docs/index.d.ts +0 -1
- package/dist/prepare-docs/index.js +0 -8
- package/dist/prepare-docs/package-changes.d.ts +0 -4
- package/dist/prepare-docs/package-changes.js +0 -92
- package/dist/sse.d.ts +0 -1
- package/dist/sse.js +0 -9
- package/dist/tools/__tests__/blog.test.d.ts +0 -1
- package/dist/tools/__tests__/blog.test.js +0 -48
- package/dist/tools/__tests__/changes.test.d.ts +0 -1
- package/dist/tools/__tests__/changes.test.js +0 -37
- package/dist/tools/__tests__/docs.test.d.ts +0 -1
- package/dist/tools/__tests__/docs.test.js +0 -46
- package/dist/tools/__tests__/examples.test.d.ts +0 -1
- package/dist/tools/__tests__/examples.test.js +0 -53
- package/dist/tools/blog.d.ts +0 -15
- package/dist/tools/blog.js +0 -73
- package/dist/tools/changes.d.ts +0 -11
- package/dist/tools/changes.js +0 -69
- package/dist/tools/docs.d.ts +0 -11
- package/dist/tools/docs.js +0 -176
- package/dist/tools/examples.d.ts +0 -11
- package/dist/tools/examples.js +0 -61
- package/dist/utils.d.ts +0 -6
- package/dist/utils.js +0 -9
|
@@ -9,11 +9,7 @@ import { Tabs } from "nextra/components";
|
|
|
9
9
|
|
|
10
10
|
After generating embeddings, you need to store them in a database that supports vector similarity search. Mastra provides a consistent interface for storing and querying embeddings across different vector databases.
|
|
11
11
|
|
|
12
|
-
## Supported
|
|
13
|
-
|
|
14
|
-
### PostgreSQL with PgVector
|
|
15
|
-
|
|
16
|
-
Best for teams already using PostgreSQL who want to minimize infrastructure complexity:
|
|
12
|
+
## Supported Databases
|
|
17
13
|
|
|
18
14
|
<Tabs items={['Pg Vector', 'Pinecone', 'Qdrant', 'Chroma', 'Astra', 'LibSQL', 'Upstash', 'Cloudflare']}>
|
|
19
15
|
<Tabs.Tab>
|
|
@@ -22,17 +18,21 @@ Best for teams already using PostgreSQL who want to minimize infrastructure comp
|
|
|
22
18
|
|
|
23
19
|
const store = new PgVector(process.env.POSTGRES_CONNECTION_STRING)
|
|
24
20
|
await store.createIndex({
|
|
25
|
-
indexName: "
|
|
21
|
+
indexName: "myCollection",
|
|
26
22
|
dimension: 1536,
|
|
27
23
|
});
|
|
28
24
|
await store.upsert({
|
|
29
|
-
indexName: "
|
|
25
|
+
indexName: "myCollection",
|
|
30
26
|
vectors: embeddings,
|
|
31
27
|
metadata: chunks.map(chunk => ({ text: chunk.text })),
|
|
32
28
|
});
|
|
33
29
|
|
|
34
30
|
```
|
|
35
31
|
|
|
32
|
+
### Using PostgreSQL with pgvector
|
|
33
|
+
|
|
34
|
+
PostgreSQL with the pgvector extension is a good solution for teams already using PostgreSQL who want to minimize infrastructure complexity.
|
|
35
|
+
For detailed setup instructions and best practices, see the [official pgvector repository](https://github.com/pgvector/pgvector).
|
|
36
36
|
</Tabs.Tab>
|
|
37
37
|
<Tabs.Tab>
|
|
38
38
|
```ts filename="vector-store.ts" showLineNumbers copy
|
|
@@ -40,11 +40,11 @@ Best for teams already using PostgreSQL who want to minimize infrastructure comp
|
|
|
40
40
|
|
|
41
41
|
const store = new PineconeVector(process.env.PINECONE_API_KEY)
|
|
42
42
|
await store.createIndex({
|
|
43
|
-
indexName: "
|
|
43
|
+
indexName: "myCollection",
|
|
44
44
|
dimension: 1536,
|
|
45
45
|
});
|
|
46
46
|
await store.upsert({
|
|
47
|
-
indexName: "
|
|
47
|
+
indexName: "myCollection",
|
|
48
48
|
vectors: embeddings,
|
|
49
49
|
metadata: chunks.map(chunk => ({ text: chunk.text })),
|
|
50
50
|
});
|
|
@@ -59,11 +59,11 @@ Best for teams already using PostgreSQL who want to minimize infrastructure comp
|
|
|
59
59
|
apiKey: process.env.QDRANT_API_KEY
|
|
60
60
|
})
|
|
61
61
|
await store.createIndex({
|
|
62
|
-
indexName: "
|
|
62
|
+
indexName: "myCollection",
|
|
63
63
|
dimension: 1536,
|
|
64
64
|
});
|
|
65
65
|
await store.upsert({
|
|
66
|
-
indexName: "
|
|
66
|
+
indexName: "myCollection",
|
|
67
67
|
vectors: embeddings,
|
|
68
68
|
metadata: chunks.map(chunk => ({ text: chunk.text })),
|
|
69
69
|
});
|
|
@@ -75,11 +75,11 @@ Best for teams already using PostgreSQL who want to minimize infrastructure comp
|
|
|
75
75
|
|
|
76
76
|
const store = new ChromaVector()
|
|
77
77
|
await store.createIndex({
|
|
78
|
-
indexName: "
|
|
78
|
+
indexName: "myCollection",
|
|
79
79
|
dimension: 1536,
|
|
80
80
|
});
|
|
81
81
|
await store.upsert({
|
|
82
|
-
indexName: "
|
|
82
|
+
indexName: "myCollection",
|
|
83
83
|
vectors: embeddings,
|
|
84
84
|
metadata: chunks.map(chunk => ({ text: chunk.text })),
|
|
85
85
|
});
|
|
@@ -95,11 +95,11 @@ Best for teams already using PostgreSQL who want to minimize infrastructure comp
|
|
|
95
95
|
keyspace: process.env.ASTRA_DB_KEYSPACE
|
|
96
96
|
})
|
|
97
97
|
await store.createIndex({
|
|
98
|
-
indexName: "
|
|
98
|
+
indexName: "myCollection",
|
|
99
99
|
dimension: 1536,
|
|
100
100
|
});
|
|
101
101
|
await store.upsert({
|
|
102
|
-
indexName: "
|
|
102
|
+
indexName: "myCollection",
|
|
103
103
|
vectors: embeddings,
|
|
104
104
|
metadata: chunks.map(chunk => ({ text: chunk.text })),
|
|
105
105
|
});
|
|
@@ -114,11 +114,11 @@ import { LibSQLVector } from "@mastra/core/vector/libsql";
|
|
|
114
114
|
authToken: process.env.DATABASE_AUTH_TOKEN // Optional: for Turso cloud databases
|
|
115
115
|
})
|
|
116
116
|
await store.createIndex({
|
|
117
|
-
indexName: "
|
|
117
|
+
indexName: "myCollection",
|
|
118
118
|
dimension: 1536,
|
|
119
119
|
});
|
|
120
120
|
await store.upsert({
|
|
121
|
-
indexName: "
|
|
121
|
+
indexName: "myCollection",
|
|
122
122
|
vectors: embeddings,
|
|
123
123
|
metadata: chunks.map(chunk => ({ text: chunk.text })),
|
|
124
124
|
});
|
|
@@ -133,11 +133,11 @@ import { LibSQLVector } from "@mastra/core/vector/libsql";
|
|
|
133
133
|
token: process.env.UPSTASH_TOKEN
|
|
134
134
|
})
|
|
135
135
|
await store.createIndex({
|
|
136
|
-
indexName: "
|
|
136
|
+
indexName: "myCollection",
|
|
137
137
|
dimension: 1536,
|
|
138
138
|
});
|
|
139
139
|
await store.upsert({
|
|
140
|
-
indexName: "
|
|
140
|
+
indexName: "myCollection",
|
|
141
141
|
vectors: embeddings,
|
|
142
142
|
metadata: chunks.map(chunk => ({ text: chunk.text })),
|
|
143
143
|
});
|
|
@@ -152,11 +152,11 @@ import { LibSQLVector } from "@mastra/core/vector/libsql";
|
|
|
152
152
|
apiToken: process.env.CF_API_TOKEN
|
|
153
153
|
})
|
|
154
154
|
await store.createIndex({
|
|
155
|
-
indexName: "
|
|
155
|
+
indexName: "myCollection",
|
|
156
156
|
dimension: 1536,
|
|
157
157
|
});
|
|
158
158
|
await store.upsert({
|
|
159
|
-
indexName: "
|
|
159
|
+
indexName: "myCollection",
|
|
160
160
|
vectors: embeddings,
|
|
161
161
|
metadata: chunks.map(chunk => ({ text: chunk.text })),
|
|
162
162
|
});
|
|
@@ -175,7 +175,7 @@ Before storing embeddings, you need to create an index with the appropriate dime
|
|
|
175
175
|
```ts filename="store-embeddings.ts" showLineNumbers copy
|
|
176
176
|
// Create an index with dimension 1536 (for text-embedding-3-small)
|
|
177
177
|
await store.createIndex({
|
|
178
|
-
indexName: '
|
|
178
|
+
indexName: 'myCollection',
|
|
179
179
|
dimension: 1536,
|
|
180
180
|
});
|
|
181
181
|
|
|
@@ -190,6 +190,84 @@ The dimension size must match the output dimension of your chosen embedding mode
|
|
|
190
190
|
- OpenAI text-embedding-3-large: 3072 dimensions
|
|
191
191
|
- Cohere embed-multilingual-v3: 1024 dimensions
|
|
192
192
|
|
|
193
|
+
### Naming Rules for Databases
|
|
194
|
+
|
|
195
|
+
Each vector database enforces specific naming conventions for indexes and collections to ensure compatibility and prevent conflicts.
|
|
196
|
+
|
|
197
|
+
<Tabs items={['Pg Vector', 'Pinecone', 'Qdrant', 'Chroma', 'Astra', 'LibSQL', 'Upstash', 'Cloudflare']}>
|
|
198
|
+
<Tabs.Tab>
|
|
199
|
+
Index names must:
|
|
200
|
+
- Start with a letter or underscore
|
|
201
|
+
- Contain only letters, numbers, and underscores
|
|
202
|
+
- Example: `my_index_123` is valid
|
|
203
|
+
- Example: `my-index` is not valid (contains hyphen)
|
|
204
|
+
</Tabs.Tab>
|
|
205
|
+
<Tabs.Tab>
|
|
206
|
+
Index names must:
|
|
207
|
+
- Use only lowercase letters, numbers, and dashes
|
|
208
|
+
- Not contain dots (used for DNS routing)
|
|
209
|
+
- Not use non-Latin characters or emojis
|
|
210
|
+
- Have a combined length (with project ID) under 52 characters
|
|
211
|
+
- Example: `my-index-123` is valid
|
|
212
|
+
- Example: `my.index` is not valid (contains dot)
|
|
213
|
+
</Tabs.Tab>
|
|
214
|
+
<Tabs.Tab>
|
|
215
|
+
Collection names must:
|
|
216
|
+
- Be 1-255 characters long
|
|
217
|
+
- Not contain any of these special characters:
|
|
218
|
+
- `< > : " / \ | ? *`
|
|
219
|
+
- Null character (`\0`)
|
|
220
|
+
- Unit separator (`\u{1F}`)
|
|
221
|
+
- Example: `my_collection_123` is valid
|
|
222
|
+
- Example: `my/collection` is not valid (contains slash)
|
|
223
|
+
</Tabs.Tab>
|
|
224
|
+
<Tabs.Tab>
|
|
225
|
+
Collection names must:
|
|
226
|
+
- Be 3-63 characters long
|
|
227
|
+
- Start and end with a letter or number
|
|
228
|
+
- Contain only letters, numbers, underscores, or hyphens
|
|
229
|
+
- Not contain consecutive periods (..)
|
|
230
|
+
- Not be a valid IPv4 address
|
|
231
|
+
- Example: `my-collection-123` is valid
|
|
232
|
+
- Example: `my..collection` is not valid (consecutive periods)
|
|
233
|
+
</Tabs.Tab>
|
|
234
|
+
<Tabs.Tab>
|
|
235
|
+
Collection names must:
|
|
236
|
+
- Not be empty
|
|
237
|
+
- Be 48 characters or less
|
|
238
|
+
- Contain only letters, numbers, and underscores
|
|
239
|
+
- Example: `my_collection_123` is valid
|
|
240
|
+
- Example: `my-collection` is not valid (contains hyphen)
|
|
241
|
+
</Tabs.Tab>
|
|
242
|
+
<Tabs.Tab>
|
|
243
|
+
Index names must:
|
|
244
|
+
- Start with a letter or underscore
|
|
245
|
+
- Contain only letters, numbers, and underscores
|
|
246
|
+
- Example: `my_index_123` is valid
|
|
247
|
+
- Example: `my-index` is not valid (contains hyphen)
|
|
248
|
+
</Tabs.Tab>
|
|
249
|
+
<Tabs.Tab>
|
|
250
|
+
Namespace names must:
|
|
251
|
+
- Be 2-100 characters long
|
|
252
|
+
- Contain only:
|
|
253
|
+
- Alphanumeric characters (a-z, A-Z, 0-9)
|
|
254
|
+
- Underscores, hyphens, dots
|
|
255
|
+
- Not start or end with special characters (_, -, .)
|
|
256
|
+
- Can be case-sensitive
|
|
257
|
+
- Example: `MyNamespace123` is valid
|
|
258
|
+
- Example: `_namespace` is not valid (starts with underscore)
|
|
259
|
+
</Tabs.Tab>
|
|
260
|
+
<Tabs.Tab>
|
|
261
|
+
Index names must:
|
|
262
|
+
- Start with a letter
|
|
263
|
+
- Be shorter than 32 characters
|
|
264
|
+
- Contain only lowercase ASCII letters, numbers, and dashes
|
|
265
|
+
- Use dashes instead of spaces
|
|
266
|
+
- Example: `my-index-123` is valid
|
|
267
|
+
- Example: `My_Index` is not valid (uppercase and underscore)
|
|
268
|
+
</Tabs.Tab>
|
|
269
|
+
</Tabs>
|
|
270
|
+
|
|
193
271
|
### Upserting Embeddings
|
|
194
272
|
|
|
195
273
|
After creating an index, you can store embeddings along with their basic metadata:
|
|
@@ -197,7 +275,7 @@ After creating an index, you can store embeddings along with their basic metadat
|
|
|
197
275
|
```ts filename="store-embeddings.ts" showLineNumbers copy
|
|
198
276
|
// Store embeddings with their corresponding metadata
|
|
199
277
|
await store.upsert({
|
|
200
|
-
indexName: '
|
|
278
|
+
indexName: 'myCollection', // index name
|
|
201
279
|
vectors: embeddings, // array of embedding vectors
|
|
202
280
|
metadata: chunks.map(chunk => ({
|
|
203
281
|
text: chunk.text, // The original text content
|
|
@@ -212,16 +290,18 @@ The upsert operation:
|
|
|
212
290
|
- Creates new vectors if they don't exist
|
|
213
291
|
- Automatically handles batching for large datasets
|
|
214
292
|
|
|
293
|
+
For complete examples of upserting embeddings in different vector stores, see the [Upsert Embeddings](../../examples/rag/upsert/upsert-embeddings.mdx) guide.
|
|
294
|
+
|
|
215
295
|
## Adding Metadata
|
|
216
296
|
|
|
217
|
-
Vector stores support rich metadata for
|
|
297
|
+
Vector stores support rich metadata (any JSON-serializable fields) for filtering and organization. Since metadata is stored with no fixed schema, use consistent field naming to avoid unexpected query results.
|
|
218
298
|
|
|
219
|
-
**
|
|
299
|
+
**Important**: Metadata is crucial for vector storage - without it, you'd only have numerical embeddings with no way to return the original text or filter results. Always store at least the source text as metadata.
|
|
220
300
|
|
|
221
301
|
```ts showLineNumbers copy
|
|
222
302
|
// Store embeddings with rich metadata for better organization and filtering
|
|
223
|
-
await
|
|
224
|
-
indexName: "
|
|
303
|
+
await store.upsert({
|
|
304
|
+
indexName: "myCollection",
|
|
225
305
|
vectors: embeddings,
|
|
226
306
|
metadata: chunks.map((chunk) => ({
|
|
227
307
|
// Basic content
|
|
@@ -256,16 +336,3 @@ Key metadata considerations:
|
|
|
256
336
|
- Only store metadata you'll query against
|
|
257
337
|
- Match embedding dimensions to your model (e.g., 1536 for `text-embedding-3-small`)
|
|
258
338
|
|
|
259
|
-
## Examples
|
|
260
|
-
|
|
261
|
-
For complete examples of different vector store implementations, see:
|
|
262
|
-
|
|
263
|
-
- [Insert Embedding in PgVector](../../examples/rag/insert-embedding-in-pgvector.mdx)
|
|
264
|
-
- [Insert Embedding in Pinecone](../../examples/rag/insert-embedding-in-pinecone.mdx)
|
|
265
|
-
- [Insert Embedding in Qdrant](../../examples/rag/insert-embedding-in-qdrant.mdx)
|
|
266
|
-
- [Insert Embedding in Chroma](../../examples/rag/insert-embedding-in-chroma.mdx)
|
|
267
|
-
- [Insert Embedding in Astra DB](../../examples/rag/insert-embedding-in-astra.mdx)
|
|
268
|
-
- [Insert Embedding in LibSQL](../../examples/rag/insert-embedding-in-libsql.mdx)
|
|
269
|
-
- [Insert Embedding in Upstash](../../examples/rag/insert-embedding-in-upstash.mdx)
|
|
270
|
-
- [Insert Embedding in Cloudflare Vectorize](../../examples/rag/insert-embedding-in-vectorize.mdx)
|
|
271
|
-
- [Basic RAG with Vector Storage](../../examples/rag/basic-rag.mdx)
|
|
@@ -10,7 +10,8 @@ Retrieve all memory threads for a specific resource:
|
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
12
|
const threads = await client.getMemoryThreads({
|
|
13
|
-
|
|
13
|
+
resourceId: "resource-1",
|
|
14
|
+
agentId: "agent-1"
|
|
14
15
|
});
|
|
15
16
|
```
|
|
16
17
|
|
|
@@ -23,6 +24,7 @@ const thread = await client.createMemoryThread({
|
|
|
23
24
|
title: "New Conversation",
|
|
24
25
|
metadata: { category: "support" },
|
|
25
26
|
resourceid: "resource-1",
|
|
27
|
+
agentId: "agent-1"
|
|
26
28
|
});
|
|
27
29
|
```
|
|
28
30
|
|
|
@@ -31,7 +33,7 @@ const thread = await client.createMemoryThread({
|
|
|
31
33
|
Get an instance of a specific memory thread:
|
|
32
34
|
|
|
33
35
|
```typescript
|
|
34
|
-
const thread = client.getMemoryThread("thread-id");
|
|
36
|
+
const thread = client.getMemoryThread("thread-id", "agent-id");
|
|
35
37
|
```
|
|
36
38
|
|
|
37
39
|
## Thread Methods
|
|
@@ -82,6 +84,7 @@ const savedMessages = await client.saveMessageToMemory({
|
|
|
82
84
|
type: "text",
|
|
83
85
|
},
|
|
84
86
|
],
|
|
87
|
+
agentId: "agent-1"
|
|
85
88
|
});
|
|
86
89
|
```
|
|
87
90
|
|
|
@@ -90,5 +93,5 @@ const savedMessages = await client.saveMessageToMemory({
|
|
|
90
93
|
Check the status of the memory system:
|
|
91
94
|
|
|
92
95
|
```typescript
|
|
93
|
-
const status = await client.getMemoryStatus();
|
|
96
|
+
const status = await client.getMemoryStatus("agent-id");
|
|
94
97
|
```
|
|
@@ -44,3 +44,5 @@ export const mastra = new Mastra({
|
|
|
44
44
|
## Dashboard
|
|
45
45
|
|
|
46
46
|
Access your traces and analytics in the LangSmith dashboard at [smith.langchain.com](https://smith.langchain.com)
|
|
47
|
+
|
|
48
|
+
> **Note**: Even if you run your workflows, you may not see data appearing in a new project. You will need to sort by Name column to see all projects, select your project, then filter by LLM Calls instead of Root Runs.
|
|
@@ -30,7 +30,7 @@ const store = new LibSQLVector({
|
|
|
30
30
|
|
|
31
31
|
// Create an index
|
|
32
32
|
await store.createIndex({
|
|
33
|
-
indexName: "
|
|
33
|
+
indexName: "myCollection",
|
|
34
34
|
dimension: 1536,
|
|
35
35
|
});
|
|
36
36
|
|
|
@@ -41,7 +41,7 @@ const metadata = [
|
|
|
41
41
|
{ text: "second document", category: "B" }
|
|
42
42
|
];
|
|
43
43
|
await store.upsert({
|
|
44
|
-
indexName: "
|
|
44
|
+
indexName: "myCollection",
|
|
45
45
|
vectors,
|
|
46
46
|
metadata,
|
|
47
47
|
});
|
|
@@ -49,7 +49,7 @@ await store.upsert({
|
|
|
49
49
|
// Query similar vectors
|
|
50
50
|
const queryVector = [0.1, 0.2, ...];
|
|
51
51
|
const results = await store.query({
|
|
52
|
-
indexName: "
|
|
52
|
+
indexName: "myCollection",
|
|
53
53
|
queryVector,
|
|
54
54
|
topK: 10, // top K results
|
|
55
55
|
filter: { category: "A" } // optional metadata filter
|
|
@@ -156,6 +156,54 @@ interface IndexStats {
|
|
|
156
156
|
]}
|
|
157
157
|
/>
|
|
158
158
|
|
|
159
|
+
### updateIndexById()
|
|
160
|
+
|
|
161
|
+
<PropertiesTable
|
|
162
|
+
content={[
|
|
163
|
+
{
|
|
164
|
+
name: "indexName",
|
|
165
|
+
type: "string",
|
|
166
|
+
description: "Name of the index to update",
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: "id",
|
|
170
|
+
type: "string",
|
|
171
|
+
description: "ID of the item to update",
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: "update",
|
|
175
|
+
type: "object",
|
|
176
|
+
description: "Update object containing vector and/or metadata",
|
|
177
|
+
},
|
|
178
|
+
]}
|
|
179
|
+
/>
|
|
180
|
+
|
|
181
|
+
The `update` object can have the following properties:
|
|
182
|
+
|
|
183
|
+
- `vector` (optional): An array of numbers representing the new vector.
|
|
184
|
+
- `metadata` (optional): A record of key-value pairs for metadata.
|
|
185
|
+
|
|
186
|
+
Throws an error if neither `vector` nor `metadata` is provided, or if only `metadata` is provided.
|
|
187
|
+
|
|
188
|
+
### deleteIndexById()
|
|
189
|
+
|
|
190
|
+
<PropertiesTable
|
|
191
|
+
content={[
|
|
192
|
+
{
|
|
193
|
+
name: "indexName",
|
|
194
|
+
type: "string",
|
|
195
|
+
description: "Name of the index from which to delete the item",
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: "id",
|
|
199
|
+
type: "string",
|
|
200
|
+
description: "ID of the item to delete",
|
|
201
|
+
},
|
|
202
|
+
]}
|
|
203
|
+
/>
|
|
204
|
+
|
|
205
|
+
Attempts to delete an item by its ID from the specified index. Logs an error message if the deletion fails.
|
|
206
|
+
|
|
159
207
|
## Response Types
|
|
160
208
|
|
|
161
209
|
Query results are returned in this format:
|
|
@@ -195,4 +243,5 @@ Required environment variables:
|
|
|
195
243
|
- `UPSTASH_VECTOR_TOKEN`: Your Upstash Vector API token
|
|
196
244
|
|
|
197
245
|
### Related
|
|
198
|
-
|
|
246
|
+
|
|
247
|
+
- [Metadata Filters](./metadata-filters)
|
|
@@ -45,7 +45,8 @@ The CloudflareVector class provides vector search using [Cloudflare Vectorize](h
|
|
|
45
45
|
type: "'cosine' | 'euclidean' | 'dotproduct'",
|
|
46
46
|
isOptional: true,
|
|
47
47
|
defaultValue: "cosine",
|
|
48
|
-
description:
|
|
48
|
+
description:
|
|
49
|
+
"Distance metric for similarity search (dotproduct maps to dot-product)",
|
|
49
50
|
},
|
|
50
51
|
]}
|
|
51
52
|
/>
|
|
@@ -162,7 +163,7 @@ Creates an index on a metadata field to enable filtering.
|
|
|
162
163
|
content={[
|
|
163
164
|
{
|
|
164
165
|
name: "indexName",
|
|
165
|
-
type: "string",
|
|
166
|
+
type: "string",
|
|
166
167
|
description: "Name of the index containing the metadata field",
|
|
167
168
|
},
|
|
168
169
|
{
|
|
@@ -211,6 +212,49 @@ Lists all metadata field indexes for an index.
|
|
|
211
212
|
]}
|
|
212
213
|
/>
|
|
213
214
|
|
|
215
|
+
### updateIndexById()
|
|
216
|
+
|
|
217
|
+
Updates a vector or metadata for a specific ID within an index.
|
|
218
|
+
|
|
219
|
+
<PropertiesTable
|
|
220
|
+
content={[
|
|
221
|
+
{
|
|
222
|
+
name: "indexName",
|
|
223
|
+
type: "string",
|
|
224
|
+
description: "Name of the index containing the ID to update",
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
name: "id",
|
|
228
|
+
type: "string",
|
|
229
|
+
description: "Unique identifier of the vector or metadata to update",
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
name: "update",
|
|
233
|
+
type: "{ vector?: number[]; metadata?: Record<string, any>; }",
|
|
234
|
+
description: "Object containing the vector and/or metadata to update",
|
|
235
|
+
},
|
|
236
|
+
]}
|
|
237
|
+
/>
|
|
238
|
+
|
|
239
|
+
### deleteIndexById()
|
|
240
|
+
|
|
241
|
+
Deletes a vector and its associated metadata for a specific ID within an index.
|
|
242
|
+
|
|
243
|
+
<PropertiesTable
|
|
244
|
+
content={[
|
|
245
|
+
{
|
|
246
|
+
name: "indexName",
|
|
247
|
+
type: "string",
|
|
248
|
+
description: "Name of the index containing the ID to delete",
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
name: "id",
|
|
252
|
+
type: "string",
|
|
253
|
+
description: "Unique identifier of the vector and metadata to delete",
|
|
254
|
+
},
|
|
255
|
+
]}
|
|
256
|
+
/>
|
|
257
|
+
|
|
214
258
|
## Response Types
|
|
215
259
|
|
|
216
260
|
Query results are returned in this format:
|
|
@@ -250,4 +294,5 @@ Required environment variables:
|
|
|
250
294
|
- `CLOUDFLARE_API_TOKEN`: Your Cloudflare API token with Vectorize permissions
|
|
251
295
|
|
|
252
296
|
### Related
|
|
253
|
-
|
|
297
|
+
|
|
298
|
+
- [Metadata Filters](./metadata-filters)
|
|
@@ -17,11 +17,13 @@ constructor({
|
|
|
17
17
|
version = '1.0.0',
|
|
18
18
|
server,
|
|
19
19
|
capabilities = {},
|
|
20
|
+
timeout = 60000,
|
|
20
21
|
}: {
|
|
21
22
|
name: string;
|
|
22
23
|
server: StdioServerParameters | SSEClientParameters;
|
|
23
24
|
capabilities?: ClientCapabilities;
|
|
24
25
|
version?: string;
|
|
26
|
+
timeout?: number;
|
|
25
27
|
})
|
|
26
28
|
```
|
|
27
29
|
|
|
@@ -54,6 +56,13 @@ constructor({
|
|
|
54
56
|
defaultValue: "{}",
|
|
55
57
|
description: "Optional capabilities configuration for the client.",
|
|
56
58
|
},
|
|
59
|
+
{
|
|
60
|
+
name: "timeout",
|
|
61
|
+
type: "number",
|
|
62
|
+
isOptional: true,
|
|
63
|
+
defaultValue: 60000,
|
|
64
|
+
description: "The timeout duration, in milliseconds, for client tool calls.",
|
|
65
|
+
},
|
|
57
66
|
]}
|
|
58
67
|
/>
|
|
59
68
|
|
|
@@ -175,6 +184,5 @@ const sseClient = new MastraMCPClient({
|
|
|
175
184
|
|
|
176
185
|
## Related Information
|
|
177
186
|
|
|
178
|
-
- For managing multiple MCP servers in your application, see the [MCPConfiguration documentation](./configuration)
|
|
187
|
+
- For managing multiple MCP servers in your application, see the [MCPConfiguration documentation](./mcp-configuration)
|
|
179
188
|
- For more details about the Model Context Protocol, see the [@modelcontextprotocol/sdk documentation](https://github.com/modelcontextprotocol/typescript-sdk).
|
|
180
|
-
|
|
@@ -155,7 +155,7 @@ This agent-driven approach:
|
|
|
155
155
|
|
|
156
156
|
For detailed filter syntax and store-specific capabilities, see the [Metadata Filters](../rag/metadata-filters) documentation.
|
|
157
157
|
|
|
158
|
-
For an example of how agent-driven filtering works, see the [Agent-Driven Metadata Filtering](../../../examples/rag/filter-rag) example.
|
|
158
|
+
For an example of how agent-driven filtering works, see the [Agent-Driven Metadata Filtering](../../../examples/rag/usage/filter-rag) example.
|
|
159
159
|
|
|
160
160
|
## Example with Reranking
|
|
161
161
|
|