@mastra/qdrant 1.0.1-alpha.0 → 1.0.2-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 +18 -0
- package/LICENSE.md +15 -0
- package/dist/docs/SKILL.md +4 -4
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-rag-retrieval.md +16 -16
- package/dist/docs/references/docs-rag-vector-databases.md +13 -13
- package/dist/docs/references/reference-vectors-qdrant.md +51 -51
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @mastra/qdrant
|
|
2
2
|
|
|
3
|
+
## 1.0.2-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed `upsert` error when the `ids` parameter is provided as a `uint64` cast to a string, which should be valid to upsert ([#14090](https://github.com/mastra-ai/mastra/pull/14090))
|
|
8
|
+
with Qdrant, as defined in [Qdrant API - Upsert Endpoint](https://api.qdrant.tech/api-reference/points/upsert-points#request.body.PointsList.points.id).
|
|
9
|
+
- Updated dependencies [[`9140989`](https://github.com/mastra-ai/mastra/commit/91409890e83f4f1d9c1b39223f1af91a6a53b549), [`d7c98cf`](https://github.com/mastra-ai/mastra/commit/d7c98cfc9d75baba9ecbf1a8835b5183d0a0aec8), [`acf5fbc`](https://github.com/mastra-ai/mastra/commit/acf5fbcb890dc7ca7167bec386ce5874dfadb997), [`24ca2ae`](https://github.com/mastra-ai/mastra/commit/24ca2ae57538ec189fabb9daee6175ad27035853), [`0762516`](https://github.com/mastra-ai/mastra/commit/07625167e029a8268ea7aaf0402416e6d8832874), [`2de3d36`](https://github.com/mastra-ai/mastra/commit/2de3d36932b7f73ad26bc403f7da26cfe89e903e), [`d3736cb`](https://github.com/mastra-ai/mastra/commit/d3736cb9ce074d2b8e8b00218a01f790fe81a1b4), [`c627366`](https://github.com/mastra-ai/mastra/commit/c6273666f9ef4c8c617c68b7d07fe878a322f85c)]:
|
|
10
|
+
- @mastra/core@1.18.1-alpha.1
|
|
11
|
+
|
|
12
|
+
## 1.0.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Add a clear runtime error when `queryVector` is omitted for vector stores that require a vector for queries. Previously, omitting `queryVector` would produce confusing SDK-level errors; now each store throws a structured `MastraError` with `ErrorCategory.USER` explaining that metadata-only queries are not supported by that backend. ([#13286](https://github.com/mastra-ai/mastra/pull/13286))
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`df170fd`](https://github.com/mastra-ai/mastra/commit/df170fd139b55f845bfd2de8488b16435bd3d0da), [`ae55343`](https://github.com/mastra-ai/mastra/commit/ae5534397fc006fd6eef3e4f80c235bcdc9289ef), [`c290cec`](https://github.com/mastra-ai/mastra/commit/c290cec5bf9107225de42942b56b487107aa9dce), [`f03e794`](https://github.com/mastra-ai/mastra/commit/f03e794630f812b56e95aad54f7b1993dc003add), [`aa4a5ae`](https://github.com/mastra-ai/mastra/commit/aa4a5aedb80d8d6837bab8cbb2e301215d1ba3e9), [`de3f584`](https://github.com/mastra-ai/mastra/commit/de3f58408752a8d80a295275c7f23fc306cf7f4f), [`d3fb010`](https://github.com/mastra-ai/mastra/commit/d3fb010c98f575f1c0614452667396e2653815f6), [`702ee1c`](https://github.com/mastra-ai/mastra/commit/702ee1c41be67cc532b4dbe89bcb62143508f6f0), [`f495051`](https://github.com/mastra-ai/mastra/commit/f495051eb6496a720f637fc85b6d69941c12554c), [`e622f1d`](https://github.com/mastra-ai/mastra/commit/e622f1d3ab346a8e6aca6d1fe2eac99bd961e50b), [`861f111`](https://github.com/mastra-ai/mastra/commit/861f11189211b20ddb70d8df81a6b901fc78d11e), [`00f43e8`](https://github.com/mastra-ai/mastra/commit/00f43e8e97a80c82b27d5bd30494f10a715a1df9), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`96a1702`](https://github.com/mastra-ai/mastra/commit/96a1702ce362c50dda20c8b4a228b4ad1a36a17a), [`cb9f921`](https://github.com/mastra-ai/mastra/commit/cb9f921320913975657abb1404855d8c510f7ac5), [`114e7c1`](https://github.com/mastra-ai/mastra/commit/114e7c146ac682925f0fb37376c1be70e5d6e6e5), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`72df4a8`](https://github.com/mastra-ai/mastra/commit/72df4a8f9bf1a20cfd3d9006a4fdb597ad56d10a)]:
|
|
19
|
+
- @mastra/core@1.8.0
|
|
20
|
+
|
|
3
21
|
## 1.0.1-alpha.0
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/LICENSE.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
Portions of this software are licensed as follows:
|
|
2
|
+
|
|
3
|
+
- All content that resides under any directory named "ee/" within this
|
|
4
|
+
repository, including but not limited to:
|
|
5
|
+
- `packages/core/src/auth/ee/`
|
|
6
|
+
- `packages/server/src/server/auth/ee/`
|
|
7
|
+
is licensed under the license defined in `ee/LICENSE`.
|
|
8
|
+
|
|
9
|
+
- All third-party components incorporated into the Mastra Software are
|
|
10
|
+
licensed under the original license provided by the owner of the
|
|
11
|
+
applicable component.
|
|
12
|
+
|
|
13
|
+
- Content outside of the above-mentioned directories or restrictions is
|
|
14
|
+
available under the "Apache License 2.0" as defined below.
|
|
15
|
+
|
|
1
16
|
# Apache License 2.0
|
|
2
17
|
|
|
3
18
|
Copyright (c) 2025 Kepler Software, Inc.
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-qdrant
|
|
|
3
3
|
description: Documentation for @mastra/qdrant. Use when working with @mastra/qdrant APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/qdrant"
|
|
6
|
-
version: "1.0.
|
|
6
|
+
version: "1.0.2-alpha.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -16,12 +16,12 @@ Read the individual reference documents for detailed explanations and code examp
|
|
|
16
16
|
|
|
17
17
|
### Docs
|
|
18
18
|
|
|
19
|
-
- [Retrieval,
|
|
20
|
-
- [Storing
|
|
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
21
|
|
|
22
22
|
### Reference
|
|
23
23
|
|
|
24
|
-
- [Reference: Qdrant
|
|
24
|
+
- [Reference: Qdrant vector store](references/reference-vectors-qdrant.md) - Documentation for integrating Qdrant with Mastra, a vector similarity search engine for managing vectors and payloads.
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# Retrieval in RAG
|
|
1
|
+
# Retrieval in RAG systems
|
|
2
2
|
|
|
3
3
|
After storing embeddings, you need to retrieve relevant chunks to answer user queries.
|
|
4
4
|
|
|
5
5
|
Mastra provides flexible retrieval options with support for semantic search, filtering, and re-ranking.
|
|
6
6
|
|
|
7
|
-
## How
|
|
7
|
+
## How retrieval works
|
|
8
8
|
|
|
9
9
|
1. The user's query is converted to an embedding using the same model used for document embeddings
|
|
10
10
|
2. This embedding is compared to stored embeddings using vector similarity
|
|
@@ -14,7 +14,7 @@ Mastra provides flexible retrieval options with support for semantic search, fil
|
|
|
14
14
|
- Re-ranked for better relevance
|
|
15
15
|
- Processed through a knowledge graph
|
|
16
16
|
|
|
17
|
-
## Basic
|
|
17
|
+
## Basic retrieval
|
|
18
18
|
|
|
19
19
|
The simplest approach is direct semantic search. This method uses vector similarity to find chunks that are semantically similar to the query:
|
|
20
20
|
|
|
@@ -63,7 +63,7 @@ Results include both the text content and a similarity score:
|
|
|
63
63
|
]
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
## Advanced
|
|
66
|
+
## Advanced retrieval options
|
|
67
67
|
|
|
68
68
|
### Metadata Filtering
|
|
69
69
|
|
|
@@ -272,7 +272,7 @@ import { PGVECTOR_PROMPT } from '@mastra/pg'
|
|
|
272
272
|
export const ragAgent = new Agent({
|
|
273
273
|
id: 'rag-agent',
|
|
274
274
|
name: 'RAG Agent',
|
|
275
|
-
model: 'openai/gpt-5.
|
|
275
|
+
model: 'openai/gpt-5.4',
|
|
276
276
|
instructions: `
|
|
277
277
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
278
278
|
${PGVECTOR_PROMPT}
|
|
@@ -289,7 +289,7 @@ import { PINECONE_PROMPT } from '@mastra/pinecone'
|
|
|
289
289
|
export const ragAgent = new Agent({
|
|
290
290
|
id: 'rag-agent',
|
|
291
291
|
name: 'RAG Agent',
|
|
292
|
-
model: 'openai/gpt-5.
|
|
292
|
+
model: 'openai/gpt-5.4',
|
|
293
293
|
instructions: `
|
|
294
294
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
295
295
|
${PINECONE_PROMPT}
|
|
@@ -306,7 +306,7 @@ import { QDRANT_PROMPT } from '@mastra/qdrant'
|
|
|
306
306
|
export const ragAgent = new Agent({
|
|
307
307
|
id: 'rag-agent',
|
|
308
308
|
name: 'RAG Agent',
|
|
309
|
-
model: 'openai/gpt-5.
|
|
309
|
+
model: 'openai/gpt-5.4',
|
|
310
310
|
instructions: `
|
|
311
311
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
312
312
|
${QDRANT_PROMPT}
|
|
@@ -323,7 +323,7 @@ import { CHROMA_PROMPT } from '@mastra/chroma'
|
|
|
323
323
|
export const ragAgent = new Agent({
|
|
324
324
|
id: 'rag-agent',
|
|
325
325
|
name: 'RAG Agent',
|
|
326
|
-
model: 'openai/gpt-5.
|
|
326
|
+
model: 'openai/gpt-5.4',
|
|
327
327
|
instructions: `
|
|
328
328
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
329
329
|
${CHROMA_PROMPT}
|
|
@@ -340,7 +340,7 @@ import { ASTRA_PROMPT } from '@mastra/astra'
|
|
|
340
340
|
export const ragAgent = new Agent({
|
|
341
341
|
id: 'rag-agent',
|
|
342
342
|
name: 'RAG Agent',
|
|
343
|
-
model: 'openai/gpt-5.
|
|
343
|
+
model: 'openai/gpt-5.4',
|
|
344
344
|
instructions: `
|
|
345
345
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
346
346
|
${ASTRA_PROMPT}
|
|
@@ -357,7 +357,7 @@ import { LIBSQL_PROMPT } from '@mastra/libsql'
|
|
|
357
357
|
export const ragAgent = new Agent({
|
|
358
358
|
id: 'rag-agent',
|
|
359
359
|
name: 'RAG Agent',
|
|
360
|
-
model: 'openai/gpt-5.
|
|
360
|
+
model: 'openai/gpt-5.4',
|
|
361
361
|
instructions: `
|
|
362
362
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
363
363
|
${LIBSQL_PROMPT}
|
|
@@ -374,7 +374,7 @@ import { UPSTASH_PROMPT } from '@mastra/upstash'
|
|
|
374
374
|
export const ragAgent = new Agent({
|
|
375
375
|
id: 'rag-agent',
|
|
376
376
|
name: 'RAG Agent',
|
|
377
|
-
model: 'openai/gpt-5.
|
|
377
|
+
model: 'openai/gpt-5.4',
|
|
378
378
|
instructions: `
|
|
379
379
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
380
380
|
${UPSTASH_PROMPT}
|
|
@@ -391,7 +391,7 @@ import { VECTORIZE_PROMPT } from '@mastra/vectorize'
|
|
|
391
391
|
export const ragAgent = new Agent({
|
|
392
392
|
id: 'rag-agent',
|
|
393
393
|
name: 'RAG Agent',
|
|
394
|
-
model: 'openai/gpt-5.
|
|
394
|
+
model: 'openai/gpt-5.4',
|
|
395
395
|
instructions: `
|
|
396
396
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
397
397
|
${VECTORIZE_PROMPT}
|
|
@@ -408,7 +408,7 @@ import { MONGODB_PROMPT } from '@mastra/mongodb'
|
|
|
408
408
|
export const ragAgent = new Agent({
|
|
409
409
|
id: 'rag-agent',
|
|
410
410
|
name: 'RAG Agent',
|
|
411
|
-
model: 'openai/gpt-5.
|
|
411
|
+
model: 'openai/gpt-5.4',
|
|
412
412
|
instructions: `
|
|
413
413
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
414
414
|
${MONGODB_PROMPT}
|
|
@@ -425,7 +425,7 @@ import { OPENSEARCH_PROMPT } from '@mastra/opensearch'
|
|
|
425
425
|
export const ragAgent = new Agent({
|
|
426
426
|
id: 'rag-agent',
|
|
427
427
|
name: 'RAG Agent',
|
|
428
|
-
model: 'openai/gpt-5.
|
|
428
|
+
model: 'openai/gpt-5.4',
|
|
429
429
|
instructions: `
|
|
430
430
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
431
431
|
${OPENSEARCH_PROMPT}
|
|
@@ -442,7 +442,7 @@ import { S3VECTORS_PROMPT } from '@mastra/s3vectors'
|
|
|
442
442
|
export const ragAgent = new Agent({
|
|
443
443
|
id: 'rag-agent',
|
|
444
444
|
name: 'RAG Agent',
|
|
445
|
-
model: 'openai/gpt-5.
|
|
445
|
+
model: 'openai/gpt-5.4',
|
|
446
446
|
instructions: `
|
|
447
447
|
Process queries using the provided context. Structure responses to be concise and relevant.
|
|
448
448
|
${S3VECTORS_PROMPT}
|
|
@@ -472,7 +472,7 @@ const initialResults = await pgVector.query({
|
|
|
472
472
|
})
|
|
473
473
|
|
|
474
474
|
// Create a relevance scorer
|
|
475
|
-
const relevanceProvider = new MastraAgentRelevanceScorer('relevance-scorer', 'openai/gpt-5.
|
|
475
|
+
const relevanceProvider = new MastraAgentRelevanceScorer('relevance-scorer', 'openai/gpt-5.4')
|
|
476
476
|
|
|
477
477
|
// Re-rank the results
|
|
478
478
|
const rerankedResults = await rerank({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Storing
|
|
1
|
+
# Storing embeddings in a vector database
|
|
2
2
|
|
|
3
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 various vector databases.
|
|
4
4
|
|
|
5
|
-
## Supported
|
|
5
|
+
## Supported databases
|
|
6
6
|
|
|
7
7
|
**MongoDB**:
|
|
8
8
|
|
|
@@ -234,7 +234,7 @@ await store.upsert({
|
|
|
234
234
|
})
|
|
235
235
|
```
|
|
236
236
|
|
|
237
|
-
**
|
|
237
|
+
**Elasticsearch**:
|
|
238
238
|
|
|
239
239
|
```ts
|
|
240
240
|
import { ElasticSearchVector } from '@mastra/elasticsearch'
|
|
@@ -337,7 +337,7 @@ await store.upsert({
|
|
|
337
337
|
})
|
|
338
338
|
```
|
|
339
339
|
|
|
340
|
-
## Using
|
|
340
|
+
## Using vector storage
|
|
341
341
|
|
|
342
342
|
Once initialized, all vector stores share the same interface for creating indexes, upserting embeddings, and querying.
|
|
343
343
|
|
|
@@ -355,11 +355,11 @@ await store.createIndex({
|
|
|
355
355
|
|
|
356
356
|
The dimension size must match the output dimension of your chosen embedding model. Common dimension sizes are:
|
|
357
357
|
|
|
358
|
-
- OpenAI text-embedding-3-small
|
|
359
|
-
- Cohere embed-multilingual-v3
|
|
360
|
-
- Google gemini-embedding-001
|
|
358
|
+
- `OpenAI text-embedding-3-small`: 1536 dimensions (or custom, e.g., 256)
|
|
359
|
+
- `Cohere embed-multilingual-v3`: 1024 dimensions
|
|
360
|
+
- `Google gemini-embedding-001`: 768 dimensions (or custom)
|
|
361
361
|
|
|
362
|
-
> **Warning:** Index dimensions
|
|
362
|
+
> **Warning:** Index dimensions can't be changed after creation. To use a different model, delete and recreate the index with the new dimension size.
|
|
363
363
|
|
|
364
364
|
### Naming Rules for Databases
|
|
365
365
|
|
|
@@ -490,7 +490,7 @@ Index names must:
|
|
|
490
490
|
- Example: `My_Index` is not valid (contains uppercase letters)
|
|
491
491
|
- Example: `_myindex` is not valid (begins with underscore)
|
|
492
492
|
|
|
493
|
-
**
|
|
493
|
+
**Elasticsearch**:
|
|
494
494
|
|
|
495
495
|
Index names must:
|
|
496
496
|
|
|
@@ -543,7 +543,7 @@ The upsert operation:
|
|
|
543
543
|
- Creates new vectors if they don't exist
|
|
544
544
|
- Automatically handles batching for large datasets
|
|
545
545
|
|
|
546
|
-
## Adding
|
|
546
|
+
## Adding metadata
|
|
547
547
|
|
|
548
548
|
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
549
|
|
|
@@ -581,9 +581,9 @@ Key metadata considerations:
|
|
|
581
581
|
- Only include fields you plan to filter or sort by - extra fields add overhead
|
|
582
582
|
- Add timestamps (e.g., 'createdAt', 'lastUpdated') to track content freshness
|
|
583
583
|
|
|
584
|
-
## Deleting
|
|
584
|
+
## Deleting vectors
|
|
585
585
|
|
|
586
|
-
When building RAG applications, you often need to clean up stale vectors when documents are deleted or updated. Mastra provides the `deleteVectors` method that supports deleting vectors by metadata filters, making it
|
|
586
|
+
When building RAG applications, you often need to clean up stale vectors when documents are deleted or updated. Mastra provides the `deleteVectors` method that supports deleting vectors by metadata filters, making it straightforward to remove all embeddings associated with a specific document.
|
|
587
587
|
|
|
588
588
|
### Delete by Metadata Filter
|
|
589
589
|
|
|
@@ -637,7 +637,7 @@ await store.deleteVectors({
|
|
|
637
637
|
})
|
|
638
638
|
```
|
|
639
639
|
|
|
640
|
-
## Best
|
|
640
|
+
## Best practices
|
|
641
641
|
|
|
642
642
|
- Create indexes before bulk insertions
|
|
643
643
|
- Use batch operations for large insertions (the upsert method handles batching automatically)
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
# Qdrant
|
|
1
|
+
# Qdrant vector store
|
|
2
2
|
|
|
3
3
|
The QdrantVector class provides vector search using [Qdrant](https://qdrant.tech/), a vector similarity search engine. It provides a production-ready service with a convenient API to store, search, and manage vectors with additional payload and extended filtering support.
|
|
4
4
|
|
|
5
|
-
## Constructor
|
|
5
|
+
## Constructor options
|
|
6
6
|
|
|
7
|
-
**url
|
|
7
|
+
**url** (`string`): REST URL of the Qdrant instance. Eg. https\://xyz-example.eu-central.aws.cloud.qdrant.io:6333
|
|
8
8
|
|
|
9
|
-
**apiKey
|
|
9
|
+
**apiKey** (`string`): Optional Qdrant API key
|
|
10
10
|
|
|
11
|
-
**https
|
|
11
|
+
**https** (`boolean`): Whether to use TLS when setting up the connection. Recommended.
|
|
12
12
|
|
|
13
13
|
## Methods
|
|
14
14
|
|
|
15
|
-
### createIndex()
|
|
15
|
+
### `createIndex()`
|
|
16
16
|
|
|
17
|
-
**indexName
|
|
17
|
+
**indexName** (`string`): Name of the index to create
|
|
18
18
|
|
|
19
|
-
**dimension
|
|
19
|
+
**dimension** (`number`): Vector dimension (must match your embedding model). Required for single-vector collections.
|
|
20
20
|
|
|
21
|
-
**metric
|
|
21
|
+
**metric** (`'cosine' | 'euclidean' | 'dotproduct'`): Distance metric for similarity search (Default: `cosine`)
|
|
22
22
|
|
|
23
|
-
**namedVectors
|
|
23
|
+
**namedVectors** (`Record<string, { size: number; distance: 'cosine' | 'euclidean' | 'dotproduct' }>`): Configuration for named vector spaces. When provided, creates a collection with multiple named vector fields.
|
|
24
24
|
|
|
25
25
|
#### Creating a Named Vectors Collection
|
|
26
26
|
|
|
@@ -36,17 +36,17 @@ await store.createIndex({
|
|
|
36
36
|
})
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
### upsert()
|
|
39
|
+
### `upsert()`
|
|
40
40
|
|
|
41
|
-
**indexName
|
|
41
|
+
**indexName** (`string`): Name of the index to upsert into
|
|
42
42
|
|
|
43
|
-
**vectors
|
|
43
|
+
**vectors** (`number[][]`): Array of embedding vectors
|
|
44
44
|
|
|
45
|
-
**metadata
|
|
45
|
+
**metadata** (`Record<string, any>[]`): Metadata for each vector
|
|
46
46
|
|
|
47
|
-
**ids
|
|
47
|
+
**ids** (`string[]`): Optional vector IDs (auto-generated if not provided)
|
|
48
48
|
|
|
49
|
-
**vectorName
|
|
49
|
+
**vectorName** (`string`): Name of the vector space to upsert into when using named vectors.
|
|
50
50
|
|
|
51
51
|
#### Upserting into Named Vector Spaces
|
|
52
52
|
|
|
@@ -68,19 +68,19 @@ await store.upsert({
|
|
|
68
68
|
})
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
### query()
|
|
71
|
+
### `query()`
|
|
72
72
|
|
|
73
|
-
**indexName
|
|
73
|
+
**indexName** (`string`): Name of the index to query
|
|
74
74
|
|
|
75
|
-
**queryVector
|
|
75
|
+
**queryVector** (`number[]`): Query vector to find similar vectors
|
|
76
76
|
|
|
77
|
-
**topK
|
|
77
|
+
**topK** (`number`): Number of results to return (Default: `10`)
|
|
78
78
|
|
|
79
|
-
**filter
|
|
79
|
+
**filter** (`Record<string, any>`): Metadata filters for the query
|
|
80
80
|
|
|
81
|
-
**includeVector
|
|
81
|
+
**includeVector** (`boolean`): Whether to include vectors in the results (Default: `false`)
|
|
82
82
|
|
|
83
|
-
**using
|
|
83
|
+
**using** (`string`): Name of the vector field to query when using named vectors. Use this when your collection has multiple named vector fields.
|
|
84
84
|
|
|
85
85
|
#### Named Vectors
|
|
86
86
|
|
|
@@ -95,13 +95,13 @@ const results = await store.query({
|
|
|
95
95
|
})
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
### listIndexes()
|
|
98
|
+
### `listIndexes()`
|
|
99
99
|
|
|
100
100
|
Returns an array of index names as strings.
|
|
101
101
|
|
|
102
|
-
### describeIndex()
|
|
102
|
+
### `describeIndex()`
|
|
103
103
|
|
|
104
|
-
**indexName
|
|
104
|
+
**indexName** (`string`): Name of the index to describe
|
|
105
105
|
|
|
106
106
|
Returns:
|
|
107
107
|
|
|
@@ -113,53 +113,53 @@ interface IndexStats {
|
|
|
113
113
|
}
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
-
### deleteIndex()
|
|
116
|
+
### `deleteIndex()`
|
|
117
117
|
|
|
118
|
-
**indexName
|
|
118
|
+
**indexName** (`string`): Name of the index to delete
|
|
119
119
|
|
|
120
|
-
### updateVector()
|
|
120
|
+
### `updateVector()`
|
|
121
121
|
|
|
122
122
|
Update a single vector by ID or by metadata filter. Either `id` or `filter` must be provided, but not both.
|
|
123
123
|
|
|
124
|
-
**indexName
|
|
124
|
+
**indexName** (`string`): Name of the index to update
|
|
125
125
|
|
|
126
|
-
**id
|
|
126
|
+
**id** (`string`): ID of the vector to update (mutually exclusive with filter)
|
|
127
127
|
|
|
128
|
-
**filter
|
|
128
|
+
**filter** (`Record<string, any>`): Metadata filter to identify vector(s) to update (mutually exclusive with id)
|
|
129
129
|
|
|
130
|
-
**update
|
|
130
|
+
**update** (`{ vector?: number[]; metadata?: Record<string, any>; }`): Object containing the vector and/or metadata to update
|
|
131
131
|
|
|
132
132
|
Updates a vector and/or its metadata in the specified index. If both vector and metadata are provided, both will be updated. If only one is provided, only that will be updated.
|
|
133
133
|
|
|
134
|
-
### deleteVector()
|
|
134
|
+
### `deleteVector()`
|
|
135
135
|
|
|
136
|
-
**indexName
|
|
136
|
+
**indexName** (`string`): Name of the index from which to delete the vector
|
|
137
137
|
|
|
138
|
-
**id
|
|
138
|
+
**id** (`string`): ID of the vector to delete
|
|
139
139
|
|
|
140
140
|
Deletes a vector from the specified index by its ID.
|
|
141
141
|
|
|
142
|
-
### deleteVectors()
|
|
142
|
+
### `deleteVectors()`
|
|
143
143
|
|
|
144
144
|
Delete multiple vectors by IDs or by metadata filter. Either `ids` or `filter` must be provided, but not both.
|
|
145
145
|
|
|
146
|
-
**indexName
|
|
146
|
+
**indexName** (`string`): Name of the index containing the vectors to delete
|
|
147
147
|
|
|
148
|
-
**ids
|
|
148
|
+
**ids** (`string[]`): Array of vector IDs to delete (mutually exclusive with filter)
|
|
149
149
|
|
|
150
|
-
**filter
|
|
150
|
+
**filter** (`Record<string, any>`): Metadata filter to identify vectors to delete (mutually exclusive with ids)
|
|
151
151
|
|
|
152
|
-
### createPayloadIndex()
|
|
152
|
+
### `createPayloadIndex()`
|
|
153
153
|
|
|
154
154
|
Creates a payload (metadata) index on a collection field to enable efficient filtering. This is **required** for Qdrant Cloud and any Qdrant instance with `strict_mode_config = true`.
|
|
155
155
|
|
|
156
|
-
**indexName
|
|
156
|
+
**indexName** (`string`): Name of the collection to create the payload index on
|
|
157
157
|
|
|
158
|
-
**fieldName
|
|
158
|
+
**fieldName** (`string`): Name of the payload field to index
|
|
159
159
|
|
|
160
|
-
**fieldSchema
|
|
160
|
+
**fieldSchema** (`'keyword' | 'integer' | 'float' | 'geo' | 'text' | 'bool' | 'datetime' | 'uuid'`): The schema type for the payload field
|
|
161
161
|
|
|
162
|
-
**wait
|
|
162
|
+
**wait** (`boolean`): Whether to wait for the operation to complete (Default: `true`)
|
|
163
163
|
|
|
164
164
|
```typescript
|
|
165
165
|
// Create a keyword index for filtering by source
|
|
@@ -176,17 +176,17 @@ const results = await store.query({
|
|
|
176
176
|
})
|
|
177
177
|
```
|
|
178
178
|
|
|
179
|
-
### deletePayloadIndex()
|
|
179
|
+
### `deletePayloadIndex()`
|
|
180
180
|
|
|
181
181
|
Removes a payload index from a collection field.
|
|
182
182
|
|
|
183
|
-
**indexName
|
|
183
|
+
**indexName** (`string`): Name of the collection to delete the payload index from
|
|
184
184
|
|
|
185
|
-
**fieldName
|
|
185
|
+
**fieldName** (`string`): Name of the payload field index to delete
|
|
186
186
|
|
|
187
|
-
**wait
|
|
187
|
+
**wait** (`boolean`): Whether to wait for the operation to complete (Default: `true`)
|
|
188
188
|
|
|
189
|
-
## Response
|
|
189
|
+
## Response types
|
|
190
190
|
|
|
191
191
|
Query results are returned in this format:
|
|
192
192
|
|
|
@@ -199,7 +199,7 @@ interface QueryResult {
|
|
|
199
199
|
}
|
|
200
200
|
```
|
|
201
201
|
|
|
202
|
-
## Error
|
|
202
|
+
## Error handling
|
|
203
203
|
|
|
204
204
|
The store throws typed errors that can be caught:
|
|
205
205
|
|
package/dist/index.cjs
CHANGED
|
@@ -316,7 +316,7 @@ var QdrantVector = class extends vector.MastraVector {
|
|
|
316
316
|
*/
|
|
317
317
|
async upsert({ indexName, vectors, metadata, ids, vectorName }) {
|
|
318
318
|
vector.validateUpsertInput("QDRANT", vectors, metadata, ids);
|
|
319
|
-
const pointIds = ids
|
|
319
|
+
const pointIds = ids ? ids.map((id) => this.parsePointId(id)) : vectors.map(() => crypto.randomUUID());
|
|
320
320
|
if (vectorName) {
|
|
321
321
|
try {
|
|
322
322
|
await this.validateVectorName(indexName, vectorName);
|
|
@@ -345,7 +345,7 @@ var QdrantVector = class extends vector.MastraVector {
|
|
|
345
345
|
wait: true
|
|
346
346
|
});
|
|
347
347
|
}
|
|
348
|
-
return pointIds;
|
|
348
|
+
return pointIds.map(String);
|
|
349
349
|
} catch (error$1) {
|
|
350
350
|
throw new error.MastraError(
|
|
351
351
|
{
|