@mastra/upstash 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,34 +1,63 @@
1
- # Vectors API Reference
2
-
3
- > API reference for vectors - 1 entries
4
-
5
-
6
- ---
7
-
8
- ## Reference: Upstash Vector Store
9
-
10
- > Documentation for the UpstashVector class in Mastra, which provides vector search using Upstash Vector.
1
+ # Upstash Vector Store
11
2
 
12
3
  The UpstashVector class provides vector search using [Upstash Vector](https://upstash.com/vector), a serverless vector database service that provides vector similarity search with metadata filtering capabilities and hybrid search support.
13
4
 
14
5
  ## Constructor Options
15
6
 
7
+ **url:** (`string`): Upstash Vector database URL
8
+
9
+ **token:** (`string`): Upstash Vector API token
10
+
16
11
  ## Methods
17
12
 
18
13
  ### createIndex()
19
14
 
20
15
  Note: This method is a no-op for Upstash as indexes are created automatically.
21
16
 
17
+ **indexName:** (`string`): Name of the index to create
18
+
19
+ **dimension:** (`number`): Vector dimension (must match your embedding model)
20
+
21
+ **metric?:** (`'cosine' | 'euclidean' | 'dotproduct'`): Distance metric for similarity search (Default: `cosine`)
22
+
22
23
  ### upsert()
23
24
 
25
+ **indexName:** (`string`): Name of the index to upsert into
26
+
27
+ **vectors:** (`number[][]`): Array of embedding vectors
28
+
29
+ **sparseVectors?:** (`{ indices: number[], values: number[] }[]`): Array of sparse vectors for hybrid search. Each sparse vector must have matching indices and values arrays.
30
+
31
+ **metadata?:** (`Record<string, any>[]`): Metadata for each vector
32
+
33
+ **ids?:** (`string[]`): Optional vector IDs (auto-generated if not provided)
34
+
24
35
  ### query()
25
36
 
37
+ **indexName:** (`string`): Name of the index to query
38
+
39
+ **queryVector:** (`number[]`): Query vector to find similar vectors
40
+
41
+ **sparseVector?:** (`{ indices: number[], values: number[] }`): Optional sparse vector for hybrid search. Must have matching indices and values arrays.
42
+
43
+ **topK?:** (`number`): Number of results to return (Default: `10`)
44
+
45
+ **filter?:** (`Record<string, any>`): Metadata filters for the query
46
+
47
+ **includeVector?:** (`boolean`): Whether to include vectors in the results (Default: `false`)
48
+
49
+ **fusionAlgorithm?:** (`FusionAlgorithm`): Algorithm used to combine dense and sparse search results in hybrid search (e.g., RRF - Reciprocal Rank Fusion)
50
+
51
+ **queryMode?:** (`QueryMode`): Search mode: 'DENSE' for dense-only, 'SPARSE' for sparse-only, or 'HYBRID' for combined search
52
+
26
53
  ### listIndexes()
27
54
 
28
55
  Returns an array of index names (namespaces) as strings.
29
56
 
30
57
  ### describeIndex()
31
58
 
59
+ **indexName:** (`string`): Name of the index to describe
60
+
32
61
  Returns:
33
62
 
34
63
  ```typescript
@@ -41,8 +70,16 @@ interface IndexStats {
41
70
 
42
71
  ### deleteIndex()
43
72
 
73
+ **indexName:** (`string`): Name of the index (namespace) to delete
74
+
44
75
  ### updateVector()
45
76
 
77
+ **indexName:** (`string`): Name of the index to update
78
+
79
+ **id:** (`string`): ID of the item to update
80
+
81
+ **update:** (`object`): Update object containing vector, sparse vector, and/or metadata
82
+
46
83
  The `update` object can have the following properties:
47
84
 
48
85
  - `vector` (optional): An array of numbers representing the new dense vector.
@@ -51,6 +88,10 @@ The `update` object can have the following properties:
51
88
 
52
89
  ### deleteVector()
53
90
 
91
+ **indexName:** (`string`): Name of the index from which to delete the item
92
+
93
+ **id:** (`string`): ID of the item to delete
94
+
54
95
  Attempts to delete an item by its ID from the specified index. Logs an error message if the deletion fails.
55
96
 
56
97
  ## Hybrid Vector Search
@@ -187,13 +228,33 @@ Embeddings are numeric vectors used by memory's `semanticRecall` to retrieve rel
187
228
 
188
229
  Install `fastembed` to get started:
189
230
 
231
+ **npm**:
232
+
233
+ ```bash
234
+ npm install @mastra/fastembed@latest
235
+ ```
236
+
237
+ **pnpm**:
238
+
239
+ ```bash
240
+ pnpm add @mastra/fastembed@latest
241
+ ```
242
+
243
+ **Yarn**:
244
+
190
245
  ```bash
191
- npm install @mastra/fastembed@beta
246
+ yarn add @mastra/fastembed@latest
247
+ ```
248
+
249
+ **Bun**:
250
+
251
+ ```bash
252
+ bun add @mastra/fastembed@latest
192
253
  ```
193
254
 
194
255
  Add the following to your agent:
195
256
 
196
- ```typescript title="src/mastra/agents/example-upstash-agent.ts"
257
+ ```typescript
197
258
  import { Memory } from "@mastra/memory";
198
259
  import { Agent } from "@mastra/core/agent";
199
260
  import { UpstashStore, UpstashVector } from "@mastra/upstash";
@@ -230,4 +291,4 @@ export const upstashAgent = new Agent({
230
291
 
231
292
  ## Related
232
293
 
233
- - [Metadata Filters](../rag/metadata-filters)
294
+ - [Metadata Filters](https://mastra.ai/reference/rag/metadata-filters)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/upstash",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Upstash provider for Mastra - includes both vector and db storage capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -20,22 +20,22 @@
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@upstash/redis": "^1.36.0",
23
+ "@upstash/redis": "^1.36.2",
24
24
  "@upstash/vector": "^1.2.2"
25
25
  },
26
26
  "devDependencies": {
27
- "@types/node": "22.13.17",
27
+ "@types/node": "22.19.7",
28
28
  "@vitest/coverage-v8": "4.0.12",
29
29
  "@vitest/ui": "4.0.12",
30
- "dotenv": "^17.0.0",
30
+ "dotenv": "^17.2.3",
31
31
  "eslint": "^9.37.0",
32
- "tsup": "^8.5.0",
32
+ "tsup": "^8.5.1",
33
33
  "typescript": "^5.9.3",
34
34
  "vitest": "4.0.16",
35
- "@internal/lint": "0.0.54",
36
- "@mastra/core": "1.0.0",
37
- "@internal/storage-test-utils": "0.0.50",
38
- "@internal/types-builder": "0.0.29"
35
+ "@internal/lint": "0.0.58",
36
+ "@internal/storage-test-utils": "0.0.54",
37
+ "@internal/types-builder": "0.0.33",
38
+ "@mastra/core": "1.3.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@mastra/core": ">=1.0.0-0 <2.0.0-0"
@@ -62,7 +62,6 @@
62
62
  "posttest": "docker compose down",
63
63
  "lint": "eslint .",
64
64
  "build:lib": "tsup --silent --config tsup.config.ts",
65
- "build:docs": "pnpx tsx ../../scripts/generate-package-docs.ts stores/upstash",
66
65
  "build:watch": "tsup --watch --silent --config tsup.config.ts"
67
66
  }
68
67
  }
@@ -1,34 +0,0 @@
1
- # @mastra/upstash Documentation
2
-
3
- > Embedded documentation for coding agents
4
-
5
- ## Quick Start
6
-
7
- ```bash
8
- # Read the skill overview
9
- cat docs/SKILL.md
10
-
11
- # Get the source map
12
- cat docs/SOURCE_MAP.json
13
-
14
- # Read topic documentation
15
- cat docs/<topic>/01-overview.md
16
- ```
17
-
18
- ## Structure
19
-
20
- ```
21
- docs/
22
- ├── SKILL.md # Entry point
23
- ├── README.md # This file
24
- ├── SOURCE_MAP.json # Export index
25
- ├── memory/ (1 files)
26
- ├── rag/ (2 files)
27
- ├── storage/ (1 files)
28
- ├── vectors/ (1 files)
29
- ```
30
-
31
- ## Version
32
-
33
- Package: @mastra/upstash
34
- Version: 1.0.0