@mastra/turbopuffer 0.0.0-mastra-2452-core-tracing-sentry-20250507205331 → 0.0.0-mastra-auto-detect-server-20260108233416
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 +1417 -0
- package/LICENSE.md +12 -4
- package/README.md +13 -0
- package/dist/docs/README.md +31 -0
- package/dist/docs/SKILL.md +32 -0
- package/dist/docs/SOURCE_MAP.json +6 -0
- package/dist/docs/vectors/01-reference.md +108 -0
- package/dist/index.cjs +392 -55
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +387 -50
- package/dist/index.js.map +1 -0
- package/dist/vector/filter.d.ts +50 -0
- package/dist/vector/filter.d.ts.map +1 -0
- package/dist/vector/index.d.ts +91 -0
- package/dist/vector/index.d.ts.map +1 -0
- package/package.json +36 -16
- package/dist/_tsup-dts-rollup.d.cts +0 -116
- package/dist/_tsup-dts-rollup.d.ts +0 -116
- package/dist/index.d.cts +0 -2
package/LICENSE.md
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
# Apache License 2.0
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Copyright (c) 2025 Kepler Software, Inc.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@ pnpm add @mastra/turbopuffer
|
|
|
14
14
|
import { TurbopufferVector } from '@mastra/turbopuffer';
|
|
15
15
|
|
|
16
16
|
const vectorStore = new TurbopufferVector({
|
|
17
|
+
id: 'my-turbopuffer-vector',
|
|
17
18
|
apiKey: 'your-api-key',
|
|
18
19
|
baseUrl: 'https://gcp-us-central1.turbopuffer.com',
|
|
19
20
|
});
|
|
@@ -51,6 +52,18 @@ Optional:
|
|
|
51
52
|
- `compression`: Whether to compress requests and accept compressed responses (default: true)
|
|
52
53
|
- `schemaConfigForIndex`: A function that returns a Turbopuffer schema config for an index (default: undefined).
|
|
53
54
|
|
|
55
|
+
## Methods
|
|
56
|
+
|
|
57
|
+
- `createIndex({ indexName, dimension, metric? })`: Create a new namespace
|
|
58
|
+
- `upsert({ indexName, vectors, metadata?, ids? })`: Add or update vectors
|
|
59
|
+
- `query({ indexName, queryVector, topK?, filter?, includeVector? })`: Search for similar vectors
|
|
60
|
+
- `updateVector({ indexName, id?, filter?, update })`: Update a single vector by ID or metadata filter
|
|
61
|
+
- `deleteVector({ indexName, id })`: Delete a single vector by ID
|
|
62
|
+
- `deleteVectors({ indexName, ids?, filter? })`: Delete multiple vectors by IDs or metadata filter
|
|
63
|
+
- `listIndexes()`: List all namespaces
|
|
64
|
+
- `describeIndex({ indexName })`: Get namespace statistics
|
|
65
|
+
- `deleteIndex({ indexName })`: Delete a namespace
|
|
66
|
+
|
|
54
67
|
## Related Links
|
|
55
68
|
|
|
56
69
|
- [Turbopuffer Documentation](https://turbopuffer.com/docs)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @mastra/turbopuffer 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
|
+
├── vectors/ (1 files)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Version
|
|
29
|
+
|
|
30
|
+
Package: @mastra/turbopuffer
|
|
31
|
+
Version: 1.0.0-beta.3
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mastra-turbopuffer-docs
|
|
3
|
+
description: Documentation for @mastra/turbopuffer. Includes links to type definitions and readable implementation code in dist/.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @mastra/turbopuffer Documentation
|
|
7
|
+
|
|
8
|
+
> **Version**: 1.0.0-beta.3
|
|
9
|
+
> **Package**: @mastra/turbopuffer
|
|
10
|
+
|
|
11
|
+
## Quick Navigation
|
|
12
|
+
|
|
13
|
+
Use SOURCE_MAP.json to find any export:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cat docs/SOURCE_MAP.json
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Each export maps to:
|
|
20
|
+
- **types**: `.d.ts` file with JSDoc and API signatures
|
|
21
|
+
- **implementation**: `.js` chunk file with readable source
|
|
22
|
+
- **docs**: Conceptual documentation in `docs/`
|
|
23
|
+
|
|
24
|
+
## Top Exports
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
See SOURCE_MAP.json for the complete list.
|
|
29
|
+
|
|
30
|
+
## Available Topics
|
|
31
|
+
|
|
32
|
+
- [Vectors](vectors/) - 1 file(s)
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Vectors API Reference
|
|
2
|
+
|
|
3
|
+
> API reference for vectors - 1 entries
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Reference: Turbopuffer Vector Store
|
|
9
|
+
|
|
10
|
+
> Documentation for integrating Turbopuffer with Mastra, a high-performance vector database for efficient similarity search.
|
|
11
|
+
|
|
12
|
+
The TurbopufferVector class provides vector search using [Turbopuffer](https://turbopuffer.com/), a high-performance vector database optimized for RAG applications. Turbopuffer offers fast vector similarity search with advanced filtering capabilities and efficient storage management.
|
|
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
|
+
### updateVector()
|
|
43
|
+
|
|
44
|
+
Update a single vector by ID or by metadata filter. Either `id` or `filter` must be provided, but not both.
|
|
45
|
+
|
|
46
|
+
### deleteVector()
|
|
47
|
+
|
|
48
|
+
### deleteVectors()
|
|
49
|
+
|
|
50
|
+
Delete multiple vectors by IDs or by metadata filter. Either `ids` or `filter` must be provided, but not both.
|
|
51
|
+
|
|
52
|
+
## Response Types
|
|
53
|
+
|
|
54
|
+
Query results are returned in this format:
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
interface QueryResult {
|
|
58
|
+
id: string;
|
|
59
|
+
score: number;
|
|
60
|
+
metadata: Record<string, any>;
|
|
61
|
+
vector?: number[]; // Only included if includeVector is true
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Schema Configuration
|
|
66
|
+
|
|
67
|
+
The `schemaConfigForIndex` option allows you to define explicit schemas for different indexes:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
schemaConfigForIndex: (indexName: string) => {
|
|
71
|
+
// Mastra's default embedding model and index for memory messages:
|
|
72
|
+
if (indexName === "memory_messages_384") {
|
|
73
|
+
return {
|
|
74
|
+
dimensions: 384,
|
|
75
|
+
schema: {
|
|
76
|
+
thread_id: {
|
|
77
|
+
type: "string",
|
|
78
|
+
filterable: true,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
} else {
|
|
83
|
+
throw new Error(`TODO: add schema for index: ${indexName}`);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Error Handling
|
|
89
|
+
|
|
90
|
+
The store throws typed errors that can be caught:
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
try {
|
|
94
|
+
await store.query({
|
|
95
|
+
indexName: "index_name",
|
|
96
|
+
queryVector: queryVector,
|
|
97
|
+
});
|
|
98
|
+
} catch (error) {
|
|
99
|
+
if (error instanceof VectorStoreError) {
|
|
100
|
+
console.log(error.code); // 'connection_failed' | 'invalid_dimension' | etc
|
|
101
|
+
console.log(error.details); // Additional error context
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Related
|
|
107
|
+
|
|
108
|
+
- [Metadata Filters](../rag/metadata-filters)
|