@mastra/lance 0.2.3 → 0.2.4-alpha.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/.turbo/turbo-build.log +2 -21
- package/CHANGELOG.md +13 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/storage/domains/legacy-evals/index.d.ts +25 -0
- package/dist/storage/domains/legacy-evals/index.d.ts.map +1 -0
- package/dist/storage/domains/memory/index.d.ts +94 -0
- package/dist/storage/domains/memory/index.d.ts.map +1 -0
- package/dist/storage/domains/operations/index.d.ts +40 -0
- package/dist/storage/domains/operations/index.d.ts.map +1 -0
- package/dist/storage/domains/scores/index.d.ts +39 -0
- package/dist/storage/domains/scores/index.d.ts.map +1 -0
- package/dist/storage/domains/traces/index.d.ts +34 -0
- package/dist/storage/domains/traces/index.d.ts.map +1 -0
- package/dist/storage/domains/utils.d.ts +10 -0
- package/dist/storage/domains/utils.d.ts.map +1 -0
- package/dist/storage/domains/workflows/index.d.ts +38 -0
- package/dist/storage/domains/workflows/index.d.ts.map +1 -0
- package/dist/storage/index.d.ts +233 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/vector/filter.d.ts +41 -0
- package/dist/vector/filter.d.ts.map +1 -0
- package/dist/vector/index.d.ts +85 -0
- package/dist/vector/index.d.ts.map +1 -0
- package/dist/vector/types.d.ts +15 -0
- package/dist/vector/types.d.ts.map +1 -0
- package/package.json +9 -8
- package/tsconfig.build.json +9 -0
- package/tsconfig.json +1 -1
- package/tsup.config.ts +17 -0
- package/dist/_tsup-dts-rollup.d.cts +0 -681
- package/dist/_tsup-dts-rollup.d.ts +0 -681
- package/dist/index.d.cts +0 -2
|
@@ -1,681 +0,0 @@
|
|
|
1
|
-
import { ArrayOperator } from '@mastra/core/vector/filter';
|
|
2
|
-
import { BaseFilterTranslator } from '@mastra/core/vector/filter';
|
|
3
|
-
import { BasicOperator } from '@mastra/core/vector/filter';
|
|
4
|
-
import type { BlacklistedRootOperators } from '@mastra/core/vector/filter';
|
|
5
|
-
import type { Connection } from '@lancedb/lancedb';
|
|
6
|
-
import type { ConnectionOptions } from '@lancedb/lancedb';
|
|
7
|
-
import type { CreateIndexParams } from '@mastra/core';
|
|
8
|
-
import type { CreateTableOptions } from '@lancedb/lancedb';
|
|
9
|
-
import type { DeleteIndexParams } from '@mastra/core';
|
|
10
|
-
import type { DeleteVectorParams } from '@mastra/core';
|
|
11
|
-
import type { DescribeIndexParams } from '@mastra/core';
|
|
12
|
-
import type { EvalRow } from '@mastra/core/storage';
|
|
13
|
-
import type { IndexStats } from '@mastra/core';
|
|
14
|
-
import { LegacyEvalsStorage } from '@mastra/core/storage';
|
|
15
|
-
import { LogicalOperator } from '@mastra/core/vector/filter';
|
|
16
|
-
import type { LogicalOperatorValueMap } from '@mastra/core/vector/filter';
|
|
17
|
-
import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
18
|
-
import type { MastraMessageV1 } from '@mastra/core/memory';
|
|
19
|
-
import type { MastraMessageV2 } from '@mastra/core/memory';
|
|
20
|
-
import { MastraStorage } from '@mastra/core/storage';
|
|
21
|
-
import { MastraVector } from '@mastra/core/vector';
|
|
22
|
-
import { MemoryStorage } from '@mastra/core/storage';
|
|
23
|
-
import { NumericOperator } from '@mastra/core/vector/filter';
|
|
24
|
-
import type { OperatorValueMap } from '@mastra/core/vector/filter';
|
|
25
|
-
import type { PaginationInfo } from '@mastra/core/storage';
|
|
26
|
-
import type { QueryResult } from '@mastra/core';
|
|
27
|
-
import type { QueryVectorParams } from '@mastra/core';
|
|
28
|
-
import { RegexOperator } from '@mastra/core/vector/filter';
|
|
29
|
-
import type { SchemaLike } from '@lancedb/lancedb';
|
|
30
|
-
import type { ScoreRowData } from '@mastra/core/scores';
|
|
31
|
-
import { ScoresStorage } from '@mastra/core/storage';
|
|
32
|
-
import type { StorageColumn } from '@mastra/core/storage';
|
|
33
|
-
import type { StorageDomains } from '@mastra/core/storage';
|
|
34
|
-
import type { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
35
|
-
import type { StorageGetTracesPaginatedArg } from '@mastra/core/storage';
|
|
36
|
-
import type { StoragePagination } from '@mastra/core/storage';
|
|
37
|
-
import type { StorageResourceType } from '@mastra/core/storage';
|
|
38
|
-
import type { StorageThreadType } from '@mastra/core/memory';
|
|
39
|
-
import { StoreOperations } from '@mastra/core/storage';
|
|
40
|
-
import type { Table } from '@lancedb/lancedb';
|
|
41
|
-
import type { TABLE_NAMES } from '@mastra/core/storage';
|
|
42
|
-
import type { TableLike } from '@lancedb/lancedb';
|
|
43
|
-
import type { Trace } from '@mastra/core/telemetry';
|
|
44
|
-
import { TracesStorage } from '@mastra/core/storage';
|
|
45
|
-
import type { TraceType } from '@mastra/core/memory';
|
|
46
|
-
import type { UpdateVectorParams } from '@mastra/core';
|
|
47
|
-
import type { UpsertVectorParams } from '@mastra/core';
|
|
48
|
-
import type { VectorFilter } from '@mastra/core/vector/filter';
|
|
49
|
-
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
50
|
-
import type { WorkflowRuns as WorkflowRuns_2 } from '@mastra/core';
|
|
51
|
-
import type { WorkflowRunState } from '@mastra/core/workflows';
|
|
52
|
-
import type { WorkflowRunState as WorkflowRunState_2 } from '@mastra/core';
|
|
53
|
-
import { WorkflowsStorage } from '@mastra/core/storage';
|
|
54
|
-
|
|
55
|
-
export declare function getPrimaryKeys(tableName: TABLE_NAMES): string[];
|
|
56
|
-
|
|
57
|
-
export declare function getTableSchema({ tableName, client, }: {
|
|
58
|
-
tableName: TABLE_NAMES;
|
|
59
|
-
client: Connection;
|
|
60
|
-
}): Promise<SchemaLike>;
|
|
61
|
-
|
|
62
|
-
declare interface HNSWConfig {
|
|
63
|
-
m?: number;
|
|
64
|
-
efConstruction?: number;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export declare interface IndexConfig {
|
|
68
|
-
type?: IndexType;
|
|
69
|
-
ivf?: IVFConfig;
|
|
70
|
-
hnsw?: HNSWConfig;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export declare type IndexType = 'ivfflat' | 'hnsw';
|
|
74
|
-
|
|
75
|
-
declare interface IVFConfig {
|
|
76
|
-
lists?: number;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
declare type LanceBlacklisted = BlacklistedRootOperators | '$like' | '$notLike' | '$contains';
|
|
80
|
-
|
|
81
|
-
declare interface LanceCreateIndexParams extends CreateIndexParams {
|
|
82
|
-
indexConfig?: LanceIndexConfig;
|
|
83
|
-
tableName?: string;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export declare class LanceFilterTranslator extends BaseFilterTranslator<LanceVectorFilter, string> {
|
|
87
|
-
translate(filter: LanceVectorFilter): string;
|
|
88
|
-
private processFilter;
|
|
89
|
-
private processLogicalOperator;
|
|
90
|
-
private processNestedObject;
|
|
91
|
-
private processField;
|
|
92
|
-
private processOperators;
|
|
93
|
-
private formatValue;
|
|
94
|
-
private formatArrayValues;
|
|
95
|
-
normalizeArrayValues(array: unknown[]): unknown[];
|
|
96
|
-
normalizeComparisonValue(value: unknown): unknown;
|
|
97
|
-
private isOperatorObject;
|
|
98
|
-
private isNestedObject;
|
|
99
|
-
private isNormalNestedField;
|
|
100
|
-
private escapeFieldName;
|
|
101
|
-
private isSqlKeyword;
|
|
102
|
-
private isDateObject;
|
|
103
|
-
/**
|
|
104
|
-
* Override getSupportedOperators to add custom operators for LanceDB
|
|
105
|
-
*/
|
|
106
|
-
protected getSupportedOperators(): {
|
|
107
|
-
custom: string[];
|
|
108
|
-
logical: LogicalOperator[];
|
|
109
|
-
basic: BasicOperator[];
|
|
110
|
-
numeric: NumericOperator[];
|
|
111
|
-
array: ArrayOperator[];
|
|
112
|
-
element: "$exists"[];
|
|
113
|
-
regex: RegexOperator[];
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
declare interface LanceIndexConfig extends IndexConfig {
|
|
118
|
-
numPartitions?: number;
|
|
119
|
-
numSubVectors?: number;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
declare type LanceOperatorValueMap = OperatorValueMap & {
|
|
123
|
-
$like: string;
|
|
124
|
-
$notLike: string;
|
|
125
|
-
$contains: string;
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
declare interface LanceQueryVectorParams extends QueryVectorParams<LanceVectorFilter> {
|
|
129
|
-
tableName: string;
|
|
130
|
-
columns?: string[];
|
|
131
|
-
includeAllColumns?: boolean;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
declare class LanceStorage extends MastraStorage {
|
|
135
|
-
stores: StorageDomains;
|
|
136
|
-
private lanceClient;
|
|
137
|
-
/**
|
|
138
|
-
* Creates a new instance of LanceStorage
|
|
139
|
-
* @param uri The URI to connect to LanceDB
|
|
140
|
-
* @param options connection options
|
|
141
|
-
*
|
|
142
|
-
* Usage:
|
|
143
|
-
*
|
|
144
|
-
* Connect to a local database
|
|
145
|
-
* ```ts
|
|
146
|
-
* const store = await LanceStorage.create('/path/to/db');
|
|
147
|
-
* ```
|
|
148
|
-
*
|
|
149
|
-
* Connect to a LanceDB cloud database
|
|
150
|
-
* ```ts
|
|
151
|
-
* const store = await LanceStorage.create('db://host:port');
|
|
152
|
-
* ```
|
|
153
|
-
*
|
|
154
|
-
* Connect to a cloud database
|
|
155
|
-
* ```ts
|
|
156
|
-
* const store = await LanceStorage.create('s3://bucket/db', { storageOptions: { timeout: '60s' } });
|
|
157
|
-
* ```
|
|
158
|
-
*/
|
|
159
|
-
static create(name: string, uri: string, options?: ConnectionOptions): Promise<LanceStorage>;
|
|
160
|
-
/**
|
|
161
|
-
* @internal
|
|
162
|
-
* Private constructor to enforce using the create factory method
|
|
163
|
-
*/
|
|
164
|
-
private constructor();
|
|
165
|
-
createTable({ tableName, schema, }: {
|
|
166
|
-
tableName: TABLE_NAMES;
|
|
167
|
-
schema: Record<string, StorageColumn>;
|
|
168
|
-
}): Promise<void>;
|
|
169
|
-
dropTable({ tableName }: {
|
|
170
|
-
tableName: TABLE_NAMES;
|
|
171
|
-
}): Promise<void>;
|
|
172
|
-
alterTable({ tableName, schema, ifNotExists, }: {
|
|
173
|
-
tableName: TABLE_NAMES;
|
|
174
|
-
schema: Record<string, StorageColumn>;
|
|
175
|
-
ifNotExists: string[];
|
|
176
|
-
}): Promise<void>;
|
|
177
|
-
clearTable({ tableName }: {
|
|
178
|
-
tableName: TABLE_NAMES;
|
|
179
|
-
}): Promise<void>;
|
|
180
|
-
insert({ tableName, record }: {
|
|
181
|
-
tableName: TABLE_NAMES;
|
|
182
|
-
record: Record<string, any>;
|
|
183
|
-
}): Promise<void>;
|
|
184
|
-
batchInsert({ tableName, records }: {
|
|
185
|
-
tableName: TABLE_NAMES;
|
|
186
|
-
records: Record<string, any>[];
|
|
187
|
-
}): Promise<void>;
|
|
188
|
-
load({ tableName, keys }: {
|
|
189
|
-
tableName: TABLE_NAMES;
|
|
190
|
-
keys: Record<string, any>;
|
|
191
|
-
}): Promise<any>;
|
|
192
|
-
getThreadById({ threadId }: {
|
|
193
|
-
threadId: string;
|
|
194
|
-
}): Promise<StorageThreadType | null>;
|
|
195
|
-
getThreadsByResourceId({ resourceId }: {
|
|
196
|
-
resourceId: string;
|
|
197
|
-
}): Promise<StorageThreadType[]>;
|
|
198
|
-
/**
|
|
199
|
-
* Saves a thread to the database. This function doesn't overwrite existing threads.
|
|
200
|
-
* @param thread - The thread to save
|
|
201
|
-
* @returns The saved thread
|
|
202
|
-
*/
|
|
203
|
-
saveThread({ thread }: {
|
|
204
|
-
thread: StorageThreadType;
|
|
205
|
-
}): Promise<StorageThreadType>;
|
|
206
|
-
updateThread({ id, title, metadata, }: {
|
|
207
|
-
id: string;
|
|
208
|
-
title: string;
|
|
209
|
-
metadata: Record<string, unknown>;
|
|
210
|
-
}): Promise<StorageThreadType>;
|
|
211
|
-
deleteThread({ threadId }: {
|
|
212
|
-
threadId: string;
|
|
213
|
-
}): Promise<void>;
|
|
214
|
-
get supports(): {
|
|
215
|
-
selectByIncludeResourceScope: boolean;
|
|
216
|
-
resourceWorkingMemory: boolean;
|
|
217
|
-
hasColumn: boolean;
|
|
218
|
-
createTable: boolean;
|
|
219
|
-
deleteMessages: boolean;
|
|
220
|
-
};
|
|
221
|
-
getResourceById({ resourceId }: {
|
|
222
|
-
resourceId: string;
|
|
223
|
-
}): Promise<StorageResourceType | null>;
|
|
224
|
-
saveResource({ resource }: {
|
|
225
|
-
resource: StorageResourceType;
|
|
226
|
-
}): Promise<StorageResourceType>;
|
|
227
|
-
updateResource({ resourceId, workingMemory, metadata, }: {
|
|
228
|
-
resourceId: string;
|
|
229
|
-
workingMemory?: string;
|
|
230
|
-
metadata?: Record<string, unknown>;
|
|
231
|
-
}): Promise<StorageResourceType>;
|
|
232
|
-
/**
|
|
233
|
-
* Processes messages to include context messages based on withPreviousMessages and withNextMessages
|
|
234
|
-
* @param records - The sorted array of records to process
|
|
235
|
-
* @param include - The array of include specifications with context parameters
|
|
236
|
-
* @returns The processed array with context messages included
|
|
237
|
-
*/
|
|
238
|
-
private processMessagesWithContext;
|
|
239
|
-
getMessages(args: StorageGetMessagesArg & {
|
|
240
|
-
format?: 'v1';
|
|
241
|
-
}): Promise<MastraMessageV1[]>;
|
|
242
|
-
getMessages(args: StorageGetMessagesArg & {
|
|
243
|
-
format: 'v2';
|
|
244
|
-
}): Promise<MastraMessageV2[]>;
|
|
245
|
-
saveMessages(args: {
|
|
246
|
-
messages: MastraMessageV1[];
|
|
247
|
-
format?: undefined | 'v1';
|
|
248
|
-
}): Promise<MastraMessageV1[]>;
|
|
249
|
-
saveMessages(args: {
|
|
250
|
-
messages: MastraMessageV2[];
|
|
251
|
-
format: 'v2';
|
|
252
|
-
}): Promise<MastraMessageV2[]>;
|
|
253
|
-
getThreadsByResourceIdPaginated(args: {
|
|
254
|
-
resourceId: string;
|
|
255
|
-
page: number;
|
|
256
|
-
perPage: number;
|
|
257
|
-
}): Promise<PaginationInfo & {
|
|
258
|
-
threads: StorageThreadType[];
|
|
259
|
-
}>;
|
|
260
|
-
getMessagesPaginated(args: StorageGetMessagesArg & {
|
|
261
|
-
format?: 'v1' | 'v2';
|
|
262
|
-
}): Promise<PaginationInfo & {
|
|
263
|
-
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
264
|
-
}>;
|
|
265
|
-
updateMessages(_args: {
|
|
266
|
-
messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
|
|
267
|
-
id: string;
|
|
268
|
-
content?: {
|
|
269
|
-
metadata?: MastraMessageContentV2['metadata'];
|
|
270
|
-
content?: MastraMessageContentV2['content'];
|
|
271
|
-
};
|
|
272
|
-
}[];
|
|
273
|
-
}): Promise<MastraMessageV2[]>;
|
|
274
|
-
getTraceById(args: {
|
|
275
|
-
traceId: string;
|
|
276
|
-
}): Promise<TraceType>;
|
|
277
|
-
getTraces(args: {
|
|
278
|
-
name?: string;
|
|
279
|
-
scope?: string;
|
|
280
|
-
page: number;
|
|
281
|
-
perPage: number;
|
|
282
|
-
attributes?: Record<string, string>;
|
|
283
|
-
}): Promise<Trace[]>;
|
|
284
|
-
getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
|
|
285
|
-
traces: Trace[];
|
|
286
|
-
}>;
|
|
287
|
-
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
288
|
-
getEvals(options: {
|
|
289
|
-
agentName?: string;
|
|
290
|
-
type?: 'test' | 'live';
|
|
291
|
-
page?: number;
|
|
292
|
-
perPage?: number;
|
|
293
|
-
fromDate?: Date;
|
|
294
|
-
toDate?: Date;
|
|
295
|
-
dateRange?: {
|
|
296
|
-
start?: Date;
|
|
297
|
-
end?: Date;
|
|
298
|
-
};
|
|
299
|
-
}): Promise<PaginationInfo & {
|
|
300
|
-
evals: EvalRow[];
|
|
301
|
-
}>;
|
|
302
|
-
getWorkflowRuns(args?: {
|
|
303
|
-
namespace?: string;
|
|
304
|
-
workflowName?: string;
|
|
305
|
-
fromDate?: Date;
|
|
306
|
-
toDate?: Date;
|
|
307
|
-
limit?: number;
|
|
308
|
-
offset?: number;
|
|
309
|
-
}): Promise<WorkflowRuns>;
|
|
310
|
-
getWorkflowRunById(args: {
|
|
311
|
-
runId: string;
|
|
312
|
-
workflowName?: string;
|
|
313
|
-
}): Promise<{
|
|
314
|
-
workflowName: string;
|
|
315
|
-
runId: string;
|
|
316
|
-
snapshot: any;
|
|
317
|
-
createdAt: Date;
|
|
318
|
-
updatedAt: Date;
|
|
319
|
-
} | null>;
|
|
320
|
-
persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
|
|
321
|
-
workflowName: string;
|
|
322
|
-
runId: string;
|
|
323
|
-
snapshot: WorkflowRunState;
|
|
324
|
-
}): Promise<void>;
|
|
325
|
-
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
326
|
-
workflowName: string;
|
|
327
|
-
runId: string;
|
|
328
|
-
}): Promise<WorkflowRunState | null>;
|
|
329
|
-
getScoreById({ id: _id }: {
|
|
330
|
-
id: string;
|
|
331
|
-
}): Promise<ScoreRowData | null>;
|
|
332
|
-
getScoresByScorerId({ scorerId, pagination, }: {
|
|
333
|
-
scorerId: string;
|
|
334
|
-
pagination: StoragePagination;
|
|
335
|
-
}): Promise<{
|
|
336
|
-
pagination: PaginationInfo;
|
|
337
|
-
scores: ScoreRowData[];
|
|
338
|
-
}>;
|
|
339
|
-
saveScore(_score: ScoreRowData): Promise<{
|
|
340
|
-
score: ScoreRowData;
|
|
341
|
-
}>;
|
|
342
|
-
getScoresByRunId({ runId, pagination, }: {
|
|
343
|
-
runId: string;
|
|
344
|
-
pagination: StoragePagination;
|
|
345
|
-
}): Promise<{
|
|
346
|
-
pagination: PaginationInfo;
|
|
347
|
-
scores: ScoreRowData[];
|
|
348
|
-
}>;
|
|
349
|
-
getScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
350
|
-
pagination: StoragePagination;
|
|
351
|
-
entityId: string;
|
|
352
|
-
entityType: string;
|
|
353
|
-
}): Promise<{
|
|
354
|
-
pagination: PaginationInfo;
|
|
355
|
-
scores: ScoreRowData[];
|
|
356
|
-
}>;
|
|
357
|
-
}
|
|
358
|
-
export { LanceStorage }
|
|
359
|
-
export { LanceStorage as LanceStorage_alias_1 }
|
|
360
|
-
|
|
361
|
-
declare interface LanceUpsertVectorParams extends UpsertVectorParams {
|
|
362
|
-
tableName: string;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
export declare type LanceVectorFilter = VectorFilter<keyof LanceOperatorValueMap, LanceOperatorValueMap, LogicalOperatorValueMap, LanceBlacklisted>;
|
|
366
|
-
|
|
367
|
-
declare class LanceVectorStore extends MastraVector<LanceVectorFilter> {
|
|
368
|
-
private lanceClient;
|
|
369
|
-
/**
|
|
370
|
-
* Creates a new instance of LanceVectorStore
|
|
371
|
-
* @param uri The URI to connect to LanceDB
|
|
372
|
-
* @param options connection options
|
|
373
|
-
*
|
|
374
|
-
* Usage:
|
|
375
|
-
*
|
|
376
|
-
* Connect to a local database
|
|
377
|
-
* ```ts
|
|
378
|
-
* const store = await LanceVectorStore.create('/path/to/db');
|
|
379
|
-
* ```
|
|
380
|
-
*
|
|
381
|
-
* Connect to a LanceDB cloud database
|
|
382
|
-
* ```ts
|
|
383
|
-
* const store = await LanceVectorStore.create('db://host:port');
|
|
384
|
-
* ```
|
|
385
|
-
*
|
|
386
|
-
* Connect to a cloud database
|
|
387
|
-
* ```ts
|
|
388
|
-
* const store = await LanceVectorStore.create('s3://bucket/db', { storageOptions: { timeout: '60s' } });
|
|
389
|
-
* ```
|
|
390
|
-
*/
|
|
391
|
-
static create(uri: string, options?: ConnectionOptions): Promise<LanceVectorStore>;
|
|
392
|
-
/**
|
|
393
|
-
* @internal
|
|
394
|
-
* Private constructor to enforce using the create factory method
|
|
395
|
-
*/
|
|
396
|
-
private constructor();
|
|
397
|
-
close(): void;
|
|
398
|
-
query({ tableName, queryVector, filter, includeVector, topK, columns, includeAllColumns, }: LanceQueryVectorParams): Promise<QueryResult[]>;
|
|
399
|
-
private filterTranslator;
|
|
400
|
-
upsert({ tableName, vectors, metadata, ids }: LanceUpsertVectorParams): Promise<string[]>;
|
|
401
|
-
/**
|
|
402
|
-
* Flattens a nested object, creating new keys with underscores for nested properties.
|
|
403
|
-
* Example: { metadata: { text: 'test' } } → { metadata_text: 'test' }
|
|
404
|
-
*/
|
|
405
|
-
private flattenObject;
|
|
406
|
-
createTable(tableName: string, data: Record<string, unknown>[] | TableLike, options?: Partial<CreateTableOptions>): Promise<Table>;
|
|
407
|
-
listTables(): Promise<string[]>;
|
|
408
|
-
getTableSchema(tableName: string): Promise<any>;
|
|
409
|
-
/**
|
|
410
|
-
* indexName is actually a column name in a table in lanceDB
|
|
411
|
-
*/
|
|
412
|
-
createIndex({ tableName, indexName, dimension, metric, indexConfig, }: LanceCreateIndexParams): Promise<void>;
|
|
413
|
-
listIndexes(): Promise<string[]>;
|
|
414
|
-
describeIndex({ indexName }: DescribeIndexParams): Promise<IndexStats>;
|
|
415
|
-
deleteIndex({ indexName }: DeleteIndexParams): Promise<void>;
|
|
416
|
-
/**
|
|
417
|
-
* Deletes all tables in the database
|
|
418
|
-
*/
|
|
419
|
-
deleteAllTables(): Promise<void>;
|
|
420
|
-
deleteTable(tableName: string): Promise<void>;
|
|
421
|
-
updateVector({ indexName, id, update }: UpdateVectorParams): Promise<void>;
|
|
422
|
-
deleteVector({ indexName, id }: DeleteVectorParams): Promise<void>;
|
|
423
|
-
/**
|
|
424
|
-
* Converts a flattened object with keys using underscore notation back to a nested object.
|
|
425
|
-
* Example: { name: 'test', details_text: 'test' } → { name: 'test', details: { text: 'test' } }
|
|
426
|
-
*/
|
|
427
|
-
private unflattenObject;
|
|
428
|
-
}
|
|
429
|
-
export { LanceVectorStore }
|
|
430
|
-
export { LanceVectorStore as LanceVectorStore_alias_1 }
|
|
431
|
-
|
|
432
|
-
export declare function processResultWithTypeConversion(rawResult: Record<string, any> | Record<string, any>[], tableSchema: SchemaLike): Record<string, any> | Record<string, any>[];
|
|
433
|
-
|
|
434
|
-
export declare class StoreLegacyEvalsLance extends LegacyEvalsStorage {
|
|
435
|
-
private client;
|
|
436
|
-
constructor({ client }: {
|
|
437
|
-
client: Connection;
|
|
438
|
-
});
|
|
439
|
-
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
440
|
-
getEvals(options: {
|
|
441
|
-
agentName?: string;
|
|
442
|
-
type?: 'test' | 'live';
|
|
443
|
-
page?: number;
|
|
444
|
-
perPage?: number;
|
|
445
|
-
fromDate?: Date;
|
|
446
|
-
toDate?: Date;
|
|
447
|
-
dateRange?: {
|
|
448
|
-
start?: Date;
|
|
449
|
-
end?: Date;
|
|
450
|
-
};
|
|
451
|
-
}): Promise<PaginationInfo & {
|
|
452
|
-
evals: EvalRow[];
|
|
453
|
-
}>;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
export declare class StoreMemoryLance extends MemoryStorage {
|
|
457
|
-
private client;
|
|
458
|
-
private operations;
|
|
459
|
-
constructor({ client, operations }: {
|
|
460
|
-
client: Connection;
|
|
461
|
-
operations: StoreOperationsLance;
|
|
462
|
-
});
|
|
463
|
-
getThreadById({ threadId }: {
|
|
464
|
-
threadId: string;
|
|
465
|
-
}): Promise<StorageThreadType | null>;
|
|
466
|
-
getThreadsByResourceId({ resourceId }: {
|
|
467
|
-
resourceId: string;
|
|
468
|
-
}): Promise<StorageThreadType[]>;
|
|
469
|
-
/**
|
|
470
|
-
* Saves a thread to the database. This function doesn't overwrite existing threads.
|
|
471
|
-
* @param thread - The thread to save
|
|
472
|
-
* @returns The saved thread
|
|
473
|
-
*/
|
|
474
|
-
saveThread({ thread }: {
|
|
475
|
-
thread: StorageThreadType;
|
|
476
|
-
}): Promise<StorageThreadType>;
|
|
477
|
-
updateThread({ id, title, metadata, }: {
|
|
478
|
-
id: string;
|
|
479
|
-
title: string;
|
|
480
|
-
metadata: Record<string, unknown>;
|
|
481
|
-
}): Promise<StorageThreadType>;
|
|
482
|
-
deleteThread({ threadId }: {
|
|
483
|
-
threadId: string;
|
|
484
|
-
}): Promise<void>;
|
|
485
|
-
getMessages(args: StorageGetMessagesArg & {
|
|
486
|
-
format?: 'v1';
|
|
487
|
-
}): Promise<MastraMessageV1[]>;
|
|
488
|
-
getMessages(args: StorageGetMessagesArg & {
|
|
489
|
-
format: 'v2';
|
|
490
|
-
}): Promise<MastraMessageV2[]>;
|
|
491
|
-
saveMessages(args: {
|
|
492
|
-
messages: MastraMessageV1[];
|
|
493
|
-
format?: undefined | 'v1';
|
|
494
|
-
}): Promise<MastraMessageV1[]>;
|
|
495
|
-
saveMessages(args: {
|
|
496
|
-
messages: MastraMessageV2[];
|
|
497
|
-
format: 'v2';
|
|
498
|
-
}): Promise<MastraMessageV2[]>;
|
|
499
|
-
getThreadsByResourceIdPaginated(args: {
|
|
500
|
-
resourceId: string;
|
|
501
|
-
page?: number;
|
|
502
|
-
perPage?: number;
|
|
503
|
-
}): Promise<PaginationInfo & {
|
|
504
|
-
threads: StorageThreadType[];
|
|
505
|
-
}>;
|
|
506
|
-
/**
|
|
507
|
-
* Processes messages to include context messages based on withPreviousMessages and withNextMessages
|
|
508
|
-
* @param records - The sorted array of records to process
|
|
509
|
-
* @param include - The array of include specifications with context parameters
|
|
510
|
-
* @returns The processed array with context messages included
|
|
511
|
-
*/
|
|
512
|
-
private processMessagesWithContext;
|
|
513
|
-
getMessagesPaginated(args: StorageGetMessagesArg & {
|
|
514
|
-
format?: 'v1' | 'v2';
|
|
515
|
-
}): Promise<PaginationInfo & {
|
|
516
|
-
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
517
|
-
}>;
|
|
518
|
-
/**
|
|
519
|
-
* Parse message data from LanceDB record format to MastraMessageV2 format
|
|
520
|
-
*/
|
|
521
|
-
private parseMessageData;
|
|
522
|
-
updateMessages(args: {
|
|
523
|
-
messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
|
|
524
|
-
id: string;
|
|
525
|
-
content?: {
|
|
526
|
-
metadata?: MastraMessageContentV2['metadata'];
|
|
527
|
-
content?: MastraMessageContentV2['content'];
|
|
528
|
-
};
|
|
529
|
-
}[];
|
|
530
|
-
}): Promise<MastraMessageV2[]>;
|
|
531
|
-
getResourceById({ resourceId }: {
|
|
532
|
-
resourceId: string;
|
|
533
|
-
}): Promise<StorageResourceType | null>;
|
|
534
|
-
saveResource({ resource }: {
|
|
535
|
-
resource: StorageResourceType;
|
|
536
|
-
}): Promise<StorageResourceType>;
|
|
537
|
-
updateResource({ resourceId, workingMemory, metadata, }: {
|
|
538
|
-
resourceId: string;
|
|
539
|
-
workingMemory?: string;
|
|
540
|
-
metadata?: Record<string, unknown>;
|
|
541
|
-
}): Promise<StorageResourceType>;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
export declare class StoreOperationsLance extends StoreOperations {
|
|
545
|
-
client: Connection;
|
|
546
|
-
constructor({ client }: {
|
|
547
|
-
client: Connection;
|
|
548
|
-
});
|
|
549
|
-
protected getDefaultValue(type: StorageColumn['type']): string;
|
|
550
|
-
hasColumn(tableName: TABLE_NAMES, columnName: string): Promise<boolean>;
|
|
551
|
-
private translateSchema;
|
|
552
|
-
createTable({ tableName, schema, }: {
|
|
553
|
-
tableName: TABLE_NAMES;
|
|
554
|
-
schema: Record<string, StorageColumn>;
|
|
555
|
-
}): Promise<void>;
|
|
556
|
-
dropTable({ tableName }: {
|
|
557
|
-
tableName: TABLE_NAMES;
|
|
558
|
-
}): Promise<void>;
|
|
559
|
-
alterTable({ tableName, schema, ifNotExists, }: {
|
|
560
|
-
tableName: string;
|
|
561
|
-
schema: Record<string, StorageColumn>;
|
|
562
|
-
ifNotExists: string[];
|
|
563
|
-
}): Promise<void>;
|
|
564
|
-
clearTable({ tableName }: {
|
|
565
|
-
tableName: TABLE_NAMES;
|
|
566
|
-
}): Promise<void>;
|
|
567
|
-
insert({ tableName, record }: {
|
|
568
|
-
tableName: string;
|
|
569
|
-
record: Record<string, any>;
|
|
570
|
-
}): Promise<void>;
|
|
571
|
-
batchInsert({ tableName, records }: {
|
|
572
|
-
tableName: string;
|
|
573
|
-
records: Record<string, any>[];
|
|
574
|
-
}): Promise<void>;
|
|
575
|
-
load({ tableName, keys }: {
|
|
576
|
-
tableName: TABLE_NAMES;
|
|
577
|
-
keys: Record<string, any>;
|
|
578
|
-
}): Promise<any>;
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
export declare class StoreScoresLance extends ScoresStorage {
|
|
582
|
-
private client;
|
|
583
|
-
constructor({ client }: {
|
|
584
|
-
client: Connection;
|
|
585
|
-
});
|
|
586
|
-
saveScore(score: ScoreRowData): Promise<{
|
|
587
|
-
score: ScoreRowData;
|
|
588
|
-
}>;
|
|
589
|
-
getScoreById({ id }: {
|
|
590
|
-
id: string;
|
|
591
|
-
}): Promise<ScoreRowData | null>;
|
|
592
|
-
getScoresByScorerId({ scorerId, pagination, }: {
|
|
593
|
-
scorerId: string;
|
|
594
|
-
pagination: StoragePagination;
|
|
595
|
-
}): Promise<{
|
|
596
|
-
pagination: PaginationInfo;
|
|
597
|
-
scores: ScoreRowData[];
|
|
598
|
-
}>;
|
|
599
|
-
getScoresByRunId({ runId, pagination, }: {
|
|
600
|
-
runId: string;
|
|
601
|
-
pagination: StoragePagination;
|
|
602
|
-
}): Promise<{
|
|
603
|
-
pagination: PaginationInfo;
|
|
604
|
-
scores: ScoreRowData[];
|
|
605
|
-
}>;
|
|
606
|
-
getScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
607
|
-
pagination: StoragePagination;
|
|
608
|
-
entityId: string;
|
|
609
|
-
entityType: string;
|
|
610
|
-
}): Promise<{
|
|
611
|
-
pagination: PaginationInfo;
|
|
612
|
-
scores: ScoreRowData[];
|
|
613
|
-
}>;
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
export declare class StoreTracesLance extends TracesStorage {
|
|
617
|
-
private client;
|
|
618
|
-
private operations;
|
|
619
|
-
constructor({ client, operations }: {
|
|
620
|
-
client: Connection;
|
|
621
|
-
operations: StoreOperationsLance;
|
|
622
|
-
});
|
|
623
|
-
saveTrace({ trace }: {
|
|
624
|
-
trace: TraceType;
|
|
625
|
-
}): Promise<TraceType>;
|
|
626
|
-
getTraceById({ traceId }: {
|
|
627
|
-
traceId: string;
|
|
628
|
-
}): Promise<TraceType>;
|
|
629
|
-
getTraces({ name, scope, page, perPage, attributes, }: {
|
|
630
|
-
name?: string;
|
|
631
|
-
scope?: string;
|
|
632
|
-
page: number;
|
|
633
|
-
perPage: number;
|
|
634
|
-
attributes?: Record<string, string>;
|
|
635
|
-
}): Promise<Trace[]>;
|
|
636
|
-
getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
|
|
637
|
-
traces: Trace[];
|
|
638
|
-
}>;
|
|
639
|
-
batchTraceInsert({ records }: {
|
|
640
|
-
records: Record<string, any>[];
|
|
641
|
-
}): Promise<void>;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
export declare class StoreWorkflowsLance extends WorkflowsStorage {
|
|
645
|
-
client: Connection;
|
|
646
|
-
constructor({ client }: {
|
|
647
|
-
client: Connection;
|
|
648
|
-
});
|
|
649
|
-
persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
|
|
650
|
-
workflowName: string;
|
|
651
|
-
runId: string;
|
|
652
|
-
snapshot: WorkflowRunState_2;
|
|
653
|
-
}): Promise<void>;
|
|
654
|
-
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
655
|
-
workflowName: string;
|
|
656
|
-
runId: string;
|
|
657
|
-
}): Promise<WorkflowRunState_2 | null>;
|
|
658
|
-
getWorkflowRunById(args: {
|
|
659
|
-
runId: string;
|
|
660
|
-
workflowName?: string;
|
|
661
|
-
}): Promise<{
|
|
662
|
-
workflowName: string;
|
|
663
|
-
runId: string;
|
|
664
|
-
snapshot: any;
|
|
665
|
-
createdAt: Date;
|
|
666
|
-
updatedAt: Date;
|
|
667
|
-
} | null>;
|
|
668
|
-
getWorkflowRuns(args?: {
|
|
669
|
-
namespace?: string;
|
|
670
|
-
resourceId?: string;
|
|
671
|
-
workflowName?: string;
|
|
672
|
-
fromDate?: Date;
|
|
673
|
-
toDate?: Date;
|
|
674
|
-
limit?: number;
|
|
675
|
-
offset?: number;
|
|
676
|
-
}): Promise<WorkflowRuns_2>;
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
export declare function validateKeyTypes(keys: Record<string, any>, tableSchema: SchemaLike): void;
|
|
680
|
-
|
|
681
|
-
export { }
|