@lov3kaizen/agentsea-evaluate 0.5.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/LICENSE +21 -0
- package/README.md +339 -0
- package/dist/annotation/index.d.mts +3 -0
- package/dist/annotation/index.d.ts +3 -0
- package/dist/annotation/index.js +630 -0
- package/dist/annotation/index.mjs +22 -0
- package/dist/chunk-5JRYKRSE.mjs +2791 -0
- package/dist/chunk-EUXXIZK3.mjs +676 -0
- package/dist/chunk-NBMUSATK.mjs +596 -0
- package/dist/chunk-PAQ2TTJJ.mjs +1105 -0
- package/dist/chunk-TUMNJN2S.mjs +416 -0
- package/dist/continuous/index.d.mts +2 -0
- package/dist/continuous/index.d.ts +2 -0
- package/dist/continuous/index.js +707 -0
- package/dist/continuous/index.mjs +16 -0
- package/dist/datasets/index.d.mts +1 -0
- package/dist/datasets/index.d.ts +1 -0
- package/dist/datasets/index.js +456 -0
- package/dist/datasets/index.mjs +14 -0
- package/dist/evaluation/index.d.mts +1 -0
- package/dist/evaluation/index.d.ts +1 -0
- package/dist/evaluation/index.js +2853 -0
- package/dist/evaluation/index.mjs +78 -0
- package/dist/feedback/index.d.mts +2 -0
- package/dist/feedback/index.d.ts +2 -0
- package/dist/feedback/index.js +1158 -0
- package/dist/feedback/index.mjs +40 -0
- package/dist/index-6Pbiq7ny.d.mts +234 -0
- package/dist/index-6Pbiq7ny.d.ts +234 -0
- package/dist/index-BNTycFEA.d.mts +479 -0
- package/dist/index-BNTycFEA.d.ts +479 -0
- package/dist/index-CTYCfWfH.d.mts +543 -0
- package/dist/index-CTYCfWfH.d.ts +543 -0
- package/dist/index-Cq5LwG_3.d.mts +322 -0
- package/dist/index-Cq5LwG_3.d.ts +322 -0
- package/dist/index-bPghFsfP.d.mts +315 -0
- package/dist/index-bPghFsfP.d.ts +315 -0
- package/dist/index.d.mts +81 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.js +5962 -0
- package/dist/index.mjs +429 -0
- package/package.json +102 -0
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
type ThumbsRating = 'up' | 'down';
|
|
4
|
+
type StarRating = 1 | 2 | 3 | 4 | 5;
|
|
5
|
+
type PreferenceChoice = 'A' | 'B' | 'tie';
|
|
6
|
+
interface BaseFeedbackEntry {
|
|
7
|
+
id: string;
|
|
8
|
+
responseId: string;
|
|
9
|
+
conversationId?: string;
|
|
10
|
+
input: string;
|
|
11
|
+
output: string;
|
|
12
|
+
userId?: string;
|
|
13
|
+
timestamp: number;
|
|
14
|
+
metadata?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
interface ThumbsFeedback extends BaseFeedbackEntry {
|
|
17
|
+
type: 'thumbs';
|
|
18
|
+
rating: ThumbsRating;
|
|
19
|
+
comment?: string;
|
|
20
|
+
}
|
|
21
|
+
interface RatingFeedback extends BaseFeedbackEntry {
|
|
22
|
+
type: 'rating';
|
|
23
|
+
rating: StarRating;
|
|
24
|
+
maxRating?: number;
|
|
25
|
+
comment?: string;
|
|
26
|
+
}
|
|
27
|
+
interface PreferenceFeedback extends BaseFeedbackEntry {
|
|
28
|
+
type: 'preference';
|
|
29
|
+
responseA: {
|
|
30
|
+
id: string;
|
|
31
|
+
content: string;
|
|
32
|
+
model?: string;
|
|
33
|
+
};
|
|
34
|
+
responseB: {
|
|
35
|
+
id: string;
|
|
36
|
+
content: string;
|
|
37
|
+
model?: string;
|
|
38
|
+
};
|
|
39
|
+
preference: PreferenceChoice;
|
|
40
|
+
reason?: string;
|
|
41
|
+
confidence?: number;
|
|
42
|
+
}
|
|
43
|
+
interface CorrectionFeedback extends BaseFeedbackEntry {
|
|
44
|
+
type: 'correction';
|
|
45
|
+
correctedOutput: string;
|
|
46
|
+
correctionType: 'factual' | 'grammar' | 'style' | 'completeness' | 'other';
|
|
47
|
+
explanation?: string;
|
|
48
|
+
}
|
|
49
|
+
interface MultiCriteriaFeedback extends BaseFeedbackEntry {
|
|
50
|
+
type: 'multi_criteria';
|
|
51
|
+
criteria: CriterionRating[];
|
|
52
|
+
overallRating?: StarRating;
|
|
53
|
+
comment?: string;
|
|
54
|
+
}
|
|
55
|
+
interface CriterionDefinition {
|
|
56
|
+
name: string;
|
|
57
|
+
description: string;
|
|
58
|
+
scale: [number, number];
|
|
59
|
+
weight?: number;
|
|
60
|
+
}
|
|
61
|
+
interface CriterionRating {
|
|
62
|
+
name: string;
|
|
63
|
+
rating: number;
|
|
64
|
+
correction?: string;
|
|
65
|
+
}
|
|
66
|
+
type FeedbackEntry = ThumbsFeedback | RatingFeedback | PreferenceFeedback | CorrectionFeedback | MultiCriteriaFeedback;
|
|
67
|
+
interface FeedbackCollectorOptions {
|
|
68
|
+
store?: FeedbackStoreInterface;
|
|
69
|
+
autoTimestamp?: boolean;
|
|
70
|
+
generateId?: () => string;
|
|
71
|
+
validateInput?: boolean;
|
|
72
|
+
}
|
|
73
|
+
interface ThumbsCollectorOptions extends FeedbackCollectorOptions {
|
|
74
|
+
allowComment?: boolean;
|
|
75
|
+
requireComment?: 'always' | 'on_down' | 'never';
|
|
76
|
+
}
|
|
77
|
+
interface RatingCollectorOptions extends FeedbackCollectorOptions {
|
|
78
|
+
allowComment?: boolean;
|
|
79
|
+
minRating?: StarRating;
|
|
80
|
+
maxRating?: StarRating;
|
|
81
|
+
requireComment?: 'always' | 'on_low' | 'never';
|
|
82
|
+
lowRatingThreshold?: number;
|
|
83
|
+
}
|
|
84
|
+
interface PreferenceCollectorOptions extends FeedbackCollectorOptions {
|
|
85
|
+
allowTie?: boolean;
|
|
86
|
+
requireReason?: boolean;
|
|
87
|
+
requireConfidence?: boolean;
|
|
88
|
+
minConfidence?: number;
|
|
89
|
+
}
|
|
90
|
+
interface MultiCriteriaCollectorOptions extends FeedbackCollectorOptions {
|
|
91
|
+
criteria: CriterionDefinition[];
|
|
92
|
+
requireAllCriteria?: boolean;
|
|
93
|
+
allowCorrections?: boolean;
|
|
94
|
+
}
|
|
95
|
+
interface CollectThumbsInput {
|
|
96
|
+
responseId: string;
|
|
97
|
+
conversationId?: string;
|
|
98
|
+
input: string;
|
|
99
|
+
output: string;
|
|
100
|
+
feedback: {
|
|
101
|
+
rating: ThumbsRating;
|
|
102
|
+
comment?: string;
|
|
103
|
+
};
|
|
104
|
+
userId?: string;
|
|
105
|
+
metadata?: Record<string, unknown>;
|
|
106
|
+
}
|
|
107
|
+
interface CollectRatingInput {
|
|
108
|
+
responseId: string;
|
|
109
|
+
conversationId?: string;
|
|
110
|
+
input: string;
|
|
111
|
+
output: string;
|
|
112
|
+
feedback: {
|
|
113
|
+
rating: StarRating;
|
|
114
|
+
comment?: string;
|
|
115
|
+
};
|
|
116
|
+
userId?: string;
|
|
117
|
+
metadata?: Record<string, unknown>;
|
|
118
|
+
}
|
|
119
|
+
interface CollectPreferenceInput {
|
|
120
|
+
input: string;
|
|
121
|
+
responseA: {
|
|
122
|
+
id: string;
|
|
123
|
+
content: string;
|
|
124
|
+
model?: string;
|
|
125
|
+
};
|
|
126
|
+
responseB: {
|
|
127
|
+
id: string;
|
|
128
|
+
content: string;
|
|
129
|
+
model?: string;
|
|
130
|
+
};
|
|
131
|
+
preference: PreferenceChoice;
|
|
132
|
+
reason?: string;
|
|
133
|
+
confidence?: number;
|
|
134
|
+
userId?: string;
|
|
135
|
+
metadata?: Record<string, unknown>;
|
|
136
|
+
}
|
|
137
|
+
interface CollectCorrectionInput {
|
|
138
|
+
responseId: string;
|
|
139
|
+
conversationId?: string;
|
|
140
|
+
input: string;
|
|
141
|
+
output: string;
|
|
142
|
+
correctedOutput: string;
|
|
143
|
+
correctionType: 'factual' | 'grammar' | 'style' | 'completeness' | 'other';
|
|
144
|
+
explanation?: string;
|
|
145
|
+
userId?: string;
|
|
146
|
+
metadata?: Record<string, unknown>;
|
|
147
|
+
}
|
|
148
|
+
interface CollectMultiCriteriaInput {
|
|
149
|
+
responseId: string;
|
|
150
|
+
conversationId?: string;
|
|
151
|
+
input: string;
|
|
152
|
+
output: string;
|
|
153
|
+
ratings: Record<string, number>;
|
|
154
|
+
corrections?: Record<string, string>;
|
|
155
|
+
overallRating?: StarRating;
|
|
156
|
+
comment?: string;
|
|
157
|
+
userId?: string;
|
|
158
|
+
metadata?: Record<string, unknown>;
|
|
159
|
+
}
|
|
160
|
+
interface FeedbackStoreInterface {
|
|
161
|
+
save(entry: FeedbackEntry): Promise<string>;
|
|
162
|
+
saveBatch(entries: FeedbackEntry[]): Promise<string[]>;
|
|
163
|
+
get(id: string): Promise<FeedbackEntry | null>;
|
|
164
|
+
query(options: FeedbackQueryOptions): Promise<FeedbackQueryResult>;
|
|
165
|
+
delete(id: string): Promise<boolean>;
|
|
166
|
+
clear(): Promise<void>;
|
|
167
|
+
close(): Promise<void>;
|
|
168
|
+
}
|
|
169
|
+
interface FeedbackQueryOptions {
|
|
170
|
+
type?: FeedbackEntry['type'] | FeedbackEntry['type'][];
|
|
171
|
+
userId?: string;
|
|
172
|
+
conversationId?: string;
|
|
173
|
+
responseId?: string;
|
|
174
|
+
startTime?: number;
|
|
175
|
+
endTime?: number;
|
|
176
|
+
limit?: number;
|
|
177
|
+
offset?: number;
|
|
178
|
+
orderBy?: 'timestamp' | 'rating';
|
|
179
|
+
orderDir?: 'asc' | 'desc';
|
|
180
|
+
metadata?: Record<string, unknown>;
|
|
181
|
+
}
|
|
182
|
+
interface FeedbackQueryResult {
|
|
183
|
+
entries: FeedbackEntry[];
|
|
184
|
+
total: number;
|
|
185
|
+
hasMore: boolean;
|
|
186
|
+
}
|
|
187
|
+
interface AggregationOptions {
|
|
188
|
+
groupBy?: 'model' | 'userId' | 'hour' | 'day' | 'week' | 'month';
|
|
189
|
+
metrics: AggregationMetric[];
|
|
190
|
+
timeRange?: {
|
|
191
|
+
start: number;
|
|
192
|
+
end: number;
|
|
193
|
+
};
|
|
194
|
+
filters?: FeedbackQueryOptions;
|
|
195
|
+
}
|
|
196
|
+
type AggregationMetric = 'thumbsUpRate' | 'avgRating' | 'correctionRate' | 'preferenceWinRate' | 'count' | 'avgCriteriaRating';
|
|
197
|
+
interface AggregationResult {
|
|
198
|
+
groupKey: string;
|
|
199
|
+
metrics: Record<AggregationMetric, number>;
|
|
200
|
+
count: number;
|
|
201
|
+
}
|
|
202
|
+
type ExportFormat = 'json' | 'csv' | 'jsonl';
|
|
203
|
+
interface ExportOptions {
|
|
204
|
+
format: ExportFormat;
|
|
205
|
+
query?: FeedbackQueryOptions;
|
|
206
|
+
fields?: string[];
|
|
207
|
+
includeMetadata?: boolean;
|
|
208
|
+
}
|
|
209
|
+
interface FeedbackStoreConfig {
|
|
210
|
+
type: 'memory' | 'sqlite' | 'postgres';
|
|
211
|
+
path?: string;
|
|
212
|
+
connectionString?: string;
|
|
213
|
+
tableName?: string;
|
|
214
|
+
}
|
|
215
|
+
declare const ThumbsRatingSchema: z.ZodEnum<["up", "down"]>;
|
|
216
|
+
declare const StarRatingSchema: z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
|
|
217
|
+
declare const PreferenceChoiceSchema: z.ZodEnum<["A", "B", "tie"]>;
|
|
218
|
+
declare const CollectThumbsInputSchema: z.ZodObject<{
|
|
219
|
+
responseId: z.ZodString;
|
|
220
|
+
conversationId: z.ZodOptional<z.ZodString>;
|
|
221
|
+
input: z.ZodString;
|
|
222
|
+
output: z.ZodString;
|
|
223
|
+
feedback: z.ZodObject<{
|
|
224
|
+
rating: z.ZodEnum<["up", "down"]>;
|
|
225
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
226
|
+
}, "strip", z.ZodTypeAny, {
|
|
227
|
+
rating: "up" | "down";
|
|
228
|
+
comment?: string | undefined;
|
|
229
|
+
}, {
|
|
230
|
+
rating: "up" | "down";
|
|
231
|
+
comment?: string | undefined;
|
|
232
|
+
}>;
|
|
233
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
234
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
235
|
+
}, "strip", z.ZodTypeAny, {
|
|
236
|
+
responseId: string;
|
|
237
|
+
input: string;
|
|
238
|
+
output: string;
|
|
239
|
+
feedback: {
|
|
240
|
+
rating: "up" | "down";
|
|
241
|
+
comment?: string | undefined;
|
|
242
|
+
};
|
|
243
|
+
userId?: string | undefined;
|
|
244
|
+
conversationId?: string | undefined;
|
|
245
|
+
metadata?: Record<string, unknown> | undefined;
|
|
246
|
+
}, {
|
|
247
|
+
responseId: string;
|
|
248
|
+
input: string;
|
|
249
|
+
output: string;
|
|
250
|
+
feedback: {
|
|
251
|
+
rating: "up" | "down";
|
|
252
|
+
comment?: string | undefined;
|
|
253
|
+
};
|
|
254
|
+
userId?: string | undefined;
|
|
255
|
+
conversationId?: string | undefined;
|
|
256
|
+
metadata?: Record<string, unknown> | undefined;
|
|
257
|
+
}>;
|
|
258
|
+
declare const CollectPreferenceInputSchema: z.ZodObject<{
|
|
259
|
+
input: z.ZodString;
|
|
260
|
+
responseA: z.ZodObject<{
|
|
261
|
+
id: z.ZodString;
|
|
262
|
+
content: z.ZodString;
|
|
263
|
+
model: z.ZodOptional<z.ZodString>;
|
|
264
|
+
}, "strip", z.ZodTypeAny, {
|
|
265
|
+
id: string;
|
|
266
|
+
content: string;
|
|
267
|
+
model?: string | undefined;
|
|
268
|
+
}, {
|
|
269
|
+
id: string;
|
|
270
|
+
content: string;
|
|
271
|
+
model?: string | undefined;
|
|
272
|
+
}>;
|
|
273
|
+
responseB: z.ZodObject<{
|
|
274
|
+
id: z.ZodString;
|
|
275
|
+
content: z.ZodString;
|
|
276
|
+
model: z.ZodOptional<z.ZodString>;
|
|
277
|
+
}, "strip", z.ZodTypeAny, {
|
|
278
|
+
id: string;
|
|
279
|
+
content: string;
|
|
280
|
+
model?: string | undefined;
|
|
281
|
+
}, {
|
|
282
|
+
id: string;
|
|
283
|
+
content: string;
|
|
284
|
+
model?: string | undefined;
|
|
285
|
+
}>;
|
|
286
|
+
preference: z.ZodEnum<["A", "B", "tie"]>;
|
|
287
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
288
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
289
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
290
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
291
|
+
}, "strip", z.ZodTypeAny, {
|
|
292
|
+
preference: "A" | "B" | "tie";
|
|
293
|
+
input: string;
|
|
294
|
+
responseA: {
|
|
295
|
+
id: string;
|
|
296
|
+
content: string;
|
|
297
|
+
model?: string | undefined;
|
|
298
|
+
};
|
|
299
|
+
responseB: {
|
|
300
|
+
id: string;
|
|
301
|
+
content: string;
|
|
302
|
+
model?: string | undefined;
|
|
303
|
+
};
|
|
304
|
+
userId?: string | undefined;
|
|
305
|
+
metadata?: Record<string, unknown> | undefined;
|
|
306
|
+
reason?: string | undefined;
|
|
307
|
+
confidence?: number | undefined;
|
|
308
|
+
}, {
|
|
309
|
+
preference: "A" | "B" | "tie";
|
|
310
|
+
input: string;
|
|
311
|
+
responseA: {
|
|
312
|
+
id: string;
|
|
313
|
+
content: string;
|
|
314
|
+
model?: string | undefined;
|
|
315
|
+
};
|
|
316
|
+
responseB: {
|
|
317
|
+
id: string;
|
|
318
|
+
content: string;
|
|
319
|
+
model?: string | undefined;
|
|
320
|
+
};
|
|
321
|
+
userId?: string | undefined;
|
|
322
|
+
metadata?: Record<string, unknown> | undefined;
|
|
323
|
+
reason?: string | undefined;
|
|
324
|
+
confidence?: number | undefined;
|
|
325
|
+
}>;
|
|
326
|
+
|
|
327
|
+
declare abstract class BaseCollector<TInput, TEntry extends FeedbackEntry> {
|
|
328
|
+
protected store?: FeedbackStoreInterface;
|
|
329
|
+
protected autoTimestamp: boolean;
|
|
330
|
+
protected generateId: () => string;
|
|
331
|
+
protected validateInput: boolean;
|
|
332
|
+
constructor(options?: FeedbackCollectorOptions);
|
|
333
|
+
collect(input: TInput): Promise<TEntry>;
|
|
334
|
+
collectBatch(inputs: TInput[]): Promise<TEntry[]>;
|
|
335
|
+
protected abstract validate(input: TInput): void;
|
|
336
|
+
protected abstract transform(input: TInput): TEntry;
|
|
337
|
+
setStore(store: FeedbackStoreInterface): void;
|
|
338
|
+
getStore(): FeedbackStoreInterface | undefined;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
declare class ThumbsCollector extends BaseCollector<CollectThumbsInput, ThumbsFeedback> {
|
|
342
|
+
private allowComment;
|
|
343
|
+
private requireComment;
|
|
344
|
+
constructor(options?: ThumbsCollectorOptions);
|
|
345
|
+
protected validate(input: CollectThumbsInput): void;
|
|
346
|
+
protected transform(input: CollectThumbsInput): ThumbsFeedback;
|
|
347
|
+
}
|
|
348
|
+
declare function createThumbsCollector(options?: ThumbsCollectorOptions): ThumbsCollector;
|
|
349
|
+
|
|
350
|
+
declare class RatingCollector extends BaseCollector<CollectRatingInput, RatingFeedback> {
|
|
351
|
+
private allowComment;
|
|
352
|
+
private minRating;
|
|
353
|
+
private maxRating;
|
|
354
|
+
private requireComment;
|
|
355
|
+
private lowRatingThreshold;
|
|
356
|
+
constructor(options?: RatingCollectorOptions);
|
|
357
|
+
protected validate(input: CollectRatingInput): void;
|
|
358
|
+
protected transform(input: CollectRatingInput): RatingFeedback;
|
|
359
|
+
}
|
|
360
|
+
declare function createRatingCollector(options?: RatingCollectorOptions): RatingCollector;
|
|
361
|
+
|
|
362
|
+
declare class PreferenceCollector extends BaseCollector<CollectPreferenceInput, PreferenceFeedback> {
|
|
363
|
+
private allowTie;
|
|
364
|
+
private requireReason;
|
|
365
|
+
private requireConfidence;
|
|
366
|
+
private minConfidence;
|
|
367
|
+
constructor(options?: PreferenceCollectorOptions);
|
|
368
|
+
protected validate(input: CollectPreferenceInput): void;
|
|
369
|
+
protected transform(input: CollectPreferenceInput): PreferenceFeedback;
|
|
370
|
+
}
|
|
371
|
+
declare function createPreferenceCollector(options?: PreferenceCollectorOptions): PreferenceCollector;
|
|
372
|
+
|
|
373
|
+
declare class CorrectionCollector extends BaseCollector<CollectCorrectionInput, CorrectionFeedback> {
|
|
374
|
+
constructor(options?: FeedbackCollectorOptions);
|
|
375
|
+
protected validate(input: CollectCorrectionInput): void;
|
|
376
|
+
protected transform(input: CollectCorrectionInput): CorrectionFeedback;
|
|
377
|
+
}
|
|
378
|
+
declare function createCorrectionCollector(options?: FeedbackCollectorOptions): CorrectionCollector;
|
|
379
|
+
|
|
380
|
+
declare class MultiCriteriaCollector extends BaseCollector<CollectMultiCriteriaInput, MultiCriteriaFeedback> {
|
|
381
|
+
private criteria;
|
|
382
|
+
private requireAllCriteria;
|
|
383
|
+
private allowCorrections;
|
|
384
|
+
constructor(options: MultiCriteriaCollectorOptions);
|
|
385
|
+
protected validate(input: CollectMultiCriteriaInput): void;
|
|
386
|
+
protected transform(input: CollectMultiCriteriaInput): MultiCriteriaFeedback;
|
|
387
|
+
getCriteria(): CriterionDefinition[];
|
|
388
|
+
addCriterion(criterion: CriterionDefinition): void;
|
|
389
|
+
removeCriterion(name: string): boolean;
|
|
390
|
+
}
|
|
391
|
+
declare function createMultiCriteriaCollector(options: MultiCriteriaCollectorOptions): MultiCriteriaCollector;
|
|
392
|
+
|
|
393
|
+
declare class MemoryFeedbackStore implements FeedbackStoreInterface {
|
|
394
|
+
private entries;
|
|
395
|
+
save(entry: FeedbackEntry): Promise<string>;
|
|
396
|
+
saveBatch(entries: FeedbackEntry[]): Promise<string[]>;
|
|
397
|
+
get(id: string): Promise<FeedbackEntry | null>;
|
|
398
|
+
query(options: FeedbackQueryOptions): Promise<FeedbackQueryResult>;
|
|
399
|
+
delete(id: string): Promise<boolean>;
|
|
400
|
+
clear(): Promise<void>;
|
|
401
|
+
close(): Promise<void>;
|
|
402
|
+
private getRating;
|
|
403
|
+
}
|
|
404
|
+
declare class SQLiteFeedbackStore implements FeedbackStoreInterface {
|
|
405
|
+
private config;
|
|
406
|
+
private db;
|
|
407
|
+
private tableName;
|
|
408
|
+
private initialized;
|
|
409
|
+
constructor(config: {
|
|
410
|
+
path: string;
|
|
411
|
+
tableName?: string;
|
|
412
|
+
});
|
|
413
|
+
init(): Promise<void>;
|
|
414
|
+
save(entry: FeedbackEntry): Promise<string>;
|
|
415
|
+
saveBatch(entries: FeedbackEntry[]): Promise<string[]>;
|
|
416
|
+
get(id: string): Promise<FeedbackEntry | null>;
|
|
417
|
+
query(options: FeedbackQueryOptions): Promise<FeedbackQueryResult>;
|
|
418
|
+
delete(id: string): Promise<boolean>;
|
|
419
|
+
clear(): Promise<void>;
|
|
420
|
+
close(): Promise<void>;
|
|
421
|
+
private ensureInitialized;
|
|
422
|
+
}
|
|
423
|
+
declare function createFeedbackStore(config: FeedbackStoreConfig): FeedbackStoreInterface;
|
|
424
|
+
|
|
425
|
+
declare class FeedbackAggregator {
|
|
426
|
+
private store;
|
|
427
|
+
constructor(store: FeedbackStoreInterface);
|
|
428
|
+
aggregate(options: AggregationOptions): Promise<AggregationResult[]>;
|
|
429
|
+
getSummary(options?: {
|
|
430
|
+
startTime?: number;
|
|
431
|
+
endTime?: number;
|
|
432
|
+
}): Promise<{
|
|
433
|
+
totalCount: number;
|
|
434
|
+
byType: Record<string, number>;
|
|
435
|
+
thumbsUpRate: number;
|
|
436
|
+
avgRating: number;
|
|
437
|
+
preferenceDistribution: {
|
|
438
|
+
A: number;
|
|
439
|
+
B: number;
|
|
440
|
+
tie: number;
|
|
441
|
+
};
|
|
442
|
+
correctionRate: number;
|
|
443
|
+
}>;
|
|
444
|
+
getTrends(options: {
|
|
445
|
+
metric: AggregationMetric;
|
|
446
|
+
interval: 'hour' | 'day' | 'week';
|
|
447
|
+
startTime: number;
|
|
448
|
+
endTime: number;
|
|
449
|
+
}): Promise<Array<{
|
|
450
|
+
timestamp: number;
|
|
451
|
+
value: number;
|
|
452
|
+
count: number;
|
|
453
|
+
}>>;
|
|
454
|
+
private groupEntries;
|
|
455
|
+
private calculateMetrics;
|
|
456
|
+
private calculateSingleMetric;
|
|
457
|
+
private getWeekKey;
|
|
458
|
+
private getWeekNumber;
|
|
459
|
+
private getIntervalMs;
|
|
460
|
+
}
|
|
461
|
+
declare function createFeedbackAggregator(store: FeedbackStoreInterface): FeedbackAggregator;
|
|
462
|
+
|
|
463
|
+
declare class FeedbackExporter {
|
|
464
|
+
private store;
|
|
465
|
+
constructor(store: FeedbackStoreInterface);
|
|
466
|
+
exportToString(options: ExportOptions): Promise<string>;
|
|
467
|
+
exportToFile(path: string, options: ExportOptions): Promise<number>;
|
|
468
|
+
exportStream(options: ExportOptions, batchSize?: number): AsyncGenerator<string, void, unknown>;
|
|
469
|
+
private getEntries;
|
|
470
|
+
private filterFields;
|
|
471
|
+
private toCSV;
|
|
472
|
+
private toCSVRows;
|
|
473
|
+
private getCSVHeaders;
|
|
474
|
+
private formatCSVValue;
|
|
475
|
+
private escapeCSV;
|
|
476
|
+
}
|
|
477
|
+
declare function createFeedbackExporter(store: FeedbackStoreInterface): FeedbackExporter;
|
|
478
|
+
|
|
479
|
+
export { createMultiCriteriaCollector as $, type AggregationOptions as A, type BaseFeedbackEntry as B, type CorrectionFeedback as C, CollectPreferenceInputSchema as D, type ExportFormat as E, type FeedbackStoreInterface as F, MemoryFeedbackStore as G, SQLiteFeedbackStore as H, createFeedbackStore as I, FeedbackAggregator as J, createFeedbackAggregator as K, FeedbackExporter as L, type MultiCriteriaFeedback as M, createFeedbackExporter as N, BaseCollector as O, type PreferenceChoice as P, createThumbsCollector as Q, type RatingFeedback as R, type StarRating as S, ThumbsCollector as T, RatingCollector as U, createRatingCollector as V, PreferenceCollector as W, createPreferenceCollector as X, CorrectionCollector as Y, createCorrectionCollector as Z, MultiCriteriaCollector as _, type ThumbsFeedback as a, type ThumbsRating as b, type PreferenceFeedback as c, type CriterionDefinition as d, type CriterionRating as e, type FeedbackEntry as f, type FeedbackCollectorOptions as g, type ThumbsCollectorOptions as h, type RatingCollectorOptions as i, type PreferenceCollectorOptions as j, type MultiCriteriaCollectorOptions as k, type CollectThumbsInput as l, type CollectRatingInput as m, type CollectPreferenceInput as n, type CollectCorrectionInput as o, type CollectMultiCriteriaInput as p, type FeedbackQueryOptions as q, type FeedbackQueryResult as r, type AggregationMetric as s, type AggregationResult as t, type ExportOptions as u, type FeedbackStoreConfig as v, ThumbsRatingSchema as w, StarRatingSchema as x, PreferenceChoiceSchema as y, CollectThumbsInputSchema as z };
|