@mastra/lance 0.0.0-new-scorer-api-20250801075530 → 0.0.0-new-button-export-20251219130424
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 +1111 -3
- package/README.md +64 -7
- package/dist/index.cjs +1525 -1403
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1526 -1404
- package/dist/index.js.map +1 -1
- package/dist/storage/{domains/operations → db}/index.d.ts +21 -2
- package/dist/storage/db/index.d.ts.map +1 -0
- package/dist/storage/db/utils.d.ts.map +1 -0
- package/dist/storage/domains/memory/index.d.ts +23 -39
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +29 -9
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +28 -14
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +88 -109
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/vector/filter.d.ts +5 -5
- package/dist/vector/index.d.ts +8 -5
- package/dist/vector/index.d.ts.map +1 -1
- package/package.json +29 -11
- package/dist/storage/domains/legacy-evals/index.d.ts +0 -25
- package/dist/storage/domains/legacy-evals/index.d.ts.map +0 -1
- package/dist/storage/domains/operations/index.d.ts.map +0 -1
- package/dist/storage/domains/traces/index.d.ts +0 -34
- package/dist/storage/domains/traces/index.d.ts.map +0 -1
- package/dist/storage/domains/utils.d.ts.map +0 -1
- package/eslint.config.js +0 -6
- package/src/index.ts +0 -2
- package/src/storage/domains/legacy-evals/index.ts +0 -156
- package/src/storage/domains/memory/index.ts +0 -947
- package/src/storage/domains/operations/index.ts +0 -489
- package/src/storage/domains/scores/index.ts +0 -221
- package/src/storage/domains/traces/index.ts +0 -212
- package/src/storage/domains/utils.ts +0 -158
- package/src/storage/domains/workflows/index.ts +0 -207
- package/src/storage/index.test.ts +0 -10
- package/src/storage/index.ts +0 -442
- package/src/vector/filter.test.ts +0 -295
- package/src/vector/filter.ts +0 -443
- package/src/vector/index.test.ts +0 -1493
- package/src/vector/index.ts +0 -941
- package/src/vector/types.ts +0 -16
- package/tsconfig.build.json +0 -9
- package/tsconfig.json +0 -5
- package/tsup.config.ts +0 -22
- package/vitest.config.ts +0 -11
- /package/dist/storage/{domains → db}/utils.d.ts +0 -0
package/dist/vector/filter.d.ts
CHANGED
|
@@ -29,12 +29,12 @@ export declare class LanceFilterTranslator extends BaseFilterTranslator<LanceVec
|
|
|
29
29
|
*/
|
|
30
30
|
protected getSupportedOperators(): {
|
|
31
31
|
custom: string[];
|
|
32
|
-
logical: import("@mastra/core/vector
|
|
33
|
-
basic: import("@mastra/core/vector
|
|
34
|
-
numeric: import("@mastra/core/vector
|
|
35
|
-
array: import("@mastra/core/vector
|
|
32
|
+
logical: import("@mastra/core/vector").LogicalOperator[];
|
|
33
|
+
basic: import("@mastra/core/vector").BasicOperator[];
|
|
34
|
+
numeric: import("@mastra/core/vector").NumericOperator[];
|
|
35
|
+
array: import("@mastra/core/vector").ArrayOperator[];
|
|
36
36
|
element: "$exists"[];
|
|
37
|
-
regex: import("@mastra/core/vector
|
|
37
|
+
regex: import("@mastra/core/vector").RegexOperator[];
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
export {};
|
package/dist/vector/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ConnectionOptions, CreateTableOptions, Table, TableLike } from '@lancedb/lancedb';
|
|
2
|
-
import type { CreateIndexParams, DeleteIndexParams, DeleteVectorParams, DescribeIndexParams, IndexStats, QueryResult, QueryVectorParams, UpdateVectorParams, UpsertVectorParams } from '@mastra/core';
|
|
2
|
+
import type { CreateIndexParams, DeleteIndexParams, DeleteVectorParams, DescribeIndexParams, IndexStats, QueryResult, QueryVectorParams, UpdateVectorParams, UpsertVectorParams, DeleteVectorsParams } from '@mastra/core/vector';
|
|
3
3
|
import { MastraVector } from '@mastra/core/vector';
|
|
4
|
-
import type { LanceVectorFilter } from './filter';
|
|
5
|
-
import type { IndexConfig } from './types';
|
|
4
|
+
import type { LanceVectorFilter } from './filter.js';
|
|
5
|
+
import type { IndexConfig } from './types.js';
|
|
6
6
|
interface LanceCreateIndexParams extends CreateIndexParams {
|
|
7
7
|
indexConfig?: LanceIndexConfig;
|
|
8
8
|
tableName?: string;
|
|
@@ -43,7 +43,9 @@ export declare class LanceVectorStore extends MastraVector<LanceVectorFilter> {
|
|
|
43
43
|
* const store = await LanceVectorStore.create('s3://bucket/db', { storageOptions: { timeout: '60s' } });
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
|
-
static create(uri: string, options?: ConnectionOptions
|
|
46
|
+
static create(uri: string, options?: ConnectionOptions & {
|
|
47
|
+
id: string;
|
|
48
|
+
}): Promise<LanceVectorStore>;
|
|
47
49
|
/**
|
|
48
50
|
* @internal
|
|
49
51
|
* Private constructor to enforce using the create factory method
|
|
@@ -73,13 +75,14 @@ export declare class LanceVectorStore extends MastraVector<LanceVectorFilter> {
|
|
|
73
75
|
*/
|
|
74
76
|
deleteAllTables(): Promise<void>;
|
|
75
77
|
deleteTable(tableName: string): Promise<void>;
|
|
76
|
-
updateVector(
|
|
78
|
+
updateVector(params: UpdateVectorParams<LanceVectorFilter>): Promise<void>;
|
|
77
79
|
deleteVector({ indexName, id }: DeleteVectorParams): Promise<void>;
|
|
78
80
|
/**
|
|
79
81
|
* Converts a flattened object with keys using underscore notation back to a nested object.
|
|
80
82
|
* Example: { name: 'test', details_text: 'test' } → { name: 'test', details: { text: 'test' } }
|
|
81
83
|
*/
|
|
82
84
|
private unflattenObject;
|
|
85
|
+
deleteVectors({ indexName, filter, ids }: DeleteVectorsParams<LanceVectorFilter>): Promise<void>;
|
|
83
86
|
}
|
|
84
87
|
export {};
|
|
85
88
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vector/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,iBAAiB,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vector/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,iBAAiB,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAI5G,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,UAAU,sBAAuB,SAAQ,iBAAiB;IACxD,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,gBAAiB,SAAQ,WAAW;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,uBAAwB,SAAQ,kBAAkB;IAC1D,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,sBAAuB,SAAQ,iBAAiB,CAAC,iBAAiB,CAAC;IAC3E,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,qBAAa,gBAAiB,SAAQ,YAAY,CAAC,iBAAiB,CAAC;IACnE,OAAO,CAAC,WAAW,CAAc;IAEjC;;;;;;;;;;;;;;;;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,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAyBhC,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA2B7C,YAAY,CAAC,MAAM,EAAE,kBAAkB,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAsL1E,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAuExE;;;OAGG;IACH,OAAO,CAAC,eAAe;IAiCjB,aAAa,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,mBAAmB,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CA6HvG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/lance",
|
|
3
|
-
"version": "0.0.0-new-
|
|
3
|
+
"version": "0.0.0-new-button-export-20251219130424",
|
|
4
4
|
"description": "Lance provider for Mastra - includes both vector and db storage capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,29 +12,47 @@
|
|
|
12
12
|
"default": "./dist/index.js"
|
|
13
13
|
},
|
|
14
14
|
"require": {
|
|
15
|
-
"types": "./dist/index.d.
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
16
|
"default": "./dist/index.cjs"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"./package.json": "./package.json"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@lancedb/lancedb": "^0.
|
|
22
|
+
"@lancedb/lancedb": "^0.22.3",
|
|
23
23
|
"apache-arrow": "^18.1.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@
|
|
27
|
-
"@
|
|
28
|
-
"
|
|
26
|
+
"@types/node": "22.13.17",
|
|
27
|
+
"@vitest/coverage-v8": "4.0.12",
|
|
28
|
+
"@vitest/ui": "4.0.12",
|
|
29
|
+
"eslint": "^9.37.0",
|
|
29
30
|
"tsup": "^8.5.0",
|
|
30
31
|
"typescript": "^5.8.3",
|
|
31
|
-
"vitest": "
|
|
32
|
-
"@internal/
|
|
33
|
-
"@
|
|
34
|
-
"@internal/
|
|
32
|
+
"vitest": "4.0.12",
|
|
33
|
+
"@internal/storage-test-utils": "0.0.49",
|
|
34
|
+
"@internal/lint": "0.0.0-new-button-export-20251219130424",
|
|
35
|
+
"@internal/types-builder": "0.0.0-new-button-export-20251219130424",
|
|
36
|
+
"@mastra/core": "0.0.0-new-button-export-20251219130424"
|
|
35
37
|
},
|
|
36
38
|
"peerDependencies": {
|
|
37
|
-
"@mastra/core": "0.0.0-new-
|
|
39
|
+
"@mastra/core": "0.0.0-new-button-export-20251219130424"
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"dist",
|
|
43
|
+
"CHANGELOG.md"
|
|
44
|
+
],
|
|
45
|
+
"homepage": "https://mastra.ai",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "git+https://github.com/mastra-ai/mastra.git",
|
|
49
|
+
"directory": "stores/lance"
|
|
50
|
+
},
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/mastra-ai/mastra/issues"
|
|
53
|
+
},
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=22.13.0"
|
|
38
56
|
},
|
|
39
57
|
"scripts": {
|
|
40
58
|
"build": "tsup --silent --config tsup.config.ts",
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Connection } from '@lancedb/lancedb';
|
|
2
|
-
import { LegacyEvalsStorage } from '@mastra/core/storage';
|
|
3
|
-
import type { EvalRow, PaginationInfo } from '@mastra/core/storage';
|
|
4
|
-
export declare class StoreLegacyEvalsLance extends LegacyEvalsStorage {
|
|
5
|
-
private client;
|
|
6
|
-
constructor({ client }: {
|
|
7
|
-
client: Connection;
|
|
8
|
-
});
|
|
9
|
-
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
10
|
-
getEvals(options: {
|
|
11
|
-
agentName?: string;
|
|
12
|
-
type?: 'test' | 'live';
|
|
13
|
-
page?: number;
|
|
14
|
-
perPage?: number;
|
|
15
|
-
fromDate?: Date;
|
|
16
|
-
toDate?: Date;
|
|
17
|
-
dateRange?: {
|
|
18
|
-
start?: Date;
|
|
19
|
-
end?: Date;
|
|
20
|
-
};
|
|
21
|
-
}): Promise<PaginationInfo & {
|
|
22
|
-
evals: EvalRow[];
|
|
23
|
-
}>;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/legacy-evals/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAe,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEpE,qBAAa,qBAAsB,SAAQ,kBAAkB;IAC3D,OAAO,CAAC,MAAM,CAAa;gBACf,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,UAAU,CAAA;KAAE;IAKxC,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IA4ClF,QAAQ,CAAC,OAAO,EAAE;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACvB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,IAAI,CAAC;QAChB,MAAM,CAAC,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,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QACtC,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwEX,UAAU,CAAC,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAuCpE,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAyDhG,WAAW,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAiEzG,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE;QAAE,SAAS,EAAE,WAAW,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC;CA8ErG"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { Connection } from '@lancedb/lancedb';
|
|
2
|
-
import type { TraceType } from '@mastra/core/memory';
|
|
3
|
-
import { TracesStorage } from '@mastra/core/storage';
|
|
4
|
-
import type { PaginationInfo, StorageGetTracesPaginatedArg } from '@mastra/core/storage';
|
|
5
|
-
import type { Trace } from '@mastra/core/telemetry';
|
|
6
|
-
import type { StoreOperationsLance } from '../operations';
|
|
7
|
-
export declare class StoreTracesLance extends TracesStorage {
|
|
8
|
-
private client;
|
|
9
|
-
private operations;
|
|
10
|
-
constructor({ client, operations }: {
|
|
11
|
-
client: Connection;
|
|
12
|
-
operations: StoreOperationsLance;
|
|
13
|
-
});
|
|
14
|
-
saveTrace({ trace }: {
|
|
15
|
-
trace: TraceType;
|
|
16
|
-
}): Promise<TraceType>;
|
|
17
|
-
getTraceById({ traceId }: {
|
|
18
|
-
traceId: string;
|
|
19
|
-
}): Promise<TraceType>;
|
|
20
|
-
getTraces({ name, scope, page, perPage, attributes, }: {
|
|
21
|
-
name?: string;
|
|
22
|
-
scope?: string;
|
|
23
|
-
page: number;
|
|
24
|
-
perPage: number;
|
|
25
|
-
attributes?: Record<string, string>;
|
|
26
|
-
}): Promise<Trace[]>;
|
|
27
|
-
getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
|
|
28
|
-
traces: Trace[];
|
|
29
|
-
}>;
|
|
30
|
-
batchTraceInsert({ records }: {
|
|
31
|
-
records: Record<string, any>[];
|
|
32
|
-
}): Promise<void>;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/traces/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAgB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,UAAU,CAAuB;gBAC7B,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,UAAU,EAAE,oBAAoB,CA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UAAU,GAAG,IAAI,CA4BzF;AAED,wBAAgB,+BAA+B,CAC7C,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EACtD,WAAW,EAAE,UAAU,GACtB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAuD7C;AAED,wBAAsB,cAAc,CAAC,EACnC,SAAS,EACT,MAAM,GACP,EAAE;IACD,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,UAAU,CAAC;CACpB,GAAG,OAAO,CAAC,UAAU,CAAC,CA6CtB"}
|
package/eslint.config.js
DELETED
package/src/index.ts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import type { Connection } from '@lancedb/lancedb';
|
|
2
|
-
import { ErrorCategory, ErrorDomain, MastraError } from '@mastra/core/error';
|
|
3
|
-
import { LegacyEvalsStorage, TABLE_EVALS } from '@mastra/core/storage';
|
|
4
|
-
import type { EvalRow, PaginationInfo } from '@mastra/core/storage';
|
|
5
|
-
|
|
6
|
-
export class StoreLegacyEvalsLance extends LegacyEvalsStorage {
|
|
7
|
-
private client: Connection;
|
|
8
|
-
constructor({ client }: { client: Connection }) {
|
|
9
|
-
super();
|
|
10
|
-
this.client = client;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
async getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]> {
|
|
14
|
-
try {
|
|
15
|
-
const table = await this.client.openTable(TABLE_EVALS);
|
|
16
|
-
const query = table.query().where(`agent_name = '${agentName}'`);
|
|
17
|
-
const records = await query.toArray();
|
|
18
|
-
|
|
19
|
-
// Filter by type if specified
|
|
20
|
-
let filteredRecords = records;
|
|
21
|
-
if (type === 'live') {
|
|
22
|
-
// Live evals have test_info as null
|
|
23
|
-
filteredRecords = records.filter(record => record.test_info === null);
|
|
24
|
-
} else if (type === 'test') {
|
|
25
|
-
// Test evals have test_info as a JSON string
|
|
26
|
-
filteredRecords = records.filter(record => record.test_info !== null);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return filteredRecords.map(record => {
|
|
30
|
-
return {
|
|
31
|
-
id: record.id,
|
|
32
|
-
input: record.input,
|
|
33
|
-
output: record.output,
|
|
34
|
-
agentName: record.agent_name,
|
|
35
|
-
metricName: record.metric_name,
|
|
36
|
-
result: JSON.parse(record.result),
|
|
37
|
-
instructions: record.instructions,
|
|
38
|
-
testInfo: record.test_info ? JSON.parse(record.test_info) : null,
|
|
39
|
-
globalRunId: record.global_run_id,
|
|
40
|
-
runId: record.run_id,
|
|
41
|
-
createdAt: new Date(record.created_at).toString(),
|
|
42
|
-
};
|
|
43
|
-
}) as EvalRow[];
|
|
44
|
-
} catch (error: any) {
|
|
45
|
-
throw new MastraError(
|
|
46
|
-
{
|
|
47
|
-
id: 'LANCE_STORE_GET_EVALS_BY_AGENT_NAME_FAILED',
|
|
48
|
-
domain: ErrorDomain.STORAGE,
|
|
49
|
-
category: ErrorCategory.THIRD_PARTY,
|
|
50
|
-
details: { agentName },
|
|
51
|
-
},
|
|
52
|
-
error,
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async getEvals(options: {
|
|
58
|
-
agentName?: string;
|
|
59
|
-
type?: 'test' | 'live';
|
|
60
|
-
page?: number;
|
|
61
|
-
perPage?: number;
|
|
62
|
-
fromDate?: Date;
|
|
63
|
-
toDate?: Date;
|
|
64
|
-
dateRange?: { start?: Date; end?: Date };
|
|
65
|
-
}): Promise<PaginationInfo & { evals: EvalRow[] }> {
|
|
66
|
-
try {
|
|
67
|
-
const table = await this.client.openTable(TABLE_EVALS);
|
|
68
|
-
|
|
69
|
-
// Build combined where clause
|
|
70
|
-
const conditions: string[] = [];
|
|
71
|
-
|
|
72
|
-
if (options.agentName) {
|
|
73
|
-
conditions.push(`agent_name = '${options.agentName}'`);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Apply type filtering
|
|
77
|
-
if (options.type === 'live') {
|
|
78
|
-
conditions.push('length(test_info) = 0');
|
|
79
|
-
} else if (options.type === 'test') {
|
|
80
|
-
conditions.push('length(test_info) > 0');
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Apply date filtering
|
|
84
|
-
const startDate = options.dateRange?.start || options.fromDate;
|
|
85
|
-
const endDate = options.dateRange?.end || options.toDate;
|
|
86
|
-
|
|
87
|
-
if (startDate) {
|
|
88
|
-
conditions.push(`\`created_at\` >= ${startDate.getTime()}`);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (endDate) {
|
|
92
|
-
conditions.push(`\`created_at\` <= ${endDate.getTime()}`);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Get total count with the same conditions
|
|
96
|
-
let total = 0;
|
|
97
|
-
if (conditions.length > 0) {
|
|
98
|
-
total = await table.countRows(conditions.join(' AND '));
|
|
99
|
-
} else {
|
|
100
|
-
total = await table.countRows();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// Build query for fetching records
|
|
104
|
-
const query = table.query();
|
|
105
|
-
|
|
106
|
-
// Apply combined where clause if we have conditions
|
|
107
|
-
if (conditions.length > 0) {
|
|
108
|
-
const whereClause = conditions.join(' AND ');
|
|
109
|
-
query.where(whereClause);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const records = await query.toArray();
|
|
113
|
-
|
|
114
|
-
const evals = records
|
|
115
|
-
.sort((a, b) => b.created_at - a.created_at)
|
|
116
|
-
.map(record => {
|
|
117
|
-
return {
|
|
118
|
-
id: record.id,
|
|
119
|
-
input: record.input,
|
|
120
|
-
output: record.output,
|
|
121
|
-
agentName: record.agent_name,
|
|
122
|
-
metricName: record.metric_name,
|
|
123
|
-
result: JSON.parse(record.result),
|
|
124
|
-
instructions: record.instructions,
|
|
125
|
-
testInfo: record.test_info ? JSON.parse(record.test_info) : null,
|
|
126
|
-
globalRunId: record.global_run_id,
|
|
127
|
-
runId: record.run_id,
|
|
128
|
-
createdAt: new Date(record.created_at).toISOString(),
|
|
129
|
-
};
|
|
130
|
-
}) as EvalRow[];
|
|
131
|
-
|
|
132
|
-
// Apply pagination after filtering
|
|
133
|
-
const page = options.page || 0;
|
|
134
|
-
const perPage = options.perPage || 10;
|
|
135
|
-
const pagedEvals = evals.slice(page * perPage, (page + 1) * perPage);
|
|
136
|
-
|
|
137
|
-
return {
|
|
138
|
-
evals: pagedEvals,
|
|
139
|
-
total: total,
|
|
140
|
-
page,
|
|
141
|
-
perPage,
|
|
142
|
-
hasMore: total > (page + 1) * perPage,
|
|
143
|
-
};
|
|
144
|
-
} catch (error: any) {
|
|
145
|
-
throw new MastraError(
|
|
146
|
-
{
|
|
147
|
-
id: 'LANCE_STORE_GET_EVALS_FAILED',
|
|
148
|
-
domain: ErrorDomain.STORAGE,
|
|
149
|
-
category: ErrorCategory.THIRD_PARTY,
|
|
150
|
-
details: { agentName: options.agentName ?? '' },
|
|
151
|
-
},
|
|
152
|
-
error,
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|