@mastra/turbopuffer 0.0.15 → 0.1.0-alpha.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.
- package/dist/_tsup-dts-rollup.d.cts +14 -7
- package/dist/_tsup-dts-rollup.d.ts +14 -7
- package/dist/index.cjs +12 -6
- package/dist/index.js +12 -6
- package/package.json +7 -4
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { BaseFilterTranslator } from '@mastra/core/vector/filter';
|
|
2
2
|
import type { CreateIndexParams } from '@mastra/core/vector';
|
|
3
|
+
import type { DeleteIndexParams } from '@mastra/core/vector';
|
|
4
|
+
import type { DeleteVectorParams } from '@mastra/core/vector';
|
|
5
|
+
import type { DescribeIndexParams } from '@mastra/core/vector';
|
|
3
6
|
import type { Filters } from '@turbopuffer/turbopuffer';
|
|
4
7
|
import type { IndexStats } from '@mastra/core/vector';
|
|
5
8
|
import { MastraVector } from '@mastra/core/vector';
|
|
@@ -7,6 +10,7 @@ import type { OperatorSupport } from '@mastra/core/vector/filter';
|
|
|
7
10
|
import type { QueryResult } from '@mastra/core/vector';
|
|
8
11
|
import type { QueryVectorParams } from '@mastra/core/vector';
|
|
9
12
|
import type { Schema } from '@turbopuffer/turbopuffer';
|
|
13
|
+
import type { UpdateVectorParams } from '@mastra/core/vector';
|
|
10
14
|
import type { UpsertVectorParams } from '@mastra/core/vector';
|
|
11
15
|
import type { VectorFilter } from '@mastra/core/vector/filter';
|
|
12
16
|
|
|
@@ -62,8 +66,14 @@ declare class TurbopufferVector extends MastraVector {
|
|
|
62
66
|
upsert({ indexName, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
|
|
63
67
|
query({ indexName, queryVector, topK, filter, includeVector }: QueryVectorParams): Promise<QueryResult[]>;
|
|
64
68
|
listIndexes(): Promise<string[]>;
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Retrieves statistics about a vector index.
|
|
71
|
+
*
|
|
72
|
+
* @param {string} indexName - The name of the index to describe
|
|
73
|
+
* @returns A promise that resolves to the index statistics including dimension, count and metric
|
|
74
|
+
*/
|
|
75
|
+
describeIndex({ indexName }: DescribeIndexParams): Promise<IndexStats>;
|
|
76
|
+
deleteIndex({ indexName }: DeleteIndexParams): Promise<void>;
|
|
67
77
|
/**
|
|
68
78
|
* Updates a vector by its ID with the provided vector and/or metadata.
|
|
69
79
|
* @param indexName - The name of the index containing the vector.
|
|
@@ -74,10 +84,7 @@ declare class TurbopufferVector extends MastraVector {
|
|
|
74
84
|
* @returns A promise that resolves when the update is complete.
|
|
75
85
|
* @throws Will throw an error if no updates are provided or if the update operation fails.
|
|
76
86
|
*/
|
|
77
|
-
updateVector(indexName
|
|
78
|
-
vector?: number[];
|
|
79
|
-
metadata?: Record<string, any>;
|
|
80
|
-
}): Promise<void>;
|
|
87
|
+
updateVector({ indexName, id, update }: UpdateVectorParams): Promise<void>;
|
|
81
88
|
/**
|
|
82
89
|
* Deletes a vector by its ID.
|
|
83
90
|
* @param indexName - The name of the index containing the vector.
|
|
@@ -85,7 +92,7 @@ declare class TurbopufferVector extends MastraVector {
|
|
|
85
92
|
* @returns A promise that resolves when the deletion is complete.
|
|
86
93
|
* @throws Will throw an error if the deletion operation fails.
|
|
87
94
|
*/
|
|
88
|
-
deleteVector(indexName
|
|
95
|
+
deleteVector({ indexName, id }: DeleteVectorParams): Promise<void>;
|
|
89
96
|
}
|
|
90
97
|
export { TurbopufferVector }
|
|
91
98
|
export { TurbopufferVector as TurbopufferVector_alias_1 }
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { BaseFilterTranslator } from '@mastra/core/vector/filter';
|
|
2
2
|
import type { CreateIndexParams } from '@mastra/core/vector';
|
|
3
|
+
import type { DeleteIndexParams } from '@mastra/core/vector';
|
|
4
|
+
import type { DeleteVectorParams } from '@mastra/core/vector';
|
|
5
|
+
import type { DescribeIndexParams } from '@mastra/core/vector';
|
|
3
6
|
import type { Filters } from '@turbopuffer/turbopuffer';
|
|
4
7
|
import type { IndexStats } from '@mastra/core/vector';
|
|
5
8
|
import { MastraVector } from '@mastra/core/vector';
|
|
@@ -7,6 +10,7 @@ import type { OperatorSupport } from '@mastra/core/vector/filter';
|
|
|
7
10
|
import type { QueryResult } from '@mastra/core/vector';
|
|
8
11
|
import type { QueryVectorParams } from '@mastra/core/vector';
|
|
9
12
|
import type { Schema } from '@turbopuffer/turbopuffer';
|
|
13
|
+
import type { UpdateVectorParams } from '@mastra/core/vector';
|
|
10
14
|
import type { UpsertVectorParams } from '@mastra/core/vector';
|
|
11
15
|
import type { VectorFilter } from '@mastra/core/vector/filter';
|
|
12
16
|
|
|
@@ -62,8 +66,14 @@ declare class TurbopufferVector extends MastraVector {
|
|
|
62
66
|
upsert({ indexName, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
|
|
63
67
|
query({ indexName, queryVector, topK, filter, includeVector }: QueryVectorParams): Promise<QueryResult[]>;
|
|
64
68
|
listIndexes(): Promise<string[]>;
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Retrieves statistics about a vector index.
|
|
71
|
+
*
|
|
72
|
+
* @param {string} indexName - The name of the index to describe
|
|
73
|
+
* @returns A promise that resolves to the index statistics including dimension, count and metric
|
|
74
|
+
*/
|
|
75
|
+
describeIndex({ indexName }: DescribeIndexParams): Promise<IndexStats>;
|
|
76
|
+
deleteIndex({ indexName }: DeleteIndexParams): Promise<void>;
|
|
67
77
|
/**
|
|
68
78
|
* Updates a vector by its ID with the provided vector and/or metadata.
|
|
69
79
|
* @param indexName - The name of the index containing the vector.
|
|
@@ -74,10 +84,7 @@ declare class TurbopufferVector extends MastraVector {
|
|
|
74
84
|
* @returns A promise that resolves when the update is complete.
|
|
75
85
|
* @throws Will throw an error if no updates are provided or if the update operation fails.
|
|
76
86
|
*/
|
|
77
|
-
updateVector(indexName
|
|
78
|
-
vector?: number[];
|
|
79
|
-
metadata?: Record<string, any>;
|
|
80
|
-
}): Promise<void>;
|
|
87
|
+
updateVector({ indexName, id, update }: UpdateVectorParams): Promise<void>;
|
|
81
88
|
/**
|
|
82
89
|
* Deletes a vector by its ID.
|
|
83
90
|
* @param indexName - The name of the index containing the vector.
|
|
@@ -85,7 +92,7 @@ declare class TurbopufferVector extends MastraVector {
|
|
|
85
92
|
* @returns A promise that resolves when the deletion is complete.
|
|
86
93
|
* @throws Will throw an error if the deletion operation fails.
|
|
87
94
|
*/
|
|
88
|
-
deleteVector(indexName
|
|
95
|
+
deleteVector({ indexName, id }: DeleteVectorParams): Promise<void>;
|
|
89
96
|
}
|
|
90
97
|
export { TurbopufferVector }
|
|
91
98
|
export { TurbopufferVector as TurbopufferVector_alias_1 }
|
package/dist/index.cjs
CHANGED
|
@@ -303,7 +303,13 @@ var TurbopufferVector = class extends vector.MastraVector {
|
|
|
303
303
|
throw new Error(`Failed to list Turbopuffer namespaces: ${error}`);
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
|
|
306
|
+
/**
|
|
307
|
+
* Retrieves statistics about a vector index.
|
|
308
|
+
*
|
|
309
|
+
* @param {string} indexName - The name of the index to describe
|
|
310
|
+
* @returns A promise that resolves to the index statistics including dimension, count and metric
|
|
311
|
+
*/
|
|
312
|
+
async describeIndex({ indexName }) {
|
|
307
313
|
try {
|
|
308
314
|
const namespace = this.client.namespace(indexName);
|
|
309
315
|
const metadata = await namespace.metadata();
|
|
@@ -322,7 +328,7 @@ var TurbopufferVector = class extends vector.MastraVector {
|
|
|
322
328
|
throw new Error(`Failed to describe Turbopuffer namespace ${indexName}: ${error}`);
|
|
323
329
|
}
|
|
324
330
|
}
|
|
325
|
-
async deleteIndex(indexName) {
|
|
331
|
+
async deleteIndex({ indexName }) {
|
|
326
332
|
try {
|
|
327
333
|
const namespace = this.client.namespace(indexName);
|
|
328
334
|
await namespace.deleteAll();
|
|
@@ -341,7 +347,7 @@ var TurbopufferVector = class extends vector.MastraVector {
|
|
|
341
347
|
* @returns A promise that resolves when the update is complete.
|
|
342
348
|
* @throws Will throw an error if no updates are provided or if the update operation fails.
|
|
343
349
|
*/
|
|
344
|
-
async updateVector(indexName, id,
|
|
350
|
+
async updateVector({ indexName, id, update }) {
|
|
345
351
|
try {
|
|
346
352
|
const namespace = this.client.namespace(indexName);
|
|
347
353
|
const createIndex = this.createIndexCache.get(indexName);
|
|
@@ -350,8 +356,8 @@ var TurbopufferVector = class extends vector.MastraVector {
|
|
|
350
356
|
}
|
|
351
357
|
const distanceMetric = createIndex.tpufDistanceMetric;
|
|
352
358
|
const record = { id };
|
|
353
|
-
if (
|
|
354
|
-
if (
|
|
359
|
+
if (update.vector) record.vector = update.vector;
|
|
360
|
+
if (update.metadata) record.attributes = update.metadata;
|
|
355
361
|
await namespace.upsert({
|
|
356
362
|
vectors: [record],
|
|
357
363
|
distance_metric: distanceMetric
|
|
@@ -367,7 +373,7 @@ var TurbopufferVector = class extends vector.MastraVector {
|
|
|
367
373
|
* @returns A promise that resolves when the deletion is complete.
|
|
368
374
|
* @throws Will throw an error if the deletion operation fails.
|
|
369
375
|
*/
|
|
370
|
-
async deleteVector(indexName, id) {
|
|
376
|
+
async deleteVector({ indexName, id }) {
|
|
371
377
|
try {
|
|
372
378
|
const namespace = this.client.namespace(indexName);
|
|
373
379
|
await namespace.delete({ ids: [id] });
|
package/dist/index.js
CHANGED
|
@@ -301,7 +301,13 @@ var TurbopufferVector = class extends MastraVector {
|
|
|
301
301
|
throw new Error(`Failed to list Turbopuffer namespaces: ${error}`);
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
|
-
|
|
304
|
+
/**
|
|
305
|
+
* Retrieves statistics about a vector index.
|
|
306
|
+
*
|
|
307
|
+
* @param {string} indexName - The name of the index to describe
|
|
308
|
+
* @returns A promise that resolves to the index statistics including dimension, count and metric
|
|
309
|
+
*/
|
|
310
|
+
async describeIndex({ indexName }) {
|
|
305
311
|
try {
|
|
306
312
|
const namespace = this.client.namespace(indexName);
|
|
307
313
|
const metadata = await namespace.metadata();
|
|
@@ -320,7 +326,7 @@ var TurbopufferVector = class extends MastraVector {
|
|
|
320
326
|
throw new Error(`Failed to describe Turbopuffer namespace ${indexName}: ${error}`);
|
|
321
327
|
}
|
|
322
328
|
}
|
|
323
|
-
async deleteIndex(indexName) {
|
|
329
|
+
async deleteIndex({ indexName }) {
|
|
324
330
|
try {
|
|
325
331
|
const namespace = this.client.namespace(indexName);
|
|
326
332
|
await namespace.deleteAll();
|
|
@@ -339,7 +345,7 @@ var TurbopufferVector = class extends MastraVector {
|
|
|
339
345
|
* @returns A promise that resolves when the update is complete.
|
|
340
346
|
* @throws Will throw an error if no updates are provided or if the update operation fails.
|
|
341
347
|
*/
|
|
342
|
-
async updateVector(indexName, id,
|
|
348
|
+
async updateVector({ indexName, id, update }) {
|
|
343
349
|
try {
|
|
344
350
|
const namespace = this.client.namespace(indexName);
|
|
345
351
|
const createIndex = this.createIndexCache.get(indexName);
|
|
@@ -348,8 +354,8 @@ var TurbopufferVector = class extends MastraVector {
|
|
|
348
354
|
}
|
|
349
355
|
const distanceMetric = createIndex.tpufDistanceMetric;
|
|
350
356
|
const record = { id };
|
|
351
|
-
if (
|
|
352
|
-
if (
|
|
357
|
+
if (update.vector) record.vector = update.vector;
|
|
358
|
+
if (update.metadata) record.attributes = update.metadata;
|
|
353
359
|
await namespace.upsert({
|
|
354
360
|
vectors: [record],
|
|
355
361
|
distance_metric: distanceMetric
|
|
@@ -365,7 +371,7 @@ var TurbopufferVector = class extends MastraVector {
|
|
|
365
371
|
* @returns A promise that resolves when the deletion is complete.
|
|
366
372
|
* @throws Will throw an error if the deletion operation fails.
|
|
367
373
|
*/
|
|
368
|
-
async deleteVector(indexName, id) {
|
|
374
|
+
async deleteVector({ indexName, id }) {
|
|
369
375
|
try {
|
|
370
376
|
const namespace = this.client.namespace(indexName);
|
|
371
377
|
await namespace.delete({ ids: [id] });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/turbopuffer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
4
|
"description": "Turbopuffer vector store provider for Mastra",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@turbopuffer/turbopuffer": "^0.6.4"
|
|
27
|
-
"@mastra/core": "^0.9.4"
|
|
26
|
+
"@turbopuffer/turbopuffer": "^0.6.4"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
30
29
|
"@microsoft/api-extractor": "^7.52.5",
|
|
@@ -34,7 +33,11 @@
|
|
|
34
33
|
"tsup": "^8.4.0",
|
|
35
34
|
"typescript": "^5.8.2",
|
|
36
35
|
"vitest": "^3.1.2",
|
|
37
|
-
"@internal/lint": "0.0.5"
|
|
36
|
+
"@internal/lint": "0.0.5",
|
|
37
|
+
"@mastra/core": "0.10.0-alpha.1"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@mastra/core": "^0.9.4"
|
|
38
41
|
},
|
|
39
42
|
"scripts": {
|
|
40
43
|
"build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
|