@mastra/pg 0.13.0 → 0.13.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/.turbo/turbo-build.log +2 -21
- package/CHANGELOG.md +23 -0
- package/dist/index.cjs +29 -17
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -17
- package/dist/index.js.map +1 -0
- package/dist/storage/domains/legacy-evals/index.d.ts +20 -0
- package/dist/storage/domains/legacy-evals/index.d.ts.map +1 -0
- package/dist/storage/domains/memory/index.d.ts +88 -0
- package/dist/storage/domains/memory/index.d.ts.map +1 -0
- package/dist/storage/domains/operations/index.d.ts +50 -0
- package/dist/storage/domains/operations/index.d.ts.map +1 -0
- package/dist/storage/domains/scores/index.d.ts +44 -0
- package/dist/storage/domains/scores/index.d.ts.map +1 -0
- package/dist/storage/domains/traces/index.d.ts +23 -0
- package/dist/storage/domains/traces/index.d.ts.map +1 -0
- package/dist/storage/domains/utils.d.ts +6 -0
- package/dist/storage/domains/utils.d.ts.map +1 -0
- package/dist/storage/domains/workflows/index.d.ts +36 -0
- package/dist/storage/domains/workflows/index.d.ts.map +1 -0
- package/dist/storage/index.d.ts +211 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/test-utils.d.ts +5 -0
- package/dist/storage/test-utils.d.ts.map +1 -0
- package/dist/vector/filter.d.ts +32 -0
- package/dist/vector/filter.d.ts.map +1 -0
- package/dist/vector/index.d.ts +99 -0
- package/dist/vector/index.d.ts.map +1 -0
- package/dist/vector/performance.helpers.d.ts +95 -0
- package/dist/vector/performance.helpers.d.ts.map +1 -0
- package/dist/vector/prompt.d.ts +6 -0
- package/dist/vector/prompt.d.ts.map +1 -0
- package/dist/vector/sql-builder.d.ts +8 -0
- package/dist/vector/sql-builder.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 +5 -5
- package/src/storage/domains/operations/index.ts +5 -3
- package/src/storage/domains/scores/index.ts +22 -8
- package/src/storage/domains/workflows/index.ts +5 -5
- package/src/storage/index.test.ts +1 -0
- package/src/storage/index.ts +1 -1
- package/tsconfig.build.json +9 -0
- package/tsconfig.json +1 -1
- package/tsup.config.ts +22 -0
- package/dist/_tsup-dts-rollup.d.cts +0 -786
- package/dist/_tsup-dts-rollup.d.ts +0 -786
- package/dist/index.d.cts +0 -5
|
@@ -1,786 +0,0 @@
|
|
|
1
|
-
import { BaseFilterTranslator } from '@mastra/core/vector/filter';
|
|
2
|
-
import type { BlacklistedRootOperators } from '@mastra/core/vector/filter';
|
|
3
|
-
import type { CreateIndexParams } from '@mastra/core/vector';
|
|
4
|
-
import type { DeleteIndexParams } from '@mastra/core/vector';
|
|
5
|
-
import type { DeleteVectorParams } from '@mastra/core/vector';
|
|
6
|
-
import type { DescribeIndexParams } from '@mastra/core/vector';
|
|
7
|
-
import type { EvalRow } from '@mastra/core/storage';
|
|
8
|
-
import type { IDatabase } from 'pg-promise';
|
|
9
|
-
import type { IndexStats } from '@mastra/core/vector';
|
|
10
|
-
import type { ISSLConfig } from 'pg-promise/typescript/pg-subset';
|
|
11
|
-
import { LegacyEvalsStorage } from '@mastra/core/storage';
|
|
12
|
-
import type { LogicalOperatorValueMap } from '@mastra/core/vector/filter';
|
|
13
|
-
import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
14
|
-
import type { MastraMessageV1 } from '@mastra/core/memory';
|
|
15
|
-
import type { MastraMessageV2 } from '@mastra/core/agent';
|
|
16
|
-
import type { MastraMessageV2 as MastraMessageV2_2 } from '@mastra/core/memory';
|
|
17
|
-
import { MastraStorage } from '@mastra/core/storage';
|
|
18
|
-
import { MastraVector } from '@mastra/core/vector';
|
|
19
|
-
import { MemoryStorage } from '@mastra/core/storage';
|
|
20
|
-
import type { OperatorSupport } from '@mastra/core/vector/filter';
|
|
21
|
-
import type { OperatorValueMap } from '@mastra/core/vector/filter';
|
|
22
|
-
import type { PaginationArgs } from '@mastra/core/storage';
|
|
23
|
-
import type { PaginationInfo } from '@mastra/core/storage';
|
|
24
|
-
import type { PaginationInfo as PaginationInfo_2 } from '@mastra/core';
|
|
25
|
-
import pg from 'pg';
|
|
26
|
-
import pgPromise from 'pg-promise';
|
|
27
|
-
import type { QueryResult } from '@mastra/core/vector';
|
|
28
|
-
import type { QueryVectorParams } from '@mastra/core/vector';
|
|
29
|
-
import type { ScoreRowData } from '@mastra/core/scores';
|
|
30
|
-
import { ScoresStorage } from '@mastra/core/storage';
|
|
31
|
-
import type { StorageColumn } from '@mastra/core/storage';
|
|
32
|
-
import type { StorageDomains } from '@mastra/core/storage';
|
|
33
|
-
import type { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
34
|
-
import type { StorageGetTracesArg } from '@mastra/core/storage';
|
|
35
|
-
import type { StorageGetTracesPaginatedArg } from '@mastra/core/storage';
|
|
36
|
-
import type { StoragePagination } from '@mastra/core/storage';
|
|
37
|
-
import type { StoragePagination as StoragePagination_2 } from '@mastra/core';
|
|
38
|
-
import type { StorageResourceType } from '@mastra/core/storage';
|
|
39
|
-
import type { StorageThreadType } from '@mastra/core/memory';
|
|
40
|
-
import { StoreOperations } from '@mastra/core/storage';
|
|
41
|
-
import type { TABLE_NAMES } from '@mastra/core/storage';
|
|
42
|
-
import type { ThreadSortOptions } from '@mastra/core/storage';
|
|
43
|
-
import type { Trace } from '@mastra/core/telemetry';
|
|
44
|
-
import { TracesStorage } from '@mastra/core/storage';
|
|
45
|
-
import type { UpdateVectorParams } from '@mastra/core/vector';
|
|
46
|
-
import type { UpsertVectorParams } from '@mastra/core/vector';
|
|
47
|
-
import type { VectorFieldValue } from '@mastra/core/vector/filter';
|
|
48
|
-
import type { VectorFilter } from '@mastra/core/vector/filter';
|
|
49
|
-
import type { WorkflowRun } from '@mastra/core/storage';
|
|
50
|
-
import type { WorkflowRun as WorkflowRun_2 } from '@mastra/core';
|
|
51
|
-
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
52
|
-
import type { WorkflowRuns as WorkflowRuns_2 } from '@mastra/core';
|
|
53
|
-
import type { WorkflowRunState } from '@mastra/core/workflows';
|
|
54
|
-
import type { WorkflowRunState as WorkflowRunState_2 } from '@mastra/core';
|
|
55
|
-
import { WorkflowsStorage } from '@mastra/core/storage';
|
|
56
|
-
|
|
57
|
-
export declare const baseTestConfigs: {
|
|
58
|
-
smokeTests: {
|
|
59
|
-
dimension: number;
|
|
60
|
-
size: number;
|
|
61
|
-
k: number;
|
|
62
|
-
queryCount: number;
|
|
63
|
-
}[];
|
|
64
|
-
'64': {
|
|
65
|
-
dimension: number;
|
|
66
|
-
size: number;
|
|
67
|
-
k: number;
|
|
68
|
-
queryCount: number;
|
|
69
|
-
}[];
|
|
70
|
-
'384': {
|
|
71
|
-
dimension: number;
|
|
72
|
-
size: number;
|
|
73
|
-
k: number;
|
|
74
|
-
queryCount: number;
|
|
75
|
-
}[];
|
|
76
|
-
'1024': {
|
|
77
|
-
dimension: number;
|
|
78
|
-
size: number;
|
|
79
|
-
k: number;
|
|
80
|
-
queryCount: number;
|
|
81
|
-
}[];
|
|
82
|
-
stressTests: {
|
|
83
|
-
dimension: number;
|
|
84
|
-
size: number;
|
|
85
|
-
k: number;
|
|
86
|
-
queryCount: number;
|
|
87
|
-
}[];
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export declare function buildFilterQuery(filter: PGVectorFilter, minScore: number, topK: number): FilterResult;
|
|
91
|
-
|
|
92
|
-
export declare const calculateRecall: (actual: number[], expected: number[], k: number) => number;
|
|
93
|
-
|
|
94
|
-
export declare const calculateTimeout: (dimension: number, size: number, k: number) => number;
|
|
95
|
-
|
|
96
|
-
export declare const connectionString: string;
|
|
97
|
-
|
|
98
|
-
export declare function cosineSimilarity(a: number[], b: number[]): number;
|
|
99
|
-
|
|
100
|
-
declare interface FilterResult {
|
|
101
|
-
sql: string;
|
|
102
|
-
values: any[];
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export declare const findNearestBruteForce: (query: number[], vectors: number[][], k: number) => number[];
|
|
106
|
-
|
|
107
|
-
export declare const formatTable: (data: any[], columns: string[]) => string;
|
|
108
|
-
|
|
109
|
-
export declare const generateClusteredVectors: (count: number, dim: number, numClusters?: number) => number[][];
|
|
110
|
-
|
|
111
|
-
export declare const generateRandomVectors: (count: number, dim: number) => number[][];
|
|
112
|
-
|
|
113
|
-
export declare const generateSkewedVectors: (count: number, dim: number) => number[][];
|
|
114
|
-
|
|
115
|
-
export declare const getHNSWConfig: (indexConfig: IndexConfig) => {
|
|
116
|
-
m: number;
|
|
117
|
-
efConstruction: number;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export declare function getIndexDescription({ type, hnsw, }: {
|
|
121
|
-
type: IndexType;
|
|
122
|
-
hnsw: {
|
|
123
|
-
m: number;
|
|
124
|
-
efConstruction: number;
|
|
125
|
-
};
|
|
126
|
-
}): string;
|
|
127
|
-
|
|
128
|
-
export declare const getListCount: (indexConfig: IndexConfig, size: number) => number | undefined;
|
|
129
|
-
|
|
130
|
-
export declare function getSchemaName(schema?: string): string | undefined;
|
|
131
|
-
|
|
132
|
-
export declare function getSearchEf(k: number, m: number): {
|
|
133
|
-
default: number;
|
|
134
|
-
lower: number;
|
|
135
|
-
higher: number;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
export declare function getTableName({ indexName, schemaName }: {
|
|
139
|
-
indexName: string;
|
|
140
|
-
schemaName?: string;
|
|
141
|
-
}): string;
|
|
142
|
-
|
|
143
|
-
export declare const groupBy: <T, K extends keyof T>(array: T[], key: K | ((item: T) => string), reducer?: (group: T[]) => any) => Record<string, any>;
|
|
144
|
-
|
|
145
|
-
declare interface HNSWConfig {
|
|
146
|
-
m?: number;
|
|
147
|
-
efConstruction?: number;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export declare interface IndexConfig {
|
|
151
|
-
type?: IndexType;
|
|
152
|
-
ivf?: IVFConfig;
|
|
153
|
-
hnsw?: HNSWConfig;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export declare type IndexType = 'ivfflat' | 'hnsw' | 'flat';
|
|
157
|
-
|
|
158
|
-
declare interface IVFConfig {
|
|
159
|
-
lists?: number;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export declare class LegacyEvalsPG extends LegacyEvalsStorage {
|
|
163
|
-
private client;
|
|
164
|
-
private schema;
|
|
165
|
-
constructor({ client, schema }: {
|
|
166
|
-
client: IDatabase<{}>;
|
|
167
|
-
schema: string;
|
|
168
|
-
});
|
|
169
|
-
/** @deprecated use getEvals instead */
|
|
170
|
-
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
171
|
-
getEvals(options?: {
|
|
172
|
-
agentName?: string;
|
|
173
|
-
type?: 'test' | 'live';
|
|
174
|
-
} & PaginationArgs): Promise<PaginationInfo & {
|
|
175
|
-
evals: EvalRow[];
|
|
176
|
-
}>;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export declare function measureLatency<T>(fn: () => Promise<T>): Promise<[number, T]>;
|
|
180
|
-
|
|
181
|
-
export declare class MemoryPG extends MemoryStorage {
|
|
182
|
-
private client;
|
|
183
|
-
private schema;
|
|
184
|
-
private operations;
|
|
185
|
-
constructor({ client, schema, operations, }: {
|
|
186
|
-
client: IDatabase<{}>;
|
|
187
|
-
schema: string;
|
|
188
|
-
operations: StoreOperationsPG;
|
|
189
|
-
});
|
|
190
|
-
getThreadById({ threadId }: {
|
|
191
|
-
threadId: string;
|
|
192
|
-
}): Promise<StorageThreadType | null>;
|
|
193
|
-
/**
|
|
194
|
-
* @deprecated use getThreadsByResourceIdPaginated instead
|
|
195
|
-
*/
|
|
196
|
-
getThreadsByResourceId(args: {
|
|
197
|
-
resourceId: string;
|
|
198
|
-
} & ThreadSortOptions): Promise<StorageThreadType[]>;
|
|
199
|
-
getThreadsByResourceIdPaginated(args: {
|
|
200
|
-
resourceId: string;
|
|
201
|
-
page: number;
|
|
202
|
-
perPage: number;
|
|
203
|
-
} & ThreadSortOptions): Promise<PaginationInfo & {
|
|
204
|
-
threads: StorageThreadType[];
|
|
205
|
-
}>;
|
|
206
|
-
saveThread({ thread }: {
|
|
207
|
-
thread: StorageThreadType;
|
|
208
|
-
}): Promise<StorageThreadType>;
|
|
209
|
-
updateThread({ id, title, metadata, }: {
|
|
210
|
-
id: string;
|
|
211
|
-
title: string;
|
|
212
|
-
metadata: Record<string, unknown>;
|
|
213
|
-
}): Promise<StorageThreadType>;
|
|
214
|
-
deleteThread({ threadId }: {
|
|
215
|
-
threadId: string;
|
|
216
|
-
}): Promise<void>;
|
|
217
|
-
private _getIncludedMessages;
|
|
218
|
-
/**
|
|
219
|
-
* @deprecated use getMessagesPaginated instead
|
|
220
|
-
*/
|
|
221
|
-
getMessages(args: StorageGetMessagesArg & {
|
|
222
|
-
format?: 'v1';
|
|
223
|
-
}): Promise<MastraMessageV1[]>;
|
|
224
|
-
getMessages(args: StorageGetMessagesArg & {
|
|
225
|
-
format: 'v2';
|
|
226
|
-
}): Promise<MastraMessageV2_2[]>;
|
|
227
|
-
getMessagesPaginated(args: StorageGetMessagesArg & {
|
|
228
|
-
format?: 'v1' | 'v2';
|
|
229
|
-
}): Promise<PaginationInfo & {
|
|
230
|
-
messages: MastraMessageV1[] | MastraMessageV2_2[];
|
|
231
|
-
}>;
|
|
232
|
-
saveMessages(args: {
|
|
233
|
-
messages: MastraMessageV1[];
|
|
234
|
-
format?: undefined | 'v1';
|
|
235
|
-
}): Promise<MastraMessageV1[]>;
|
|
236
|
-
saveMessages(args: {
|
|
237
|
-
messages: MastraMessageV2_2[];
|
|
238
|
-
format: 'v2';
|
|
239
|
-
}): Promise<MastraMessageV2_2[]>;
|
|
240
|
-
updateMessages({ messages, }: {
|
|
241
|
-
messages: (Partial<Omit<MastraMessageV2_2, 'createdAt'>> & {
|
|
242
|
-
id: string;
|
|
243
|
-
content?: {
|
|
244
|
-
metadata?: MastraMessageContentV2['metadata'];
|
|
245
|
-
content?: MastraMessageContentV2['content'];
|
|
246
|
-
};
|
|
247
|
-
})[];
|
|
248
|
-
}): Promise<MastraMessageV2_2[]>;
|
|
249
|
-
deleteMessages(messageIds: string[]): Promise<void>;
|
|
250
|
-
getResourceById({ resourceId }: {
|
|
251
|
-
resourceId: string;
|
|
252
|
-
}): Promise<StorageResourceType | null>;
|
|
253
|
-
saveResource({ resource }: {
|
|
254
|
-
resource: StorageResourceType;
|
|
255
|
-
}): Promise<StorageResourceType>;
|
|
256
|
-
updateResource({ resourceId, workingMemory, metadata, }: {
|
|
257
|
-
resourceId: string;
|
|
258
|
-
workingMemory?: string;
|
|
259
|
-
metadata?: Record<string, unknown>;
|
|
260
|
-
}): Promise<StorageResourceType>;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
declare type PGBlacklisted = BlacklistedRootOperators | '$contains' | '$size';
|
|
264
|
-
|
|
265
|
-
declare interface PgCreateIndexParams extends CreateIndexParams {
|
|
266
|
-
indexConfig?: IndexConfig;
|
|
267
|
-
buildIndex?: boolean;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
declare interface PgDefineIndexParams {
|
|
271
|
-
indexName: string;
|
|
272
|
-
metric: 'cosine' | 'euclidean' | 'dotproduct';
|
|
273
|
-
indexConfig: IndexConfig;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Translates MongoDB-style filters to PG compatible filters.
|
|
278
|
-
*
|
|
279
|
-
* Key differences from MongoDB:
|
|
280
|
-
*
|
|
281
|
-
* Logical Operators ($and, $or, $nor):
|
|
282
|
-
* - Can be used at the top level or nested within fields
|
|
283
|
-
* - Can take either a single condition or an array of conditions
|
|
284
|
-
*
|
|
285
|
-
*/
|
|
286
|
-
export declare class PGFilterTranslator extends BaseFilterTranslator<PGVectorFilter> {
|
|
287
|
-
protected getSupportedOperators(): OperatorSupport;
|
|
288
|
-
translate(filter?: PGVectorFilter): PGVectorFilter;
|
|
289
|
-
private translateNode;
|
|
290
|
-
private translateRegexPattern;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
declare type PGFilterValue = VectorFieldValue | RegExp;
|
|
294
|
-
|
|
295
|
-
declare interface PGIndexStats extends IndexStats {
|
|
296
|
-
type: IndexType;
|
|
297
|
-
config: {
|
|
298
|
-
m?: number;
|
|
299
|
-
efConstruction?: number;
|
|
300
|
-
lists?: number;
|
|
301
|
-
probes?: number;
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
export { PGIndexStats }
|
|
305
|
-
export { PGIndexStats as PGIndexStats_alias_1 }
|
|
306
|
-
|
|
307
|
-
declare type PGOperatorValueMap = Omit<OperatorValueMap, '$in' | '$all' | '$nin' | '$eq' | '$ne'> & {
|
|
308
|
-
$size: number;
|
|
309
|
-
$contains: VectorFieldValue | Record<string, unknown>;
|
|
310
|
-
$all: VectorFieldValue;
|
|
311
|
-
$in: VectorFieldValue;
|
|
312
|
-
$nin: VectorFieldValue;
|
|
313
|
-
$eq: VectorFieldValue;
|
|
314
|
-
$ne: VectorFieldValue;
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
declare interface PgQueryVectorParams extends QueryVectorParams<PGVectorFilter> {
|
|
318
|
-
minScore?: number;
|
|
319
|
-
/**
|
|
320
|
-
* HNSW search parameter. Controls the size of the dynamic candidate
|
|
321
|
-
* list during search. Higher values improve accuracy at the cost of speed.
|
|
322
|
-
*/
|
|
323
|
-
ef?: number;
|
|
324
|
-
/**
|
|
325
|
-
* IVFFlat probe parameter. Number of cells to visit during search.
|
|
326
|
-
* Higher values improve accuracy at the cost of speed.
|
|
327
|
-
*/
|
|
328
|
-
probes?: number;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
export declare function pgTests(): void;
|
|
332
|
-
|
|
333
|
-
declare class PgVector extends MastraVector<PGVectorFilter> {
|
|
334
|
-
pool: pg.Pool;
|
|
335
|
-
private describeIndexCache;
|
|
336
|
-
private createdIndexes;
|
|
337
|
-
private mutexesByName;
|
|
338
|
-
private schema?;
|
|
339
|
-
private setupSchemaPromise;
|
|
340
|
-
private installVectorExtensionPromise;
|
|
341
|
-
private vectorExtensionInstalled;
|
|
342
|
-
private schemaSetupComplete;
|
|
343
|
-
constructor({ connectionString, schemaName, pgPoolOptions, }: {
|
|
344
|
-
connectionString: string;
|
|
345
|
-
schemaName?: string;
|
|
346
|
-
pgPoolOptions?: Omit<pg.PoolConfig, 'connectionString'>;
|
|
347
|
-
});
|
|
348
|
-
private getMutexByName;
|
|
349
|
-
private getTableName;
|
|
350
|
-
private getSchemaName;
|
|
351
|
-
transformFilter(filter?: PGVectorFilter): PGVectorFilter;
|
|
352
|
-
getIndexInfo({ indexName }: DescribeIndexParams): Promise<PGIndexStats>;
|
|
353
|
-
query({ indexName, queryVector, topK, filter, includeVector, minScore, ef, probes, }: PgQueryVectorParams): Promise<QueryResult[]>;
|
|
354
|
-
upsert({ indexName, vectors, metadata, ids }: UpsertVectorParams): Promise<string[]>;
|
|
355
|
-
private hasher;
|
|
356
|
-
private getIndexCacheKey;
|
|
357
|
-
private cachedIndexExists;
|
|
358
|
-
private setupSchema;
|
|
359
|
-
createIndex({ indexName, dimension, metric, indexConfig, buildIndex, }: PgCreateIndexParams): Promise<void>;
|
|
360
|
-
buildIndex({ indexName, metric, indexConfig }: PgDefineIndexParams): Promise<void>;
|
|
361
|
-
private setupIndex;
|
|
362
|
-
private installVectorExtension;
|
|
363
|
-
listIndexes(): Promise<string[]>;
|
|
364
|
-
/**
|
|
365
|
-
* Retrieves statistics about a vector index.
|
|
366
|
-
*
|
|
367
|
-
* @param {string} indexName - The name of the index to describe
|
|
368
|
-
* @returns A promise that resolves to the index statistics including dimension, count and metric
|
|
369
|
-
*/
|
|
370
|
-
describeIndex({ indexName }: DescribeIndexParams): Promise<PGIndexStats>;
|
|
371
|
-
deleteIndex({ indexName }: DeleteIndexParams): Promise<void>;
|
|
372
|
-
truncateIndex({ indexName }: DeleteIndexParams): Promise<void>;
|
|
373
|
-
disconnect(): Promise<void>;
|
|
374
|
-
/**
|
|
375
|
-
* Updates a vector by its ID with the provided vector and/or metadata.
|
|
376
|
-
* @param indexName - The name of the index containing the vector.
|
|
377
|
-
* @param id - The ID of the vector to update.
|
|
378
|
-
* @param update - An object containing the vector and/or metadata to update.
|
|
379
|
-
* @param update.vector - An optional array of numbers representing the new vector.
|
|
380
|
-
* @param update.metadata - An optional record containing the new metadata.
|
|
381
|
-
* @returns A promise that resolves when the update is complete.
|
|
382
|
-
* @throws Will throw an error if no updates are provided or if the update operation fails.
|
|
383
|
-
*/
|
|
384
|
-
updateVector({ indexName, id, update }: UpdateVectorParams): Promise<void>;
|
|
385
|
-
/**
|
|
386
|
-
* Deletes a vector by its ID.
|
|
387
|
-
* @param indexName - The name of the index containing the vector.
|
|
388
|
-
* @param id - The ID of the vector to delete.
|
|
389
|
-
* @returns A promise that resolves when the deletion is complete.
|
|
390
|
-
* @throws Will throw an error if the deletion operation fails.
|
|
391
|
-
*/
|
|
392
|
-
deleteVector({ indexName, id }: DeleteVectorParams): Promise<void>;
|
|
393
|
-
}
|
|
394
|
-
export { PgVector }
|
|
395
|
-
export { PgVector as PgVector_alias_1 }
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* Vector store specific prompt that details supported operators and examples.
|
|
399
|
-
* This prompt helps users construct valid filters for PG Vector.
|
|
400
|
-
*/
|
|
401
|
-
declare const PGVECTOR_PROMPT = "When querying PG Vector, you can ONLY use the operators listed below. Any other operators will be rejected.\nImportant: Don't explain how to construct the filter - use the specified operators and fields to search the content and return relevant results.\nIf a user tries to give an explicit operator that is not supported, reject the filter entirely and let them know that the operator is not supported.\n\nBasic Comparison Operators:\n- $eq: Exact match (default when using field: value)\n Example: { \"category\": \"electronics\" }\n- $ne: Not equal\n Example: { \"category\": { \"$ne\": \"electronics\" } }\n- $gt: Greater than\n Example: { \"price\": { \"$gt\": 100 } }\n- $gte: Greater than or equal\n Example: { \"price\": { \"$gte\": 100 } }\n- $lt: Less than\n Example: { \"price\": { \"$lt\": 100 } }\n- $lte: Less than or equal\n Example: { \"price\": { \"$lte\": 100 } }\n\nArray Operators:\n- $in: Match any value in array\n Example: { \"category\": { \"$in\": [\"electronics\", \"books\"] } }\n- $nin: Does not match any value in array\n Example: { \"category\": { \"$nin\": [\"electronics\", \"books\"] } }\n- $all: Match all values in array\n Example: { \"tags\": { \"$all\": [\"premium\", \"sale\"] } }\n- $elemMatch: Match array elements that meet all specified conditions\n Example: { \"items\": { \"$elemMatch\": { \"price\": { \"$gt\": 100 } } } }\n- $contains: Check if array contains value\n Example: { \"tags\": { \"$contains\": \"premium\" } }\n\nLogical Operators:\n- $and: Logical AND (implicit when using multiple conditions)\n Example: { \"$and\": [{ \"price\": { \"$gt\": 100 } }, { \"category\": \"electronics\" }] }\n- $or: Logical OR\n Example: { \"$or\": [{ \"price\": { \"$lt\": 50 } }, { \"category\": \"books\" }] }\n- $not: Logical NOT\n Example: { \"$not\": { \"category\": \"electronics\" } }\n- $nor: Logical NOR\n Example: { \"$nor\": [{ \"price\": { \"$lt\": 50 } }, { \"category\": \"books\" }] }\n\nElement Operators:\n- $exists: Check if field exists\n Example: { \"rating\": { \"$exists\": true } }\n\nSpecial Operators:\n- $size: Array length check\n Example: { \"tags\": { \"$size\": 2 } }\n\nRestrictions:\n- Regex patterns are not supported\n- Direct RegExp patterns will throw an error\n- Nested fields are supported using dot notation\n- Multiple conditions on the same field are supported with both implicit and explicit $and\n- Array operations work on array fields only\n- Basic operators handle array values as JSON strings\n- Empty arrays in conditions are handled gracefully\n- Only logical operators ($and, $or, $not, $nor) can be used at the top level\n- All other operators must be used within a field condition\n Valid: { \"field\": { \"$gt\": 100 } }\n Valid: { \"$and\": [...] }\n Invalid: { \"$gt\": 100 }\n Invalid: { \"$contains\": \"value\" }\n- Logical operators must contain field conditions, not direct operators\n Valid: { \"$and\": [{ \"field\": { \"$gt\": 100 } }] }\n Invalid: { \"$and\": [{ \"$gt\": 100 }] }\n- $not operator:\n - Must be an object\n - Cannot be empty\n - Can be used at field level or top level\n - Valid: { \"$not\": { \"field\": \"value\" } }\n - Valid: { \"field\": { \"$not\": { \"$eq\": \"value\" } } }\n- Other logical operators ($and, $or, $nor):\n - Can only be used at top level or nested within other logical operators\n - Can not be used on a field level, or be nested inside a field\n - Can not be used inside an operator\n - Valid: { \"$and\": [{ \"field\": { \"$gt\": 100 } }] }\n - Valid: { \"$or\": [{ \"$and\": [{ \"field\": { \"$gt\": 100 } }] }] }\n - Invalid: { \"field\": { \"$and\": [{ \"$gt\": 100 }] } }\n - Invalid: { \"field\": { \"$or\": [{ \"$gt\": 100 }] } }\n - Invalid: { \"field\": { \"$gt\": { \"$and\": [{...}] } } }\n- $elemMatch requires an object with conditions\n Valid: { \"array\": { \"$elemMatch\": { \"field\": \"value\" } } }\n Invalid: { \"array\": { \"$elemMatch\": \"value\" } }\n\nExample Complex Query:\n{\n \"$and\": [\n { \"category\": { \"$in\": [\"electronics\", \"computers\"] } },\n { \"price\": { \"$gte\": 100, \"$lte\": 1000 } },\n { \"tags\": { \"$all\": [\"premium\"] } },\n { \"rating\": { \"$exists\": true, \"$gt\": 4 } },\n { \"$or\": [\n { \"stock\": { \"$gt\": 0 } },\n { \"preorder\": true }\n ]}\n ]\n}";
|
|
402
|
-
export { PGVECTOR_PROMPT }
|
|
403
|
-
export { PGVECTOR_PROMPT as PGVECTOR_PROMPT_alias_1 }
|
|
404
|
-
|
|
405
|
-
export declare type PGVectorFilter = VectorFilter<keyof PGOperatorValueMap, PGOperatorValueMap, LogicalOperatorValueMap, PGBlacklisted, PGFilterValue>;
|
|
406
|
-
|
|
407
|
-
declare type PostgresConfig = {
|
|
408
|
-
schemaName?: string;
|
|
409
|
-
} & ({
|
|
410
|
-
host: string;
|
|
411
|
-
port: number;
|
|
412
|
-
database: string;
|
|
413
|
-
user: string;
|
|
414
|
-
password: string;
|
|
415
|
-
ssl?: boolean | ISSLConfig;
|
|
416
|
-
} | {
|
|
417
|
-
connectionString: string;
|
|
418
|
-
});
|
|
419
|
-
export { PostgresConfig }
|
|
420
|
-
export { PostgresConfig as PostgresConfig_alias_1 }
|
|
421
|
-
|
|
422
|
-
declare class PostgresStore extends MastraStorage {
|
|
423
|
-
db: pgPromise.IDatabase<{}>;
|
|
424
|
-
pgp: pgPromise.IMain;
|
|
425
|
-
private client;
|
|
426
|
-
private schema?;
|
|
427
|
-
stores: StorageDomains;
|
|
428
|
-
constructor(config: PostgresConfig);
|
|
429
|
-
get supports(): {
|
|
430
|
-
selectByIncludeResourceScope: boolean;
|
|
431
|
-
resourceWorkingMemory: boolean;
|
|
432
|
-
hasColumn: boolean;
|
|
433
|
-
createTable: boolean;
|
|
434
|
-
deleteMessages: boolean;
|
|
435
|
-
};
|
|
436
|
-
/** @deprecated use getEvals instead */
|
|
437
|
-
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
438
|
-
getEvals(options?: {
|
|
439
|
-
agentName?: string;
|
|
440
|
-
type?: 'test' | 'live';
|
|
441
|
-
} & PaginationArgs): Promise<PaginationInfo & {
|
|
442
|
-
evals: EvalRow[];
|
|
443
|
-
}>;
|
|
444
|
-
/**
|
|
445
|
-
* @deprecated use getTracesPaginated instead
|
|
446
|
-
*/
|
|
447
|
-
getTraces(args: StorageGetTracesArg): Promise<Trace[]>;
|
|
448
|
-
getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
|
|
449
|
-
traces: Trace[];
|
|
450
|
-
}>;
|
|
451
|
-
batchTraceInsert({ records }: {
|
|
452
|
-
records: Record<string, any>[];
|
|
453
|
-
}): Promise<void>;
|
|
454
|
-
createTable({ tableName, schema, }: {
|
|
455
|
-
tableName: TABLE_NAMES;
|
|
456
|
-
schema: Record<string, StorageColumn>;
|
|
457
|
-
}): Promise<void>;
|
|
458
|
-
alterTable({ tableName, schema, ifNotExists, }: {
|
|
459
|
-
tableName: TABLE_NAMES;
|
|
460
|
-
schema: Record<string, StorageColumn>;
|
|
461
|
-
ifNotExists: string[];
|
|
462
|
-
}): Promise<void>;
|
|
463
|
-
clearTable({ tableName }: {
|
|
464
|
-
tableName: TABLE_NAMES;
|
|
465
|
-
}): Promise<void>;
|
|
466
|
-
dropTable({ tableName }: {
|
|
467
|
-
tableName: TABLE_NAMES;
|
|
468
|
-
}): Promise<void>;
|
|
469
|
-
insert({ tableName, record }: {
|
|
470
|
-
tableName: TABLE_NAMES;
|
|
471
|
-
record: Record<string, any>;
|
|
472
|
-
}): Promise<void>;
|
|
473
|
-
batchInsert({ tableName, records }: {
|
|
474
|
-
tableName: TABLE_NAMES;
|
|
475
|
-
records: Record<string, any>[];
|
|
476
|
-
}): Promise<void>;
|
|
477
|
-
load<R>({ tableName, keys }: {
|
|
478
|
-
tableName: TABLE_NAMES;
|
|
479
|
-
keys: Record<string, string>;
|
|
480
|
-
}): Promise<R | null>;
|
|
481
|
-
/**
|
|
482
|
-
* Memory
|
|
483
|
-
*/
|
|
484
|
-
getThreadById({ threadId }: {
|
|
485
|
-
threadId: string;
|
|
486
|
-
}): Promise<StorageThreadType | null>;
|
|
487
|
-
/**
|
|
488
|
-
* @deprecated use getThreadsByResourceIdPaginated instead
|
|
489
|
-
*/
|
|
490
|
-
getThreadsByResourceId(args: {
|
|
491
|
-
resourceId: string;
|
|
492
|
-
} & ThreadSortOptions): Promise<StorageThreadType[]>;
|
|
493
|
-
getThreadsByResourceIdPaginated(args: {
|
|
494
|
-
resourceId: string;
|
|
495
|
-
page: number;
|
|
496
|
-
perPage: number;
|
|
497
|
-
} & ThreadSortOptions): Promise<PaginationInfo & {
|
|
498
|
-
threads: StorageThreadType[];
|
|
499
|
-
}>;
|
|
500
|
-
saveThread({ thread }: {
|
|
501
|
-
thread: StorageThreadType;
|
|
502
|
-
}): Promise<StorageThreadType>;
|
|
503
|
-
updateThread({ id, title, metadata, }: {
|
|
504
|
-
id: string;
|
|
505
|
-
title: string;
|
|
506
|
-
metadata: Record<string, unknown>;
|
|
507
|
-
}): Promise<StorageThreadType>;
|
|
508
|
-
deleteThread({ threadId }: {
|
|
509
|
-
threadId: string;
|
|
510
|
-
}): Promise<void>;
|
|
511
|
-
/**
|
|
512
|
-
* @deprecated use getMessagesPaginated instead
|
|
513
|
-
*/
|
|
514
|
-
getMessages(args: StorageGetMessagesArg & {
|
|
515
|
-
format?: 'v1';
|
|
516
|
-
}): Promise<MastraMessageV1[]>;
|
|
517
|
-
getMessages(args: StorageGetMessagesArg & {
|
|
518
|
-
format: 'v2';
|
|
519
|
-
}): Promise<MastraMessageV2[]>;
|
|
520
|
-
getMessagesPaginated(args: StorageGetMessagesArg & {
|
|
521
|
-
format?: 'v1' | 'v2';
|
|
522
|
-
}): Promise<PaginationInfo & {
|
|
523
|
-
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
524
|
-
}>;
|
|
525
|
-
saveMessages(args: {
|
|
526
|
-
messages: MastraMessageV1[];
|
|
527
|
-
format?: undefined | 'v1';
|
|
528
|
-
}): Promise<MastraMessageV1[]>;
|
|
529
|
-
saveMessages(args: {
|
|
530
|
-
messages: MastraMessageV2[];
|
|
531
|
-
format: 'v2';
|
|
532
|
-
}): Promise<MastraMessageV2[]>;
|
|
533
|
-
updateMessages({ messages, }: {
|
|
534
|
-
messages: (Partial<Omit<MastraMessageV2, 'createdAt'>> & {
|
|
535
|
-
id: string;
|
|
536
|
-
content?: {
|
|
537
|
-
metadata?: MastraMessageContentV2['metadata'];
|
|
538
|
-
content?: MastraMessageContentV2['content'];
|
|
539
|
-
};
|
|
540
|
-
})[];
|
|
541
|
-
}): Promise<MastraMessageV2[]>;
|
|
542
|
-
deleteMessages(messageIds: string[]): Promise<void>;
|
|
543
|
-
getResourceById({ resourceId }: {
|
|
544
|
-
resourceId: string;
|
|
545
|
-
}): Promise<StorageResourceType | null>;
|
|
546
|
-
saveResource({ resource }: {
|
|
547
|
-
resource: StorageResourceType;
|
|
548
|
-
}): Promise<StorageResourceType>;
|
|
549
|
-
updateResource({ resourceId, workingMemory, metadata, }: {
|
|
550
|
-
resourceId: string;
|
|
551
|
-
workingMemory?: string;
|
|
552
|
-
metadata?: Record<string, unknown>;
|
|
553
|
-
}): Promise<StorageResourceType>;
|
|
554
|
-
/**
|
|
555
|
-
* Workflows
|
|
556
|
-
*/
|
|
557
|
-
persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
|
|
558
|
-
workflowName: string;
|
|
559
|
-
runId: string;
|
|
560
|
-
snapshot: WorkflowRunState;
|
|
561
|
-
}): Promise<void>;
|
|
562
|
-
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
563
|
-
workflowName: string;
|
|
564
|
-
runId: string;
|
|
565
|
-
}): Promise<WorkflowRunState | null>;
|
|
566
|
-
getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
|
|
567
|
-
workflowName?: string;
|
|
568
|
-
fromDate?: Date;
|
|
569
|
-
toDate?: Date;
|
|
570
|
-
limit?: number;
|
|
571
|
-
offset?: number;
|
|
572
|
-
resourceId?: string;
|
|
573
|
-
}): Promise<WorkflowRuns>;
|
|
574
|
-
getWorkflowRunById({ runId, workflowName, }: {
|
|
575
|
-
runId: string;
|
|
576
|
-
workflowName?: string;
|
|
577
|
-
}): Promise<WorkflowRun | null>;
|
|
578
|
-
close(): Promise<void>;
|
|
579
|
-
/**
|
|
580
|
-
* Scorers
|
|
581
|
-
*/
|
|
582
|
-
getScoreById({ id: _id }: {
|
|
583
|
-
id: string;
|
|
584
|
-
}): Promise<ScoreRowData | null>;
|
|
585
|
-
getScoresByScorerId({ scorerId: _scorerId, pagination: _pagination, }: {
|
|
586
|
-
scorerId: string;
|
|
587
|
-
pagination: StoragePagination;
|
|
588
|
-
}): Promise<{
|
|
589
|
-
pagination: PaginationInfo;
|
|
590
|
-
scores: ScoreRowData[];
|
|
591
|
-
}>;
|
|
592
|
-
saveScore(_score: ScoreRowData): Promise<{
|
|
593
|
-
score: ScoreRowData;
|
|
594
|
-
}>;
|
|
595
|
-
getScoresByRunId({ runId: _runId, pagination: _pagination, }: {
|
|
596
|
-
runId: string;
|
|
597
|
-
pagination: StoragePagination;
|
|
598
|
-
}): Promise<{
|
|
599
|
-
pagination: PaginationInfo;
|
|
600
|
-
scores: ScoreRowData[];
|
|
601
|
-
}>;
|
|
602
|
-
getScoresByEntityId({ entityId: _entityId, entityType: _entityType, pagination: _pagination, }: {
|
|
603
|
-
pagination: StoragePagination;
|
|
604
|
-
entityId: string;
|
|
605
|
-
entityType: string;
|
|
606
|
-
}): Promise<{
|
|
607
|
-
pagination: PaginationInfo;
|
|
608
|
-
scores: ScoreRowData[];
|
|
609
|
-
}>;
|
|
610
|
-
}
|
|
611
|
-
export { PostgresStore }
|
|
612
|
-
export { PostgresStore as PostgresStore_alias_1 }
|
|
613
|
-
|
|
614
|
-
export declare class ScoresPG extends ScoresStorage {
|
|
615
|
-
client: IDatabase<{}>;
|
|
616
|
-
private operations;
|
|
617
|
-
constructor({ client, operations }: {
|
|
618
|
-
client: IDatabase<{}>;
|
|
619
|
-
operations: StoreOperationsPG;
|
|
620
|
-
});
|
|
621
|
-
getScoreById({ id }: {
|
|
622
|
-
id: string;
|
|
623
|
-
}): Promise<ScoreRowData | null>;
|
|
624
|
-
getScoresByScorerId({ scorerId, pagination, }: {
|
|
625
|
-
scorerId: string;
|
|
626
|
-
pagination: StoragePagination_2;
|
|
627
|
-
}): Promise<{
|
|
628
|
-
pagination: PaginationInfo_2;
|
|
629
|
-
scores: ScoreRowData[];
|
|
630
|
-
}>;
|
|
631
|
-
saveScore(score: Omit<ScoreRowData, 'createdAt' | 'updatedAt'>): Promise<{
|
|
632
|
-
score: ScoreRowData;
|
|
633
|
-
}>;
|
|
634
|
-
getScoresByRunId({ runId, pagination, }: {
|
|
635
|
-
runId: string;
|
|
636
|
-
pagination: StoragePagination_2;
|
|
637
|
-
}): Promise<{
|
|
638
|
-
pagination: PaginationInfo_2;
|
|
639
|
-
scores: ScoreRowData[];
|
|
640
|
-
}>;
|
|
641
|
-
getScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
642
|
-
pagination: StoragePagination_2;
|
|
643
|
-
entityId: string;
|
|
644
|
-
entityType: string;
|
|
645
|
-
}): Promise<{
|
|
646
|
-
pagination: PaginationInfo_2;
|
|
647
|
-
scores: ScoreRowData[];
|
|
648
|
-
}>;
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
export declare class StoreOperationsPG extends StoreOperations {
|
|
652
|
-
client: IDatabase<{}>;
|
|
653
|
-
schemaName?: string;
|
|
654
|
-
private setupSchemaPromise;
|
|
655
|
-
private schemaSetupComplete;
|
|
656
|
-
constructor({ client, schemaName }: {
|
|
657
|
-
client: IDatabase<{}>;
|
|
658
|
-
schemaName?: string;
|
|
659
|
-
});
|
|
660
|
-
hasColumn(table: string, column: string): Promise<boolean>;
|
|
661
|
-
private setupSchema;
|
|
662
|
-
insert({ tableName, record }: {
|
|
663
|
-
tableName: TABLE_NAMES;
|
|
664
|
-
record: Record<string, any>;
|
|
665
|
-
}): Promise<void>;
|
|
666
|
-
clearTable({ tableName }: {
|
|
667
|
-
tableName: TABLE_NAMES;
|
|
668
|
-
}): Promise<void>;
|
|
669
|
-
protected getDefaultValue(type: StorageColumn['type']): string;
|
|
670
|
-
createTable({ tableName, schema, }: {
|
|
671
|
-
tableName: TABLE_NAMES;
|
|
672
|
-
schema: Record<string, StorageColumn>;
|
|
673
|
-
}): Promise<void>;
|
|
674
|
-
/**
|
|
675
|
-
* Alters table schema to add columns if they don't exist
|
|
676
|
-
* @param tableName Name of the table
|
|
677
|
-
* @param schema Schema of the table
|
|
678
|
-
* @param ifNotExists Array of column names to add if they don't exist
|
|
679
|
-
*/
|
|
680
|
-
alterTable({ tableName, schema, ifNotExists, }: {
|
|
681
|
-
tableName: TABLE_NAMES;
|
|
682
|
-
schema: Record<string, StorageColumn>;
|
|
683
|
-
ifNotExists: string[];
|
|
684
|
-
}): Promise<void>;
|
|
685
|
-
load<R>({ tableName, keys }: {
|
|
686
|
-
tableName: TABLE_NAMES;
|
|
687
|
-
keys: Record<string, string>;
|
|
688
|
-
}): Promise<R | null>;
|
|
689
|
-
batchInsert({ tableName, records }: {
|
|
690
|
-
tableName: TABLE_NAMES;
|
|
691
|
-
records: Record<string, any>[];
|
|
692
|
-
}): Promise<void>;
|
|
693
|
-
dropTable({ tableName }: {
|
|
694
|
-
tableName: TABLE_NAMES;
|
|
695
|
-
}): Promise<void>;
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
export declare const TEST_CONFIG: PostgresConfig;
|
|
699
|
-
|
|
700
|
-
export declare interface TestConfig {
|
|
701
|
-
dimension: number;
|
|
702
|
-
size: number;
|
|
703
|
-
k: number;
|
|
704
|
-
queryCount: number;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
export declare interface TestResult {
|
|
708
|
-
distribution: string;
|
|
709
|
-
dimension: number;
|
|
710
|
-
type: IndexType;
|
|
711
|
-
size: number;
|
|
712
|
-
k?: number;
|
|
713
|
-
metrics: {
|
|
714
|
-
recall?: number;
|
|
715
|
-
minRecall?: number;
|
|
716
|
-
maxRecall?: number;
|
|
717
|
-
latency?: {
|
|
718
|
-
p50: number;
|
|
719
|
-
p95: number;
|
|
720
|
-
lists?: number;
|
|
721
|
-
vectorsPerList?: number;
|
|
722
|
-
m?: number;
|
|
723
|
-
ef?: number;
|
|
724
|
-
};
|
|
725
|
-
clustering?: {
|
|
726
|
-
numLists?: number;
|
|
727
|
-
avgVectorsPerList?: number;
|
|
728
|
-
recommendedLists?: number;
|
|
729
|
-
distribution?: string;
|
|
730
|
-
};
|
|
731
|
-
};
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
export declare class TracesPG extends TracesStorage {
|
|
735
|
-
client: IDatabase<{}>;
|
|
736
|
-
private operations;
|
|
737
|
-
private schema?;
|
|
738
|
-
constructor({ client, operations, schema, }: {
|
|
739
|
-
client: IDatabase<{}>;
|
|
740
|
-
operations: StoreOperationsPG;
|
|
741
|
-
schema?: string;
|
|
742
|
-
});
|
|
743
|
-
getTraces(args: StorageGetTracesArg): Promise<Trace[]>;
|
|
744
|
-
getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
|
|
745
|
-
traces: Trace[];
|
|
746
|
-
}>;
|
|
747
|
-
batchTraceInsert({ records }: {
|
|
748
|
-
records: Record<string, any>[];
|
|
749
|
-
}): Promise<void>;
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
export declare function warmupQuery(vectorDB: PgVector, indexName: string, dimension: number, k: number): Promise<void>;
|
|
753
|
-
|
|
754
|
-
export declare class WorkflowsPG extends WorkflowsStorage {
|
|
755
|
-
client: IDatabase<{}>;
|
|
756
|
-
private operations;
|
|
757
|
-
private schema;
|
|
758
|
-
constructor({ client, operations, schema, }: {
|
|
759
|
-
client: IDatabase<{}>;
|
|
760
|
-
operations: StoreOperationsPG;
|
|
761
|
-
schema: string;
|
|
762
|
-
});
|
|
763
|
-
persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
|
|
764
|
-
workflowName: string;
|
|
765
|
-
runId: string;
|
|
766
|
-
snapshot: WorkflowRunState_2;
|
|
767
|
-
}): Promise<void>;
|
|
768
|
-
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
769
|
-
workflowName: string;
|
|
770
|
-
runId: string;
|
|
771
|
-
}): Promise<WorkflowRunState_2 | null>;
|
|
772
|
-
getWorkflowRunById({ runId, workflowName, }: {
|
|
773
|
-
runId: string;
|
|
774
|
-
workflowName?: string;
|
|
775
|
-
}): Promise<WorkflowRun_2 | null>;
|
|
776
|
-
getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
|
|
777
|
-
workflowName?: string;
|
|
778
|
-
fromDate?: Date;
|
|
779
|
-
toDate?: Date;
|
|
780
|
-
limit?: number;
|
|
781
|
-
offset?: number;
|
|
782
|
-
resourceId?: string;
|
|
783
|
-
}): Promise<WorkflowRuns_2>;
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
export { }
|