@mastra/qdrant 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.
@@ -1,160 +0,0 @@
1
- # Vectors API Reference
2
-
3
- > API reference for vectors - 1 entries
4
-
5
-
6
- ---
7
-
8
- ## Reference: Qdrant Vector Store
9
-
10
- > Documentation for integrating Qdrant with Mastra, a vector similarity search engine for managing vectors and payloads.
11
-
12
- The QdrantVector class provides vector search using [Qdrant](https://qdrant.tech/), a vector similarity search engine.
13
- It provides a production-ready service with a convenient API to store, search, and manage vectors with additional payload and extended filtering support.
14
-
15
- ## Constructor Options
16
-
17
- ## Methods
18
-
19
- ### createIndex()
20
-
21
- #### Creating a Named Vectors Collection
22
-
23
- ```typescript
24
- // Create a collection with multiple named vector spaces
25
- await store.createIndex({
26
- indexName: "multi_modal",
27
- dimension: 768, // fallback
28
- namedVectors: {
29
- text: { size: 768, distance: "cosine" },
30
- image: { size: 512, distance: "euclidean" },
31
- },
32
- });
33
- ```
34
-
35
- ### upsert()
36
-
37
- #### Upserting into Named Vector Spaces
38
-
39
- ```typescript
40
- // Upsert into the "text" vector space
41
- await store.upsert({
42
- indexName: "multi_modal",
43
- vectors: textEmbeddings,
44
- metadata: textMetadata,
45
- vectorName: "text",
46
- });
47
-
48
- // Upsert into the "image" vector space
49
- await store.upsert({
50
- indexName: "multi_modal",
51
- vectors: imageEmbeddings,
52
- metadata: imageMetadata,
53
- vectorName: "image",
54
- });
55
- ```
56
-
57
- ### query()
58
-
59
- #### Named Vectors
60
-
61
- Qdrant supports [named vectors](https://qdrant.tech/documentation/concepts/vectors/#named-vectors), allowing multiple vector fields per collection. Use the `using` parameter to specify which named vector to query against:
62
-
63
- ```typescript
64
- const results = await store.query({
65
- indexName: "my_index",
66
- queryVector: embedding,
67
- topK: 10,
68
- using: "title_embedding", // Query against a specific named vector
69
- });
70
- ```
71
-
72
- ### listIndexes()
73
-
74
- Returns an array of index names as strings.
75
-
76
- ### describeIndex()
77
-
78
- Returns:
79
-
80
- ```typescript
81
- interface IndexStats {
82
- dimension: number;
83
- count: number;
84
- metric: "cosine" | "euclidean" | "dotproduct";
85
- }
86
- ```
87
-
88
- ### deleteIndex()
89
-
90
- ### updateVector()
91
-
92
- Update a single vector by ID or by metadata filter. Either `id` or `filter` must be provided, but not both.
93
-
94
- 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.
95
-
96
- ### deleteVector()
97
-
98
- Deletes a vector from the specified index by its ID.
99
-
100
- ### deleteVectors()
101
-
102
- Delete multiple vectors by IDs or by metadata filter. Either `ids` or `filter` must be provided, but not both.
103
-
104
- ### createPayloadIndex()
105
-
106
- 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`.
107
-
108
- ```typescript
109
- // Create a keyword index for filtering by source
110
- await store.createPayloadIndex({
111
- indexName: "my_index",
112
- fieldName: "source",
113
- fieldSchema: "keyword",
114
- });
115
-
116
- const results = await store.query({
117
- indexName: "my_index",
118
- queryVector: queryVector,
119
- filter: { source: "document-a" },
120
- });
121
- ```
122
-
123
- ### deletePayloadIndex()
124
-
125
- Removes a payload index from a collection field.
126
-
127
- ## Response Types
128
-
129
- Query results are returned in this format:
130
-
131
- ```typescript
132
- interface QueryResult {
133
- id: string;
134
- score: number;
135
- metadata: Record<string, any>;
136
- vector?: number[]; // Only included if includeVector is true
137
- }
138
- ```
139
-
140
- ## Error Handling
141
-
142
- The store throws typed errors that can be caught:
143
-
144
- ```typescript
145
- try {
146
- await store.query({
147
- indexName: "index_name",
148
- queryVector: queryVector,
149
- });
150
- } catch (error) {
151
- if (error instanceof VectorStoreError) {
152
- console.log(error.code); // 'connection_failed' | 'invalid_dimension' | etc
153
- console.log(error.details); // Additional error context
154
- }
155
- }
156
- ```
157
-
158
- ## Related
159
-
160
- - [Metadata Filters](../rag/metadata-filters)