@mastra/vectorize 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,102 +0,0 @@
1
- # Vectors API Reference
2
-
3
- > API reference for vectors - 1 entries
4
-
5
-
6
- ---
7
-
8
- ## Reference: Cloudflare Vector Store
9
-
10
- > Documentation for the CloudflareVector class in Mastra, which provides vector search using Cloudflare Vectorize.
11
-
12
- The CloudflareVector class provides vector search using [Cloudflare Vectorize](https://developers.cloudflare.com/vectorize/), a vector database service integrated with Cloudflare's edge network.
13
-
14
- ## Constructor Options
15
-
16
- ## Methods
17
-
18
- ### createIndex()
19
-
20
- ### upsert()
21
-
22
- ### query()
23
-
24
- ### listIndexes()
25
-
26
- Returns an array of index names as strings.
27
-
28
- ### describeIndex()
29
-
30
- Returns:
31
-
32
- ```typescript
33
- interface IndexStats {
34
- dimension: number;
35
- count: number;
36
- metric: "cosine" | "euclidean" | "dotproduct";
37
- }
38
- ```
39
-
40
- ### deleteIndex()
41
-
42
- ### createMetadataIndex()
43
-
44
- Creates an index on a metadata field to enable filtering.
45
-
46
- ### deleteMetadataIndex()
47
-
48
- Removes an index from a metadata field.
49
-
50
- ### listMetadataIndexes()
51
-
52
- Lists all metadata field indexes for an index.
53
-
54
- ### updateVector()
55
-
56
- Updates a vector or metadata for a specific ID within an index.
57
-
58
- ### deleteVector()
59
-
60
- Deletes a vector and its associated metadata for a specific ID within an index.
61
-
62
- ## Response Types
63
-
64
- Query results are returned in this format:
65
-
66
- ```typescript
67
- interface QueryResult {
68
- id: string;
69
- score: number;
70
- metadata: Record<string, any>;
71
- vector?: number[];
72
- }
73
- ```
74
-
75
- ## Error Handling
76
-
77
- The store throws typed errors that can be caught:
78
-
79
- ```typescript
80
- try {
81
- await store.query({
82
- indexName: "index_name",
83
- queryVector: queryVector,
84
- });
85
- } catch (error) {
86
- if (error instanceof VectorStoreError) {
87
- console.log(error.code); // 'connection_failed' | 'invalid_dimension' | etc
88
- console.log(error.details); // Additional error context
89
- }
90
- }
91
- ```
92
-
93
- ## Environment Variables
94
-
95
- Required environment variables:
96
-
97
- - `CLOUDFLARE_ACCOUNT_ID`: Your Cloudflare account ID
98
- - `CLOUDFLARE_API_TOKEN`: Your Cloudflare API token with Vectorize permissions
99
-
100
- ## Related
101
-
102
- - [Metadata Filters](../rag/metadata-filters)