@mastra/turbopuffer 0.10.4-alpha.0 → 0.11.0
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 +17 -4
- package/dist/_tsup-dts-rollup.d.ts +17 -4
- package/dist/index.cjs +7 -1
- package/dist/index.js +7 -1
- package/package.json +5 -5
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { BaseFilterTranslator } from '@mastra/core/vector/filter';
|
|
2
|
+
import type { BlacklistedRootOperators } from '@mastra/core/vector/filter';
|
|
2
3
|
import type { CreateIndexParams } from '@mastra/core/vector';
|
|
3
4
|
import type { DeleteIndexParams } from '@mastra/core/vector';
|
|
4
5
|
import type { DeleteVectorParams } from '@mastra/core/vector';
|
|
5
6
|
import type { DescribeIndexParams } from '@mastra/core/vector';
|
|
6
7
|
import type { Filters } from '@turbopuffer/turbopuffer';
|
|
7
8
|
import type { IndexStats } from '@mastra/core/vector';
|
|
9
|
+
import type { LogicalOperatorValueMap } from '@mastra/core/vector/filter';
|
|
8
10
|
import { MastraVector } from '@mastra/core/vector';
|
|
9
11
|
import type { OperatorSupport } from '@mastra/core/vector/filter';
|
|
12
|
+
import type { OperatorValueMap } from '@mastra/core/vector/filter';
|
|
10
13
|
import type { QueryResult } from '@mastra/core/vector';
|
|
11
14
|
import type { QueryVectorParams } from '@mastra/core/vector';
|
|
12
15
|
import type { Schema } from '@turbopuffer/turbopuffer';
|
|
@@ -14,13 +17,15 @@ import type { UpdateVectorParams } from '@mastra/core/vector';
|
|
|
14
17
|
import type { UpsertVectorParams } from '@mastra/core/vector';
|
|
15
18
|
import type { VectorFilter } from '@mastra/core/vector/filter';
|
|
16
19
|
|
|
20
|
+
declare type TurbopufferBlacklistedRootOperators = BlacklistedRootOperators | '$nor' | '$not';
|
|
21
|
+
|
|
17
22
|
/**
|
|
18
23
|
* Translator for converting Mastra filters to Turbopuffer format
|
|
19
24
|
*
|
|
20
25
|
* Mastra filters: { field: { $gt: 10 } }
|
|
21
26
|
* Turbopuffer filters: ["And", [["field", "Gt", 10]]]
|
|
22
27
|
*/
|
|
23
|
-
export declare class TurbopufferFilterTranslator extends BaseFilterTranslator {
|
|
28
|
+
export declare class TurbopufferFilterTranslator extends BaseFilterTranslator<TurbopufferVectorFilter, Filters | undefined> {
|
|
24
29
|
protected getSupportedOperators(): OperatorSupport;
|
|
25
30
|
/**
|
|
26
31
|
* Map Mastra operators to Turbopuffer operators
|
|
@@ -29,7 +34,7 @@ export declare class TurbopufferFilterTranslator extends BaseFilterTranslator {
|
|
|
29
34
|
/**
|
|
30
35
|
* Convert the Mastra filter to Turbopuffer format
|
|
31
36
|
*/
|
|
32
|
-
translate(filter?:
|
|
37
|
+
translate(filter?: TurbopufferVectorFilter): Filters | undefined;
|
|
33
38
|
/**
|
|
34
39
|
* Recursively translate a filter node
|
|
35
40
|
*/
|
|
@@ -56,7 +61,13 @@ export declare class TurbopufferFilterTranslator extends BaseFilterTranslator {
|
|
|
56
61
|
protected normalizeArrayValues(values: any[]): any[];
|
|
57
62
|
}
|
|
58
63
|
|
|
59
|
-
declare
|
|
64
|
+
declare type TurbopufferLogicalOperatorValueMap = Omit<LogicalOperatorValueMap, '$nor' | '$not'>;
|
|
65
|
+
|
|
66
|
+
declare type TurbopufferOperatorValueMap = Omit<OperatorValueMap, '$regex' | '$options' | '$elemMatch'>;
|
|
67
|
+
|
|
68
|
+
declare type TurbopufferQueryVectorParams = QueryVectorParams<TurbopufferVectorFilter>;
|
|
69
|
+
|
|
70
|
+
declare class TurbopufferVector extends MastraVector<TurbopufferVectorFilter> {
|
|
60
71
|
private client;
|
|
61
72
|
private filterTranslator;
|
|
62
73
|
private createIndexCache;
|
|
@@ -64,7 +75,7 @@ declare class TurbopufferVector extends MastraVector {
|
|
|
64
75
|
constructor(opts: TurbopufferVectorOptions);
|
|
65
76
|
createIndex({ indexName, dimension, metric }: CreateIndexParams): Promise<void>;
|
|
66
77
|
upsert({ indexName, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
|
|
67
|
-
query({ indexName, queryVector, topK, filter, includeVector }:
|
|
78
|
+
query({ indexName, queryVector, topK, filter, includeVector, }: TurbopufferQueryVectorParams): Promise<QueryResult[]>;
|
|
68
79
|
listIndexes(): Promise<string[]>;
|
|
69
80
|
/**
|
|
70
81
|
* Retrieves statistics about a vector index.
|
|
@@ -97,6 +108,8 @@ declare class TurbopufferVector extends MastraVector {
|
|
|
97
108
|
export { TurbopufferVector }
|
|
98
109
|
export { TurbopufferVector as TurbopufferVector_alias_1 }
|
|
99
110
|
|
|
111
|
+
export declare type TurbopufferVectorFilter = VectorFilter<keyof TurbopufferOperatorValueMap, TurbopufferOperatorValueMap, TurbopufferLogicalOperatorValueMap, TurbopufferBlacklistedRootOperators>;
|
|
112
|
+
|
|
100
113
|
declare interface TurbopufferVectorOptions {
|
|
101
114
|
/** The API key to authenticate with. */
|
|
102
115
|
apiKey: string;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { BaseFilterTranslator } from '@mastra/core/vector/filter';
|
|
2
|
+
import type { BlacklistedRootOperators } from '@mastra/core/vector/filter';
|
|
2
3
|
import type { CreateIndexParams } from '@mastra/core/vector';
|
|
3
4
|
import type { DeleteIndexParams } from '@mastra/core/vector';
|
|
4
5
|
import type { DeleteVectorParams } from '@mastra/core/vector';
|
|
5
6
|
import type { DescribeIndexParams } from '@mastra/core/vector';
|
|
6
7
|
import type { Filters } from '@turbopuffer/turbopuffer';
|
|
7
8
|
import type { IndexStats } from '@mastra/core/vector';
|
|
9
|
+
import type { LogicalOperatorValueMap } from '@mastra/core/vector/filter';
|
|
8
10
|
import { MastraVector } from '@mastra/core/vector';
|
|
9
11
|
import type { OperatorSupport } from '@mastra/core/vector/filter';
|
|
12
|
+
import type { OperatorValueMap } from '@mastra/core/vector/filter';
|
|
10
13
|
import type { QueryResult } from '@mastra/core/vector';
|
|
11
14
|
import type { QueryVectorParams } from '@mastra/core/vector';
|
|
12
15
|
import type { Schema } from '@turbopuffer/turbopuffer';
|
|
@@ -14,13 +17,15 @@ import type { UpdateVectorParams } from '@mastra/core/vector';
|
|
|
14
17
|
import type { UpsertVectorParams } from '@mastra/core/vector';
|
|
15
18
|
import type { VectorFilter } from '@mastra/core/vector/filter';
|
|
16
19
|
|
|
20
|
+
declare type TurbopufferBlacklistedRootOperators = BlacklistedRootOperators | '$nor' | '$not';
|
|
21
|
+
|
|
17
22
|
/**
|
|
18
23
|
* Translator for converting Mastra filters to Turbopuffer format
|
|
19
24
|
*
|
|
20
25
|
* Mastra filters: { field: { $gt: 10 } }
|
|
21
26
|
* Turbopuffer filters: ["And", [["field", "Gt", 10]]]
|
|
22
27
|
*/
|
|
23
|
-
export declare class TurbopufferFilterTranslator extends BaseFilterTranslator {
|
|
28
|
+
export declare class TurbopufferFilterTranslator extends BaseFilterTranslator<TurbopufferVectorFilter, Filters | undefined> {
|
|
24
29
|
protected getSupportedOperators(): OperatorSupport;
|
|
25
30
|
/**
|
|
26
31
|
* Map Mastra operators to Turbopuffer operators
|
|
@@ -29,7 +34,7 @@ export declare class TurbopufferFilterTranslator extends BaseFilterTranslator {
|
|
|
29
34
|
/**
|
|
30
35
|
* Convert the Mastra filter to Turbopuffer format
|
|
31
36
|
*/
|
|
32
|
-
translate(filter?:
|
|
37
|
+
translate(filter?: TurbopufferVectorFilter): Filters | undefined;
|
|
33
38
|
/**
|
|
34
39
|
* Recursively translate a filter node
|
|
35
40
|
*/
|
|
@@ -56,7 +61,13 @@ export declare class TurbopufferFilterTranslator extends BaseFilterTranslator {
|
|
|
56
61
|
protected normalizeArrayValues(values: any[]): any[];
|
|
57
62
|
}
|
|
58
63
|
|
|
59
|
-
declare
|
|
64
|
+
declare type TurbopufferLogicalOperatorValueMap = Omit<LogicalOperatorValueMap, '$nor' | '$not'>;
|
|
65
|
+
|
|
66
|
+
declare type TurbopufferOperatorValueMap = Omit<OperatorValueMap, '$regex' | '$options' | '$elemMatch'>;
|
|
67
|
+
|
|
68
|
+
declare type TurbopufferQueryVectorParams = QueryVectorParams<TurbopufferVectorFilter>;
|
|
69
|
+
|
|
70
|
+
declare class TurbopufferVector extends MastraVector<TurbopufferVectorFilter> {
|
|
60
71
|
private client;
|
|
61
72
|
private filterTranslator;
|
|
62
73
|
private createIndexCache;
|
|
@@ -64,7 +75,7 @@ declare class TurbopufferVector extends MastraVector {
|
|
|
64
75
|
constructor(opts: TurbopufferVectorOptions);
|
|
65
76
|
createIndex({ indexName, dimension, metric }: CreateIndexParams): Promise<void>;
|
|
66
77
|
upsert({ indexName, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
|
|
67
|
-
query({ indexName, queryVector, topK, filter, includeVector }:
|
|
78
|
+
query({ indexName, queryVector, topK, filter, includeVector, }: TurbopufferQueryVectorParams): Promise<QueryResult[]>;
|
|
68
79
|
listIndexes(): Promise<string[]>;
|
|
69
80
|
/**
|
|
70
81
|
* Retrieves statistics about a vector index.
|
|
@@ -97,6 +108,8 @@ declare class TurbopufferVector extends MastraVector {
|
|
|
97
108
|
export { TurbopufferVector }
|
|
98
109
|
export { TurbopufferVector as TurbopufferVector_alias_1 }
|
|
99
110
|
|
|
111
|
+
export declare type TurbopufferVectorFilter = VectorFilter<keyof TurbopufferOperatorValueMap, TurbopufferOperatorValueMap, TurbopufferLogicalOperatorValueMap, TurbopufferBlacklistedRootOperators>;
|
|
112
|
+
|
|
100
113
|
declare interface TurbopufferVectorOptions {
|
|
101
114
|
/** The API key to authenticate with. */
|
|
102
115
|
apiKey: string;
|
package/dist/index.cjs
CHANGED
|
@@ -293,7 +293,13 @@ var TurbopufferVector = class extends vector.MastraVector {
|
|
|
293
293
|
);
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
-
async query({
|
|
296
|
+
async query({
|
|
297
|
+
indexName,
|
|
298
|
+
queryVector,
|
|
299
|
+
topK,
|
|
300
|
+
filter,
|
|
301
|
+
includeVector
|
|
302
|
+
}) {
|
|
297
303
|
let createIndex;
|
|
298
304
|
try {
|
|
299
305
|
const schemaConfig = this.opts.schemaConfigForIndex?.(indexName);
|
package/dist/index.js
CHANGED
|
@@ -291,7 +291,13 @@ var TurbopufferVector = class extends MastraVector {
|
|
|
291
291
|
);
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
|
-
async query({
|
|
294
|
+
async query({
|
|
295
|
+
indexName,
|
|
296
|
+
queryVector,
|
|
297
|
+
topK,
|
|
298
|
+
filter,
|
|
299
|
+
includeVector
|
|
300
|
+
}) {
|
|
295
301
|
let createIndex;
|
|
296
302
|
try {
|
|
297
303
|
const schemaConfig = this.opts.schemaConfigForIndex?.(indexName);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/turbopuffer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Turbopuffer vector store provider for Mastra",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
"@microsoft/api-extractor": "^7.52.8",
|
|
30
30
|
"@types/node": "^20.19.0",
|
|
31
31
|
"dotenv": "^16.5.0",
|
|
32
|
-
"eslint": "^9.
|
|
32
|
+
"eslint": "^9.29.0",
|
|
33
33
|
"tsup": "^8.5.0",
|
|
34
34
|
"typescript": "^5.8.3",
|
|
35
35
|
"vitest": "^3.2.3",
|
|
36
|
-
"@internal/lint": "0.0.
|
|
37
|
-
"@mastra/core": "0.10.7
|
|
36
|
+
"@internal/lint": "0.0.14",
|
|
37
|
+
"@mastra/core": "0.10.7"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@mastra/core": ">=0.10.
|
|
40
|
+
"@mastra/core": ">=0.10.7-0 <0.11.0-0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
|