@mastra/qdrant 1.1.3-alpha.0 → 1.1.3
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/README.md +14 -94
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Vector store implementation for Qdrant using the official @qdrant/js-client-rest
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
8
|
+
npm install @mastra/qdrant
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
@@ -20,17 +20,20 @@ const vectorStore = new QdrantVector({
|
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
// Create a new collection
|
|
23
|
-
await vectorStore.createIndex({ indexName: 'myCollection', dimension:
|
|
23
|
+
await vectorStore.createIndex({ indexName: 'myCollection', dimension: 3, metric: 'cosine' });
|
|
24
24
|
|
|
25
25
|
// Add vectors
|
|
26
|
-
const vectors = [
|
|
26
|
+
const vectors = [
|
|
27
|
+
[0.1, 0.2, 0.3],
|
|
28
|
+
[0.3, 0.4, 0.5],
|
|
29
|
+
];
|
|
27
30
|
const metadata = [{ text: 'doc1' }, { text: 'doc2' }];
|
|
28
31
|
const ids = await vectorStore.upsert({ indexName: 'myCollection', vectors, metadata });
|
|
29
32
|
|
|
30
33
|
// Query vectors
|
|
31
34
|
const results = await vectorStore.query({
|
|
32
35
|
indexName: 'myCollection',
|
|
33
|
-
queryVector: [0.1, 0.2,
|
|
36
|
+
queryVector: [0.1, 0.2, 0.3],
|
|
34
37
|
topK: 10,
|
|
35
38
|
filter: { text: { $eq: 'doc1' } }, // optional filter
|
|
36
39
|
includeVector: false,
|
|
@@ -39,103 +42,20 @@ const results = await vectorStore.query({
|
|
|
39
42
|
// Query with named vectors (for collections with multiple vector fields)
|
|
40
43
|
const namedResults = await vectorStore.query({
|
|
41
44
|
indexName: 'myCollection',
|
|
42
|
-
queryVector: [0.1, 0.2,
|
|
45
|
+
queryVector: [0.1, 0.2, 0.3],
|
|
43
46
|
topK: 10,
|
|
44
47
|
using: 'title_embedding', // specify which named vector to query
|
|
45
48
|
});
|
|
46
49
|
```
|
|
47
50
|
|
|
48
|
-
##
|
|
51
|
+
## Documentation
|
|
49
52
|
|
|
50
|
-
|
|
53
|
+
- [@mastra/qdrant documentation](https://mastra.ai/reference/vectors/qdrant)
|
|
51
54
|
|
|
52
|
-
|
|
53
|
-
// Create a collection with multiple named vector spaces
|
|
54
|
-
await vectorStore.createIndex({
|
|
55
|
-
indexName: 'multi_modal',
|
|
56
|
-
dimension: 768, // fallback
|
|
57
|
-
namedVectors: {
|
|
58
|
-
text: { size: 768, distance: 'cosine' },
|
|
59
|
-
image: { size: 512, distance: 'euclidean' },
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// Upsert into specific vector spaces
|
|
64
|
-
await vectorStore.upsert({
|
|
65
|
-
indexName: 'multi_modal',
|
|
66
|
-
vectors: textEmbeddings,
|
|
67
|
-
metadata: [{ type: 'text' }],
|
|
68
|
-
vectorName: 'text', // target the text vector space
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
await vectorStore.upsert({
|
|
72
|
-
indexName: 'multi_modal',
|
|
73
|
-
vectors: imageEmbeddings,
|
|
74
|
-
metadata: [{ type: 'image' }],
|
|
75
|
-
vectorName: 'image', // target the image vector space
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
// Query specific vector spaces
|
|
79
|
-
const textResults = await vectorStore.query({
|
|
80
|
-
indexName: 'multi_modal',
|
|
81
|
-
queryVector: textQuery,
|
|
82
|
-
using: 'text',
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
const imageResults = await vectorStore.query({
|
|
86
|
-
indexName: 'multi_modal',
|
|
87
|
-
queryVector: imageQuery,
|
|
88
|
-
using: 'image',
|
|
89
|
-
});
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## Configuration
|
|
93
|
-
|
|
94
|
-
Required:
|
|
95
|
-
|
|
96
|
-
- `id`: Unique identifier for this vector store instance
|
|
97
|
-
- `url`: URL of your Qdrant instance
|
|
98
|
-
|
|
99
|
-
Optional:
|
|
100
|
-
|
|
101
|
-
- `apiKey`: API key for authentication
|
|
102
|
-
- `https`: Whether to use HTTPS (default: false)
|
|
103
|
-
|
|
104
|
-
## Features
|
|
105
|
-
|
|
106
|
-
- Vector similarity search with Cosine, Euclidean, and Dot Product metrics
|
|
107
|
-
- [Named vectors](https://qdrant.tech/documentation/concepts/vectors/#named-vectors) support for collections with multiple vector fields
|
|
108
|
-
- Automatic batching for large upserts (256 vectors per batch)
|
|
109
|
-
- Built-in telemetry support
|
|
110
|
-
- Metadata filtering
|
|
111
|
-
- Optional vector inclusion in query results
|
|
112
|
-
- Automatic UUID generation for vectors
|
|
113
|
-
- Support for both local and cloud deployments
|
|
114
|
-
- Built on top of @qdrant/js-client-rest SDK
|
|
115
|
-
|
|
116
|
-
## Distance Metrics
|
|
117
|
-
|
|
118
|
-
The following distance metrics are supported:
|
|
119
|
-
|
|
120
|
-
- `cosine` → Cosine distance
|
|
121
|
-
- `euclidean` → Euclidean distance
|
|
122
|
-
- `dotproduct` → Dot product
|
|
123
|
-
|
|
124
|
-
## Methods
|
|
55
|
+
## Changelog
|
|
125
56
|
|
|
126
|
-
|
|
127
|
-
- `upsert({ indexName, vectors, metadata?, ids?, vectorName? })`: Add or update vectors (supports named vectors)
|
|
128
|
-
- `query({ indexName, queryVector, topK?, filter?, includeVector?, using? })`: Search for similar vectors
|
|
129
|
-
- `updateVector({ indexName, id?, filter?, update })`: Update a single vector by ID or metadata filter
|
|
130
|
-
- `deleteVector({ indexName, id })`: Delete a single vector by ID
|
|
131
|
-
- `deleteVectors({ indexName, ids?, filter? })`: Delete multiple vectors by IDs or metadata filter
|
|
132
|
-
- `createPayloadIndex({ indexName, fieldName, fieldSchema, wait? })`: Create a payload index for filtering
|
|
133
|
-
- `deletePayloadIndex({ indexName, fieldName, wait? })`: Delete a payload index
|
|
134
|
-
- `listIndexes()`: List all collections
|
|
135
|
-
- `describeIndex(indexName)`: Get collection statistics
|
|
136
|
-
- `deleteIndex(indexName)`: Delete a collection
|
|
57
|
+
See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/stores/qdrant/CHANGELOG.md) for version history and release notes.
|
|
137
58
|
|
|
138
|
-
##
|
|
59
|
+
## Support
|
|
139
60
|
|
|
140
|
-
|
|
141
|
-
- [Qdrant REST API Reference](https://qdrant.github.io/qdrant/redoc/index.html)
|
|
61
|
+
We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
|
package/dist/docs/SKILL.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/qdrant",
|
|
3
|
-
"version": "1.1.3
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Qdrant vector store provider for Mastra",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"tsx": "^4.23.1",
|
|
32
32
|
"typescript": "^7.0.2",
|
|
33
33
|
"vitest": "4.1.10",
|
|
34
|
-
"@internal/
|
|
35
|
-
"@internal/
|
|
36
|
-
"@internal/storage-test-utils": "0.0.
|
|
37
|
-
"@mastra/core": "1.64.0
|
|
34
|
+
"@internal/types-builder": "0.0.105",
|
|
35
|
+
"@internal/lint": "0.0.130",
|
|
36
|
+
"@internal/storage-test-utils": "0.0.126",
|
|
37
|
+
"@mastra/core": "1.64.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@mastra/core": ">=1.0.0-0 <2.0.0-0"
|