@mastra/vectorize 1.1.0 → 1.1.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/CHANGELOG.md +9 -0
- package/dist/docs/SKILL.md +3 -6
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/{docs-rag-retrieval.md → reference-rag-retrieval.md} +38 -19
- package/dist/docs/references/{docs-rag-vector-databases.md → reference-rag-vector-databases.md} +70 -5
- package/dist/docs/references/reference-vectors-vectorize.md +14 -2
- package/dist/index.cjs +427 -407
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +401 -399
- package/dist/index.js.map +1 -1
- package/dist/vector/index.d.ts +9 -0
- package/dist/vector/index.d.ts.map +1 -1
- package/package.json +15 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @mastra/vectorize
|
|
2
2
|
|
|
3
|
+
## 1.1.1-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed Cloudflare Vectorize updates inserting a duplicate vector under a random ID instead of replacing the requested one, and added support for deleting multiple vectors by ID. Deleting by metadata filter remains unsupported. (#21582) ([#21694](https://github.com/mastra-ai/mastra/pull/21694))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`4e7a421`](https://github.com/mastra-ai/mastra/commit/4e7a421dce8a48742f785d1e93ad2f43a572b282), [`242e324`](https://github.com/mastra-ai/mastra/commit/242e3241e73cbd5c9bb86a31ebb49ca0256488d4), [`217e967`](https://github.com/mastra-ai/mastra/commit/217e9672d8b3160eb729d8e9f0044949e88da239), [`d774e89`](https://github.com/mastra-ai/mastra/commit/d774e8930c781df8c9effe3763e6b501c099b6cc), [`9c27a53`](https://github.com/mastra-ai/mastra/commit/9c27a53cd9d3de4f3f025bc387d94ce371c33f95), [`dff25a1`](https://github.com/mastra-ai/mastra/commit/dff25a1103fa72ee082a9b6f805ebeb5ce400753), [`217e967`](https://github.com/mastra-ai/mastra/commit/217e9672d8b3160eb729d8e9f0044949e88da239), [`7f78585`](https://github.com/mastra-ai/mastra/commit/7f785857e401570e2ffb316911f126ed363aa537), [`f2a4afd`](https://github.com/mastra-ai/mastra/commit/f2a4afd7e37e809669001ed17724b341a5c1f45e), [`d438148`](https://github.com/mastra-ai/mastra/commit/d438148e222c1e2fb3c652725ce75680962ebec4), [`ba05fe0`](https://github.com/mastra-ai/mastra/commit/ba05fe0738f70cb686777546e968237d09269142), [`d26a8d4`](https://github.com/mastra-ai/mastra/commit/d26a8d4281f28414715b333c85bedaf70d0b2890), [`677cdc6`](https://github.com/mastra-ai/mastra/commit/677cdc6af564dec29a13464d12b7ab2a4efc22e9), [`a318490`](https://github.com/mastra-ai/mastra/commit/a318490e17da32f338d50929c770d901a9b3dd72), [`763e0c6`](https://github.com/mastra-ai/mastra/commit/763e0c61e04d76ad9a9efd301aa57525ca0cbea9), [`23e0be2`](https://github.com/mastra-ai/mastra/commit/23e0be261381e49534b4ff3101c60ee64a946cbf), [`7fc8806`](https://github.com/mastra-ai/mastra/commit/7fc880627d3cbf995d31ea0e8b807bf15417e651), [`0e02eac`](https://github.com/mastra-ai/mastra/commit/0e02eacdb2e30e1697a41910b41163742a181dc1), [`4df174c`](https://github.com/mastra-ai/mastra/commit/4df174c32bddf093a82f273070b8380aef7c9e90), [`f7c25b5`](https://github.com/mastra-ai/mastra/commit/f7c25b5106ddfb48e591f98df7a51e0f2dd01dba), [`dc09cc1`](https://github.com/mastra-ai/mastra/commit/dc09cc1083d861cde192c1cd235324dc75b8c731), [`36b4649`](https://github.com/mastra-ai/mastra/commit/36b4649045a3a380cbab8ceca866db4086223aff), [`377eb81`](https://github.com/mastra-ai/mastra/commit/377eb81ce43b964e3a6b541df172da74a8ff3716)]:
|
|
10
|
+
- @mastra/core@1.60.0-alpha.8
|
|
11
|
+
|
|
3
12
|
## 1.1.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-vectorize
|
|
|
3
3
|
description: Documentation for @mastra/vectorize. Use when working with @mastra/vectorize APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/vectorize"
|
|
6
|
-
version: "1.1.0"
|
|
6
|
+
version: "1.1.1-alpha.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -14,13 +14,10 @@ Use this skill whenever you are working with @mastra/vectorize to obtain the dom
|
|
|
14
14
|
|
|
15
15
|
Read the individual reference documents for detailed explanations and code examples.
|
|
16
16
|
|
|
17
|
-
### Docs
|
|
18
|
-
|
|
19
|
-
- [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.
|
|
20
|
-
- [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.
|
|
21
|
-
|
|
22
17
|
### Reference
|
|
23
18
|
|
|
19
|
+
- [Retrieval, semantic search, reranking](references/reference-rag-retrieval.md) - Guide on retrieval processes in Mastra's RAG systems, including semantic search, filtering, and re-ranking.
|
|
20
|
+
- [Storing embeddings in a vector database](references/reference-rag-vector-databases.md) - Guide on vector storage options in Mastra, including embedded and dedicated vector databases for similarity search.
|
|
24
21
|
- [Reference: Cloudflare vector store](references/reference-vectors-vectorize.md) - Documentation for the CloudflareVector class in Mastra, which provides vector search using Cloudflare Vectorize.
|
|
25
22
|
|
|
26
23
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
1
3
|
# Retrieval in RAG systems
|
|
2
4
|
|
|
3
5
|
After storing embeddings, you need to retrieve relevant chunks to answer user queries.
|
|
@@ -158,15 +160,15 @@ When creating the tool, pay special attention to the tool's name and description
|
|
|
158
160
|
|
|
159
161
|
This is particularly useful when:
|
|
160
162
|
|
|
161
|
-
- Your agent needs to
|
|
163
|
+
- Your agent needs to decide at runtime what information to retrieve
|
|
162
164
|
- The retrieval process requires complex decision-making
|
|
163
165
|
- You want the agent to combine multiple retrieval strategies based on context
|
|
164
166
|
|
|
165
167
|
#### Database-Specific Configurations
|
|
166
168
|
|
|
167
|
-
The Vector Query Tool supports database-specific configurations that enable you to
|
|
169
|
+
The Vector Query Tool supports database-specific configurations that enable you to use unique features and optimizations of different vector stores.
|
|
168
170
|
|
|
169
|
-
> **Note:** These configurations are for **query-time options** like namespaces, performance tuning, and filtering
|
|
171
|
+
> **Note:** These configurations are for **query-time options** like namespaces, performance tuning, and filtering, not for database connection setup.
|
|
170
172
|
>
|
|
171
173
|
> Connection credentials (URLs, auth tokens) are configured when you instantiate the vector store class (e.g., `new LibSQLVector({ url: '...' })`).
|
|
172
174
|
|
|
@@ -233,7 +235,7 @@ const lanceQueryTool = createVectorQueryTool({
|
|
|
233
235
|
- **pgVector optimization**: Control search accuracy and speed with ef/probes parameters
|
|
234
236
|
- **Quality filtering**: Set minimum similarity thresholds to improve result relevance
|
|
235
237
|
- **LanceDB tables**: Separate data into tables for better organization and performance
|
|
236
|
-
- **Runtime flexibility**: Override configurations
|
|
238
|
+
- **Runtime flexibility**: Override configurations at runtime based on context
|
|
237
239
|
|
|
238
240
|
**Common Use Cases:**
|
|
239
241
|
|
|
@@ -272,7 +274,7 @@ import { PGVECTOR_PROMPT } from '@mastra/pg'
|
|
|
272
274
|
export const ragAgent = new Agent({
|
|
273
275
|
id: 'rag-agent',
|
|
274
276
|
name: 'RAG Agent',
|
|
275
|
-
model: 'openai/gpt-5.
|
|
277
|
+
model: 'openai/gpt-5.6-sol',
|
|
276
278
|
instructions: `
|
|
277
279
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
278
280
|
${PGVECTOR_PROMPT}
|
|
@@ -289,7 +291,7 @@ import { PINECONE_PROMPT } from '@mastra/pinecone'
|
|
|
289
291
|
export const ragAgent = new Agent({
|
|
290
292
|
id: 'rag-agent',
|
|
291
293
|
name: 'RAG Agent',
|
|
292
|
-
model: 'openai/gpt-5.
|
|
294
|
+
model: 'openai/gpt-5.6-sol',
|
|
293
295
|
instructions: `
|
|
294
296
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
295
297
|
${PINECONE_PROMPT}
|
|
@@ -306,7 +308,7 @@ import { QDRANT_PROMPT } from '@mastra/qdrant'
|
|
|
306
308
|
export const ragAgent = new Agent({
|
|
307
309
|
id: 'rag-agent',
|
|
308
310
|
name: 'RAG Agent',
|
|
309
|
-
model: 'openai/gpt-5.
|
|
311
|
+
model: 'openai/gpt-5.6-sol',
|
|
310
312
|
instructions: `
|
|
311
313
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
312
314
|
${QDRANT_PROMPT}
|
|
@@ -323,7 +325,7 @@ import { CHROMA_PROMPT } from '@mastra/chroma'
|
|
|
323
325
|
export const ragAgent = new Agent({
|
|
324
326
|
id: 'rag-agent',
|
|
325
327
|
name: 'RAG Agent',
|
|
326
|
-
model: 'openai/gpt-5.
|
|
328
|
+
model: 'openai/gpt-5.6-sol',
|
|
327
329
|
instructions: `
|
|
328
330
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
329
331
|
${CHROMA_PROMPT}
|
|
@@ -340,7 +342,7 @@ import { ASTRA_PROMPT } from '@mastra/astra'
|
|
|
340
342
|
export const ragAgent = new Agent({
|
|
341
343
|
id: 'rag-agent',
|
|
342
344
|
name: 'RAG Agent',
|
|
343
|
-
model: 'openai/gpt-5.
|
|
345
|
+
model: 'openai/gpt-5.6-sol',
|
|
344
346
|
instructions: `
|
|
345
347
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
346
348
|
${ASTRA_PROMPT}
|
|
@@ -357,7 +359,7 @@ import { LIBSQL_PROMPT } from '@mastra/libsql'
|
|
|
357
359
|
export const ragAgent = new Agent({
|
|
358
360
|
id: 'rag-agent',
|
|
359
361
|
name: 'RAG Agent',
|
|
360
|
-
model: 'openai/gpt-5.
|
|
362
|
+
model: 'openai/gpt-5.6-sol',
|
|
361
363
|
instructions: `
|
|
362
364
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
363
365
|
${LIBSQL_PROMPT}
|
|
@@ -374,7 +376,7 @@ import { UPSTASH_PROMPT } from '@mastra/upstash'
|
|
|
374
376
|
export const ragAgent = new Agent({
|
|
375
377
|
id: 'rag-agent',
|
|
376
378
|
name: 'RAG Agent',
|
|
377
|
-
model: 'openai/gpt-5.
|
|
379
|
+
model: 'openai/gpt-5.6-sol',
|
|
378
380
|
instructions: `
|
|
379
381
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
380
382
|
${UPSTASH_PROMPT}
|
|
@@ -391,7 +393,7 @@ import { VECTORIZE_PROMPT } from '@mastra/vectorize'
|
|
|
391
393
|
export const ragAgent = new Agent({
|
|
392
394
|
id: 'rag-agent',
|
|
393
395
|
name: 'RAG Agent',
|
|
394
|
-
model: 'openai/gpt-5.
|
|
396
|
+
model: 'openai/gpt-5.6-sol',
|
|
395
397
|
instructions: `
|
|
396
398
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
397
399
|
${VECTORIZE_PROMPT}
|
|
@@ -408,7 +410,7 @@ import { MONGODB_PROMPT } from '@mastra/mongodb'
|
|
|
408
410
|
export const ragAgent = new Agent({
|
|
409
411
|
id: 'rag-agent',
|
|
410
412
|
name: 'RAG Agent',
|
|
411
|
-
model: 'openai/gpt-5.
|
|
413
|
+
model: 'openai/gpt-5.6-sol',
|
|
412
414
|
instructions: `
|
|
413
415
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
414
416
|
${MONGODB_PROMPT}
|
|
@@ -425,7 +427,7 @@ import { OPENSEARCH_PROMPT } from '@mastra/opensearch'
|
|
|
425
427
|
export const ragAgent = new Agent({
|
|
426
428
|
id: 'rag-agent',
|
|
427
429
|
name: 'RAG Agent',
|
|
428
|
-
model: 'openai/gpt-5.
|
|
430
|
+
model: 'openai/gpt-5.6-sol',
|
|
429
431
|
instructions: `
|
|
430
432
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
431
433
|
${OPENSEARCH_PROMPT}
|
|
@@ -434,6 +436,23 @@ export const ragAgent = new Agent({
|
|
|
434
436
|
})
|
|
435
437
|
```
|
|
436
438
|
|
|
439
|
+
**OracleDB**:
|
|
440
|
+
|
|
441
|
+
```ts
|
|
442
|
+
import { ORACLEDB_PROMPT } from '@mastra/oracledb'
|
|
443
|
+
|
|
444
|
+
export const ragAgent = new Agent({
|
|
445
|
+
id: 'rag-agent',
|
|
446
|
+
name: 'RAG Agent',
|
|
447
|
+
model: 'openai/gpt-5.6-sol',
|
|
448
|
+
instructions: `
|
|
449
|
+
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
450
|
+
${ORACLEDB_PROMPT}
|
|
451
|
+
`,
|
|
452
|
+
tools: { vectorQueryTool },
|
|
453
|
+
})
|
|
454
|
+
```
|
|
455
|
+
|
|
437
456
|
**S3Vectors**:
|
|
438
457
|
|
|
439
458
|
```ts
|
|
@@ -442,7 +461,7 @@ import { S3VECTORS_PROMPT } from '@mastra/s3vectors'
|
|
|
442
461
|
export const ragAgent = new Agent({
|
|
443
462
|
id: 'rag-agent',
|
|
444
463
|
name: 'RAG Agent',
|
|
445
|
-
model: 'openai/gpt-5.
|
|
464
|
+
model: 'openai/gpt-5.6-sol',
|
|
446
465
|
instructions: `
|
|
447
466
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
448
467
|
${S3VECTORS_PROMPT}
|
|
@@ -453,10 +472,10 @@ export const ragAgent = new Agent({
|
|
|
453
472
|
|
|
454
473
|
### Re-ranking
|
|
455
474
|
|
|
456
|
-
Initial vector similarity search can sometimes miss
|
|
475
|
+
Initial vector similarity search can sometimes miss detailed relevance. Re-ranking is a more computationally expensive process, but more accurate algorithm that improves results by:
|
|
457
476
|
|
|
458
477
|
- Considering word order and exact matches
|
|
459
|
-
- Applying more
|
|
478
|
+
- Applying more advanced relevance scoring
|
|
460
479
|
- Using a method called cross-attention between query and documents
|
|
461
480
|
|
|
462
481
|
Here's how to use re-ranking:
|
|
@@ -474,7 +493,7 @@ const initialResults = await pgVector.query({
|
|
|
474
493
|
// Create a relevance scorer
|
|
475
494
|
const relevanceProvider = new MastraAgentRelevanceScorer(
|
|
476
495
|
'relevance-scorer',
|
|
477
|
-
'openai/gpt-5.
|
|
496
|
+
'openai/gpt-5.6-sol',
|
|
478
497
|
)
|
|
479
498
|
|
|
480
499
|
// Re-rank the results
|
|
@@ -515,4 +534,4 @@ The re-ranked results combine vector similarity with semantic understanding to i
|
|
|
515
534
|
|
|
516
535
|
For more details about re-ranking, see the [rerank()](https://mastra.ai/reference/rag/rerankWithScorer) method.
|
|
517
536
|
|
|
518
|
-
For graph-based retrieval that follows connections between chunks, see the [GraphRAG](https://mastra.ai/
|
|
537
|
+
For graph-based retrieval that follows connections between chunks, see the [GraphRAG](https://mastra.ai/reference/rag/graph-rag-guide) documentation.
|
package/dist/docs/references/{docs-rag-vector-databases.md → reference-rag-vector-databases.md}
RENAMED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
1
3
|
# Storing embeddings in a vector database
|
|
2
4
|
|
|
3
|
-
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
|
|
5
|
+
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 vector databases.
|
|
4
6
|
|
|
5
7
|
## Supported databases
|
|
6
8
|
|
|
@@ -12,7 +14,7 @@ import { MongoDBVector } from '@mastra/mongodb'
|
|
|
12
14
|
const store = new MongoDBVector({
|
|
13
15
|
id: 'mongodb-vector',
|
|
14
16
|
uri: process.env.MONGODB_URI,
|
|
15
|
-
dbName: process.env.
|
|
17
|
+
dbName: process.env.MONGODB_DB_NAME,
|
|
16
18
|
})
|
|
17
19
|
await store.createIndex({
|
|
18
20
|
indexName: 'myCollection',
|
|
@@ -25,10 +27,31 @@ await store.upsert({
|
|
|
25
27
|
})
|
|
26
28
|
```
|
|
27
29
|
|
|
28
|
-
### Using MongoDB Atlas Vector
|
|
30
|
+
### Using MongoDB Atlas Vector Search
|
|
29
31
|
|
|
30
32
|
For detailed setup instructions and best practices, see the [official MongoDB Atlas Vector Search documentation](https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-overview/?utm_campaign=devrel\&utm_source=third-party-content\&utm_medium=cta\&utm_content=mastra-docs).
|
|
31
33
|
|
|
34
|
+
### Using VoyageAI with MongoDB
|
|
35
|
+
|
|
36
|
+
MongoDB works seamlessly with VoyageAI's embedding models, which are optimized for retrieval tasks. For complete examples and specialized models, see the [VoyageAI embeddings documentation](https://mastra.ai/models/embeddings) and [MongoDB vector reference](https://mastra.ai/reference/vectors/mongodb).
|
|
37
|
+
|
|
38
|
+
### Hybrid Search (Vector + Full-Text)
|
|
39
|
+
|
|
40
|
+
MongoDB supports hybrid search that fuses vector similarity with BM25 full-text search using server-side `$rankFusion` (requires MongoDB >= 8.0; generally available from 8.1, and enabled on Atlas 8.0.x). This is useful when you want to combine semantic and keyword-based retrieval:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
await store.createSearchIndex({ indexName: 'myCollection', fields: ['text'] })
|
|
44
|
+
const results = await store.hybridQuery({
|
|
45
|
+
indexName: 'myCollection',
|
|
46
|
+
queryVector: embedding,
|
|
47
|
+
query: 'search terms',
|
|
48
|
+
paths: ['text'],
|
|
49
|
+
topK: 10,
|
|
50
|
+
})
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
See the [MongoDB vector reference](https://mastra.ai/reference/vectors/mongodb) for details on `createSearchIndex()`, `textQuery()`, and `hybridQuery()`.
|
|
54
|
+
|
|
32
55
|
**PgVector**:
|
|
33
56
|
|
|
34
57
|
```ts
|
|
@@ -55,6 +78,35 @@ await store.upsert({
|
|
|
55
78
|
|
|
56
79
|
PostgreSQL with the pgvector extension is a good solution for teams already using PostgreSQL who want to minimize infrastructure complexity. For detailed setup instructions and best practices, see the [official pgvector repository](https://github.com/pgvector/pgvector).
|
|
57
80
|
|
|
81
|
+
**OracleDB**:
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { OracleVector } from '@mastra/oracledb'
|
|
85
|
+
|
|
86
|
+
const store = new OracleVector({
|
|
87
|
+
id: 'oracle-vector',
|
|
88
|
+
user: process.env.ORACLE_DATABASE_USER,
|
|
89
|
+
password: process.env.ORACLE_DATABASE_PASSWORD,
|
|
90
|
+
connectString: process.env.ORACLE_DATABASE_CONNECT_STRING,
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
await store.createIndex({
|
|
94
|
+
indexName: 'myCollection',
|
|
95
|
+
dimension: 1536,
|
|
96
|
+
indexConfig: { type: 'none' },
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
await store.upsert({
|
|
100
|
+
indexName: 'myCollection',
|
|
101
|
+
vectors: embeddings,
|
|
102
|
+
metadata: chunks.map(chunk => ({ text: chunk.text })),
|
|
103
|
+
})
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Using Oracle Database Vector Search
|
|
107
|
+
|
|
108
|
+
OracleDB stores embeddings in native `VECTOR` columns and metadata in Oracle JSON. Exact search is the default; HNSW and IVF indexes can be configured for tuned deployments.
|
|
109
|
+
|
|
58
110
|
**Pinecone**:
|
|
59
111
|
|
|
60
112
|
```ts
|
|
@@ -355,8 +407,9 @@ await store.createIndex({
|
|
|
355
407
|
|
|
356
408
|
The dimension size must match the output dimension of your chosen embedding model. Common dimension sizes are:
|
|
357
409
|
|
|
358
|
-
-
|
|
410
|
+
- OpenAI `text-embedding-3-small`: 1536 dimensions (or custom, e.g., 256)
|
|
359
411
|
- `Cohere embed-multilingual-v3`: 1024 dimensions
|
|
412
|
+
- `VoyageAI voyage-3.5`: 1024 dimensions (or custom: 256, 512, 1024, 2048)
|
|
360
413
|
- `Google gemini-embedding-001`: 768 dimensions (or custom)
|
|
361
414
|
|
|
362
415
|
> **Warning:** Index dimensions can't be changed after creation. To use a different model, delete and recreate the index with the new dimension size.
|
|
@@ -386,6 +439,18 @@ Index names must:
|
|
|
386
439
|
- Example: `my_index_123` is valid
|
|
387
440
|
- Example: `my-index` is not valid (contains hyphen)
|
|
388
441
|
|
|
442
|
+
**OracleDB**:
|
|
443
|
+
|
|
444
|
+
Index names are logical Mastra names. OracleDB maps each logical index to a physical Oracle table internally.
|
|
445
|
+
|
|
446
|
+
Logical index names must:
|
|
447
|
+
|
|
448
|
+
- Be non-empty
|
|
449
|
+
- Be 512 characters or fewer
|
|
450
|
+
- Be stable for the lifetime of the vector index
|
|
451
|
+
- Example: `my_collection_123` is valid
|
|
452
|
+
- Example: `customer-support/docs:v1` is valid and is mapped to a safe Oracle table name
|
|
453
|
+
|
|
389
454
|
**Pinecone**:
|
|
390
455
|
|
|
391
456
|
Index names must:
|
|
@@ -547,7 +612,7 @@ The upsert operation:
|
|
|
547
612
|
|
|
548
613
|
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.
|
|
549
614
|
|
|
550
|
-
> **Warning:** Metadata is
|
|
615
|
+
> **Warning:** Metadata is important 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.
|
|
551
616
|
|
|
552
617
|
```ts
|
|
553
618
|
// Store embeddings with rich metadata for better organization and filtering
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
1
3
|
# Cloudflare vector store
|
|
2
4
|
|
|
3
5
|
The CloudflareVector class provides vector search using [Cloudflare Vectorize](https://developers.cloudflare.com/vectorize/), a vector database service integrated with Cloudflare's edge network.
|
|
@@ -88,13 +90,13 @@ Lists all metadata field indexes for an index.
|
|
|
88
90
|
|
|
89
91
|
### `updateVector()`
|
|
90
92
|
|
|
91
|
-
Updates
|
|
93
|
+
Updates the vector and optionally the metadata for a specific ID within an index. Vectorize has no partial-update operation, so `update.vector` is required. Metadata-only updates aren't supported and throw an error.
|
|
92
94
|
|
|
93
95
|
**indexName** (`string`): Name of the index containing the ID to update
|
|
94
96
|
|
|
95
97
|
**id** (`string`): Unique identifier of the vector or metadata to update
|
|
96
98
|
|
|
97
|
-
**update** (`{ vector
|
|
99
|
+
**update** (`{ vector: number[]; metadata?: Record<string, any>; }`): Object containing the new vector values, and optionally the metadata to update. The vector values are required
|
|
98
100
|
|
|
99
101
|
### `deleteVector()`
|
|
100
102
|
|
|
@@ -104,6 +106,16 @@ Deletes a vector and its associated metadata for a specific ID within an index.
|
|
|
104
106
|
|
|
105
107
|
**id** (`string`): Unique identifier of the vector and metadata to delete
|
|
106
108
|
|
|
109
|
+
### `deleteVectors()`
|
|
110
|
+
|
|
111
|
+
Deletes multiple vectors and their associated metadata by ID. Vectorize has no filtered-delete operation, so deleting by metadata filter isn't supported and throws an error.
|
|
112
|
+
|
|
113
|
+
**indexName** (`string`): Name of the index containing the vectors to delete
|
|
114
|
+
|
|
115
|
+
**ids** (`string[]`): Unique identifiers of the vectors to delete. Must contain at least one ID, and cannot be combined with filter
|
|
116
|
+
|
|
117
|
+
**filter** (`Record<string, any>`): Not supported by Vectorize. Passing a filter throws an error
|
|
118
|
+
|
|
107
119
|
## Response types
|
|
108
120
|
|
|
109
121
|
Query results are returned in this format:
|