jev-recipes 0.0.1 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -2
- package/README.md +95 -105
- package/dist/catalog/index.d.ts +211 -0
- package/dist/catalog/index.js +31 -0
- package/dist/catalog/recipes.d.ts +351 -0
- package/dist/catalog/recipes.js +50 -0
- package/dist/catalog/schema.d.ts +19 -0
- package/dist/catalog/schema.js +9 -0
- package/dist/cli/index.js +32 -16
- package/dist/cli/schema.d.ts +23 -8
- package/dist/cli/schema.js +10 -10
- package/dist/examples/support/index.d.ts +1 -0
- package/dist/examples/support/index.js +37 -0
- package/dist/examples/support/schema.d.ts +566 -0
- package/dist/examples/support/schema.js +76 -0
- package/dist/examples/support/workflow.d.ts +3 -0
- package/dist/examples/support/workflow.js +85 -0
- package/dist/recipes/answerability/index.d.ts +5 -0
- package/dist/recipes/answerability/index.js +32 -0
- package/dist/recipes/answerability/metadata.d.ts +8 -0
- package/dist/recipes/answerability/metadata.js +11 -0
- package/dist/recipes/answerability/schema.d.ts +47 -0
- package/dist/recipes/answerability/schema.js +25 -0
- package/dist/recipes/clarify/index.d.ts +5 -0
- package/dist/recipes/clarify/index.js +46 -0
- package/dist/recipes/clarify/metadata.d.ts +8 -0
- package/dist/recipes/clarify/metadata.js +11 -0
- package/dist/recipes/clarify/schema.d.ts +55 -0
- package/dist/recipes/clarify/schema.js +27 -0
- package/dist/recipes/handoff/index.d.ts +5 -0
- package/dist/recipes/handoff/index.js +50 -0
- package/dist/recipes/handoff/metadata.d.ts +8 -0
- package/dist/recipes/handoff/metadata.js +11 -0
- package/dist/recipes/handoff/schema.d.ts +59 -0
- package/dist/recipes/handoff/schema.js +27 -0
- package/dist/recipes/rerank/metadata.d.ts +8 -0
- package/dist/recipes/rerank/metadata.js +11 -0
- package/dist/recipes/route/metadata.d.ts +8 -0
- package/dist/recipes/route/metadata.js +11 -0
- package/dist/recipes/verify/metadata.d.ts +8 -0
- package/dist/recipes/verify/metadata.js +11 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.js +4 -0
- package/dist/src/schema.d.ts +19 -0
- package/dist/src/schema.js +9 -0
- package/examples/support/README.md +60 -0
- package/examples/support/demo.json +156 -0
- package/package.json +26 -7
- package/recipes/answerability/README.md +29 -0
- package/recipes/answerability/demo.json +31 -0
- package/recipes/clarify/README.md +32 -0
- package/recipes/clarify/demo.json +45 -0
- package/recipes/handoff/README.md +35 -0
- package/recipes/handoff/demo.json +30 -0
- package/dist/cli/recipes.d.ts +0 -53
- package/dist/cli/recipes.js +0 -20
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const supportInputSchema: z.ZodObject<{
|
|
3
|
+
request: z.ZodString;
|
|
4
|
+
context: z.ZodOptional<z.ZodString>;
|
|
5
|
+
routes: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
6
|
+
requirements: z.ZodArray<z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
description: z.ZodString;
|
|
9
|
+
}, z.core.$strip>>;
|
|
10
|
+
handoffRules: z.ZodArray<z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
description: z.ZodString;
|
|
13
|
+
}, z.core.$strip>>;
|
|
14
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
15
|
+
id: z.ZodString;
|
|
16
|
+
text: z.ZodString;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
minConfidence: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
minRelevance: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
topK: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export declare const supportDraftContextSchema: z.ZodObject<{
|
|
23
|
+
request: z.ZodString;
|
|
24
|
+
context: z.ZodOptional<z.ZodString>;
|
|
25
|
+
route: z.ZodString;
|
|
26
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
text: z.ZodString;
|
|
29
|
+
}, z.core.$strip>>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
export declare const supportDraftSchema: z.ZodObject<{
|
|
32
|
+
claims: z.ZodArray<z.ZodObject<{
|
|
33
|
+
id: z.ZodString;
|
|
34
|
+
claim: z.ZodString;
|
|
35
|
+
evidenceIds: z.ZodArray<z.ZodString>;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
export declare const supportDecisionsSchema: z.ZodObject<{
|
|
39
|
+
handoff: z.ZodOptional<z.ZodObject<{
|
|
40
|
+
model: z.ZodString;
|
|
41
|
+
usage: z.ZodObject<{
|
|
42
|
+
input_tokens: z.ZodNumber;
|
|
43
|
+
output_tokens: z.ZodNumber;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
status: z.ZodEnum<{
|
|
46
|
+
ready: "ready";
|
|
47
|
+
review: "review";
|
|
48
|
+
}>;
|
|
49
|
+
decision: z.ZodEnum<{
|
|
50
|
+
review: "review";
|
|
51
|
+
human: "human";
|
|
52
|
+
continue: "continue";
|
|
53
|
+
}>;
|
|
54
|
+
matchedRules: z.ZodArray<z.ZodString>;
|
|
55
|
+
uncertainRules: z.ZodArray<z.ZodString>;
|
|
56
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
57
|
+
id: z.ZodString;
|
|
58
|
+
status: z.ZodEnum<{
|
|
59
|
+
ready: "ready";
|
|
60
|
+
review: "review";
|
|
61
|
+
}>;
|
|
62
|
+
verdict: z.ZodEnum<{
|
|
63
|
+
matches: "matches";
|
|
64
|
+
does_not_match: "does_not_match";
|
|
65
|
+
unclear: "unclear";
|
|
66
|
+
}>;
|
|
67
|
+
confidence: z.ZodNumber;
|
|
68
|
+
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
69
|
+
matches: "matches";
|
|
70
|
+
does_not_match: "does_not_match";
|
|
71
|
+
unclear: "unclear";
|
|
72
|
+
}>, z.ZodNumber>;
|
|
73
|
+
}, z.core.$strip>>;
|
|
74
|
+
}, z.core.$strip>>;
|
|
75
|
+
clarify: z.ZodOptional<z.ZodObject<{
|
|
76
|
+
model: z.ZodString;
|
|
77
|
+
usage: z.ZodObject<{
|
|
78
|
+
input_tokens: z.ZodNumber;
|
|
79
|
+
output_tokens: z.ZodNumber;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
status: z.ZodEnum<{
|
|
82
|
+
ready: "ready";
|
|
83
|
+
review: "review";
|
|
84
|
+
}>;
|
|
85
|
+
canProceed: z.ZodBoolean;
|
|
86
|
+
missing: z.ZodArray<z.ZodString>;
|
|
87
|
+
ambiguous: z.ZodArray<z.ZodString>;
|
|
88
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
89
|
+
id: z.ZodString;
|
|
90
|
+
status: z.ZodEnum<{
|
|
91
|
+
ready: "ready";
|
|
92
|
+
review: "review";
|
|
93
|
+
}>;
|
|
94
|
+
verdict: z.ZodEnum<{
|
|
95
|
+
present: "present";
|
|
96
|
+
missing: "missing";
|
|
97
|
+
ambiguous: "ambiguous";
|
|
98
|
+
}>;
|
|
99
|
+
confidence: z.ZodNumber;
|
|
100
|
+
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
101
|
+
present: "present";
|
|
102
|
+
missing: "missing";
|
|
103
|
+
ambiguous: "ambiguous";
|
|
104
|
+
}>, z.ZodNumber>;
|
|
105
|
+
}, z.core.$strip>>;
|
|
106
|
+
}, z.core.$strip>>;
|
|
107
|
+
route: z.ZodOptional<z.ZodObject<{
|
|
108
|
+
model: z.ZodString;
|
|
109
|
+
usage: z.ZodObject<{
|
|
110
|
+
input_tokens: z.ZodNumber;
|
|
111
|
+
output_tokens: z.ZodNumber;
|
|
112
|
+
}, z.core.$strip>;
|
|
113
|
+
status: z.ZodEnum<{
|
|
114
|
+
ready: "ready";
|
|
115
|
+
review: "review";
|
|
116
|
+
}>;
|
|
117
|
+
route: z.ZodNullable<z.ZodString>;
|
|
118
|
+
suggestedRoute: z.ZodNullable<z.ZodString>;
|
|
119
|
+
confidence: z.ZodNumber;
|
|
120
|
+
probabilities: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
121
|
+
}, z.core.$strip>>;
|
|
122
|
+
rerank: z.ZodOptional<z.ZodObject<{
|
|
123
|
+
model: z.ZodString;
|
|
124
|
+
usage: z.ZodObject<{
|
|
125
|
+
input_tokens: z.ZodNumber;
|
|
126
|
+
output_tokens: z.ZodNumber;
|
|
127
|
+
}, z.core.$strip>;
|
|
128
|
+
status: z.ZodEnum<{
|
|
129
|
+
ready: "ready";
|
|
130
|
+
review: "review";
|
|
131
|
+
}>;
|
|
132
|
+
items: z.ZodArray<z.ZodObject<{
|
|
133
|
+
id: z.ZodString;
|
|
134
|
+
text: z.ZodString;
|
|
135
|
+
relevance: z.ZodNumber;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
evaluated: z.ZodNumber;
|
|
138
|
+
}, z.core.$strip>>;
|
|
139
|
+
answerability: z.ZodOptional<z.ZodObject<{
|
|
140
|
+
model: z.ZodString;
|
|
141
|
+
usage: z.ZodObject<{
|
|
142
|
+
input_tokens: z.ZodNumber;
|
|
143
|
+
output_tokens: z.ZodNumber;
|
|
144
|
+
}, z.core.$strip>;
|
|
145
|
+
status: z.ZodEnum<{
|
|
146
|
+
ready: "ready";
|
|
147
|
+
review: "review";
|
|
148
|
+
}>;
|
|
149
|
+
verdict: z.ZodEnum<{
|
|
150
|
+
sufficient: "sufficient";
|
|
151
|
+
partial: "partial";
|
|
152
|
+
insufficient: "insufficient";
|
|
153
|
+
conflicting: "conflicting";
|
|
154
|
+
}>;
|
|
155
|
+
canAnswer: z.ZodBoolean;
|
|
156
|
+
confidence: z.ZodNumber;
|
|
157
|
+
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
158
|
+
sufficient: "sufficient";
|
|
159
|
+
partial: "partial";
|
|
160
|
+
insufficient: "insufficient";
|
|
161
|
+
conflicting: "conflicting";
|
|
162
|
+
}>, z.ZodNumber>;
|
|
163
|
+
}, z.core.$strip>>;
|
|
164
|
+
verify: z.ZodOptional<z.ZodObject<{
|
|
165
|
+
model: z.ZodString;
|
|
166
|
+
usage: z.ZodObject<{
|
|
167
|
+
input_tokens: z.ZodNumber;
|
|
168
|
+
output_tokens: z.ZodNumber;
|
|
169
|
+
}, z.core.$strip>;
|
|
170
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
171
|
+
id: z.ZodString;
|
|
172
|
+
status: z.ZodEnum<{
|
|
173
|
+
ready: "ready";
|
|
174
|
+
review: "review";
|
|
175
|
+
}>;
|
|
176
|
+
verdict: z.ZodEnum<{
|
|
177
|
+
supported: "supported";
|
|
178
|
+
contradicted: "contradicted";
|
|
179
|
+
unsupported: "unsupported";
|
|
180
|
+
}>;
|
|
181
|
+
confidence: z.ZodNumber;
|
|
182
|
+
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
183
|
+
supported: "supported";
|
|
184
|
+
contradicted: "contradicted";
|
|
185
|
+
unsupported: "unsupported";
|
|
186
|
+
}>, z.ZodNumber>;
|
|
187
|
+
}, z.core.$strip>>;
|
|
188
|
+
allSupported: z.ZodBoolean;
|
|
189
|
+
}, z.core.$strip>>;
|
|
190
|
+
}, z.core.$strip>;
|
|
191
|
+
export declare const supportResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
192
|
+
outcome: z.ZodLiteral<"answered">;
|
|
193
|
+
answer: z.ZodString;
|
|
194
|
+
draft: z.ZodObject<{
|
|
195
|
+
claims: z.ZodArray<z.ZodObject<{
|
|
196
|
+
id: z.ZodString;
|
|
197
|
+
claim: z.ZodString;
|
|
198
|
+
evidenceIds: z.ZodArray<z.ZodString>;
|
|
199
|
+
}, z.core.$strip>>;
|
|
200
|
+
}, z.core.$strip>;
|
|
201
|
+
decisions: z.ZodObject<{
|
|
202
|
+
handoff: z.ZodOptional<z.ZodObject<{
|
|
203
|
+
model: z.ZodString;
|
|
204
|
+
usage: z.ZodObject<{
|
|
205
|
+
input_tokens: z.ZodNumber;
|
|
206
|
+
output_tokens: z.ZodNumber;
|
|
207
|
+
}, z.core.$strip>;
|
|
208
|
+
status: z.ZodEnum<{
|
|
209
|
+
ready: "ready";
|
|
210
|
+
review: "review";
|
|
211
|
+
}>;
|
|
212
|
+
decision: z.ZodEnum<{
|
|
213
|
+
review: "review";
|
|
214
|
+
human: "human";
|
|
215
|
+
continue: "continue";
|
|
216
|
+
}>;
|
|
217
|
+
matchedRules: z.ZodArray<z.ZodString>;
|
|
218
|
+
uncertainRules: z.ZodArray<z.ZodString>;
|
|
219
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
220
|
+
id: z.ZodString;
|
|
221
|
+
status: z.ZodEnum<{
|
|
222
|
+
ready: "ready";
|
|
223
|
+
review: "review";
|
|
224
|
+
}>;
|
|
225
|
+
verdict: z.ZodEnum<{
|
|
226
|
+
matches: "matches";
|
|
227
|
+
does_not_match: "does_not_match";
|
|
228
|
+
unclear: "unclear";
|
|
229
|
+
}>;
|
|
230
|
+
confidence: z.ZodNumber;
|
|
231
|
+
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
232
|
+
matches: "matches";
|
|
233
|
+
does_not_match: "does_not_match";
|
|
234
|
+
unclear: "unclear";
|
|
235
|
+
}>, z.ZodNumber>;
|
|
236
|
+
}, z.core.$strip>>;
|
|
237
|
+
}, z.core.$strip>>;
|
|
238
|
+
clarify: z.ZodOptional<z.ZodObject<{
|
|
239
|
+
model: z.ZodString;
|
|
240
|
+
usage: z.ZodObject<{
|
|
241
|
+
input_tokens: z.ZodNumber;
|
|
242
|
+
output_tokens: z.ZodNumber;
|
|
243
|
+
}, z.core.$strip>;
|
|
244
|
+
status: z.ZodEnum<{
|
|
245
|
+
ready: "ready";
|
|
246
|
+
review: "review";
|
|
247
|
+
}>;
|
|
248
|
+
canProceed: z.ZodBoolean;
|
|
249
|
+
missing: z.ZodArray<z.ZodString>;
|
|
250
|
+
ambiguous: z.ZodArray<z.ZodString>;
|
|
251
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
252
|
+
id: z.ZodString;
|
|
253
|
+
status: z.ZodEnum<{
|
|
254
|
+
ready: "ready";
|
|
255
|
+
review: "review";
|
|
256
|
+
}>;
|
|
257
|
+
verdict: z.ZodEnum<{
|
|
258
|
+
present: "present";
|
|
259
|
+
missing: "missing";
|
|
260
|
+
ambiguous: "ambiguous";
|
|
261
|
+
}>;
|
|
262
|
+
confidence: z.ZodNumber;
|
|
263
|
+
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
264
|
+
present: "present";
|
|
265
|
+
missing: "missing";
|
|
266
|
+
ambiguous: "ambiguous";
|
|
267
|
+
}>, z.ZodNumber>;
|
|
268
|
+
}, z.core.$strip>>;
|
|
269
|
+
}, z.core.$strip>>;
|
|
270
|
+
route: z.ZodOptional<z.ZodObject<{
|
|
271
|
+
model: z.ZodString;
|
|
272
|
+
usage: z.ZodObject<{
|
|
273
|
+
input_tokens: z.ZodNumber;
|
|
274
|
+
output_tokens: z.ZodNumber;
|
|
275
|
+
}, z.core.$strip>;
|
|
276
|
+
status: z.ZodEnum<{
|
|
277
|
+
ready: "ready";
|
|
278
|
+
review: "review";
|
|
279
|
+
}>;
|
|
280
|
+
route: z.ZodNullable<z.ZodString>;
|
|
281
|
+
suggestedRoute: z.ZodNullable<z.ZodString>;
|
|
282
|
+
confidence: z.ZodNumber;
|
|
283
|
+
probabilities: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
284
|
+
}, z.core.$strip>>;
|
|
285
|
+
rerank: z.ZodOptional<z.ZodObject<{
|
|
286
|
+
model: z.ZodString;
|
|
287
|
+
usage: z.ZodObject<{
|
|
288
|
+
input_tokens: z.ZodNumber;
|
|
289
|
+
output_tokens: z.ZodNumber;
|
|
290
|
+
}, z.core.$strip>;
|
|
291
|
+
status: z.ZodEnum<{
|
|
292
|
+
ready: "ready";
|
|
293
|
+
review: "review";
|
|
294
|
+
}>;
|
|
295
|
+
items: z.ZodArray<z.ZodObject<{
|
|
296
|
+
id: z.ZodString;
|
|
297
|
+
text: z.ZodString;
|
|
298
|
+
relevance: z.ZodNumber;
|
|
299
|
+
}, z.core.$strip>>;
|
|
300
|
+
evaluated: z.ZodNumber;
|
|
301
|
+
}, z.core.$strip>>;
|
|
302
|
+
answerability: z.ZodOptional<z.ZodObject<{
|
|
303
|
+
model: z.ZodString;
|
|
304
|
+
usage: z.ZodObject<{
|
|
305
|
+
input_tokens: z.ZodNumber;
|
|
306
|
+
output_tokens: z.ZodNumber;
|
|
307
|
+
}, z.core.$strip>;
|
|
308
|
+
status: z.ZodEnum<{
|
|
309
|
+
ready: "ready";
|
|
310
|
+
review: "review";
|
|
311
|
+
}>;
|
|
312
|
+
verdict: z.ZodEnum<{
|
|
313
|
+
sufficient: "sufficient";
|
|
314
|
+
partial: "partial";
|
|
315
|
+
insufficient: "insufficient";
|
|
316
|
+
conflicting: "conflicting";
|
|
317
|
+
}>;
|
|
318
|
+
canAnswer: z.ZodBoolean;
|
|
319
|
+
confidence: z.ZodNumber;
|
|
320
|
+
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
321
|
+
sufficient: "sufficient";
|
|
322
|
+
partial: "partial";
|
|
323
|
+
insufficient: "insufficient";
|
|
324
|
+
conflicting: "conflicting";
|
|
325
|
+
}>, z.ZodNumber>;
|
|
326
|
+
}, z.core.$strip>>;
|
|
327
|
+
verify: z.ZodOptional<z.ZodObject<{
|
|
328
|
+
model: z.ZodString;
|
|
329
|
+
usage: z.ZodObject<{
|
|
330
|
+
input_tokens: z.ZodNumber;
|
|
331
|
+
output_tokens: z.ZodNumber;
|
|
332
|
+
}, z.core.$strip>;
|
|
333
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
334
|
+
id: z.ZodString;
|
|
335
|
+
status: z.ZodEnum<{
|
|
336
|
+
ready: "ready";
|
|
337
|
+
review: "review";
|
|
338
|
+
}>;
|
|
339
|
+
verdict: z.ZodEnum<{
|
|
340
|
+
supported: "supported";
|
|
341
|
+
contradicted: "contradicted";
|
|
342
|
+
unsupported: "unsupported";
|
|
343
|
+
}>;
|
|
344
|
+
confidence: z.ZodNumber;
|
|
345
|
+
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
346
|
+
supported: "supported";
|
|
347
|
+
contradicted: "contradicted";
|
|
348
|
+
unsupported: "unsupported";
|
|
349
|
+
}>, z.ZodNumber>;
|
|
350
|
+
}, z.core.$strip>>;
|
|
351
|
+
allSupported: z.ZodBoolean;
|
|
352
|
+
}, z.core.$strip>>;
|
|
353
|
+
}, z.core.$strip>;
|
|
354
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
355
|
+
outcome: z.ZodEnum<{
|
|
356
|
+
review: "review";
|
|
357
|
+
human: "human";
|
|
358
|
+
clarification: "clarification";
|
|
359
|
+
no_evidence: "no_evidence";
|
|
360
|
+
cannot_answer: "cannot_answer";
|
|
361
|
+
unverified: "unverified";
|
|
362
|
+
}>;
|
|
363
|
+
stage: z.ZodEnum<{
|
|
364
|
+
route: "route";
|
|
365
|
+
answerability: "answerability";
|
|
366
|
+
rerank: "rerank";
|
|
367
|
+
verify: "verify";
|
|
368
|
+
clarify: "clarify";
|
|
369
|
+
handoff: "handoff";
|
|
370
|
+
}>;
|
|
371
|
+
decisions: z.ZodObject<{
|
|
372
|
+
handoff: z.ZodOptional<z.ZodObject<{
|
|
373
|
+
model: z.ZodString;
|
|
374
|
+
usage: z.ZodObject<{
|
|
375
|
+
input_tokens: z.ZodNumber;
|
|
376
|
+
output_tokens: z.ZodNumber;
|
|
377
|
+
}, z.core.$strip>;
|
|
378
|
+
status: z.ZodEnum<{
|
|
379
|
+
ready: "ready";
|
|
380
|
+
review: "review";
|
|
381
|
+
}>;
|
|
382
|
+
decision: z.ZodEnum<{
|
|
383
|
+
review: "review";
|
|
384
|
+
human: "human";
|
|
385
|
+
continue: "continue";
|
|
386
|
+
}>;
|
|
387
|
+
matchedRules: z.ZodArray<z.ZodString>;
|
|
388
|
+
uncertainRules: z.ZodArray<z.ZodString>;
|
|
389
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
390
|
+
id: z.ZodString;
|
|
391
|
+
status: z.ZodEnum<{
|
|
392
|
+
ready: "ready";
|
|
393
|
+
review: "review";
|
|
394
|
+
}>;
|
|
395
|
+
verdict: z.ZodEnum<{
|
|
396
|
+
matches: "matches";
|
|
397
|
+
does_not_match: "does_not_match";
|
|
398
|
+
unclear: "unclear";
|
|
399
|
+
}>;
|
|
400
|
+
confidence: z.ZodNumber;
|
|
401
|
+
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
402
|
+
matches: "matches";
|
|
403
|
+
does_not_match: "does_not_match";
|
|
404
|
+
unclear: "unclear";
|
|
405
|
+
}>, z.ZodNumber>;
|
|
406
|
+
}, z.core.$strip>>;
|
|
407
|
+
}, z.core.$strip>>;
|
|
408
|
+
clarify: z.ZodOptional<z.ZodObject<{
|
|
409
|
+
model: z.ZodString;
|
|
410
|
+
usage: z.ZodObject<{
|
|
411
|
+
input_tokens: z.ZodNumber;
|
|
412
|
+
output_tokens: z.ZodNumber;
|
|
413
|
+
}, z.core.$strip>;
|
|
414
|
+
status: z.ZodEnum<{
|
|
415
|
+
ready: "ready";
|
|
416
|
+
review: "review";
|
|
417
|
+
}>;
|
|
418
|
+
canProceed: z.ZodBoolean;
|
|
419
|
+
missing: z.ZodArray<z.ZodString>;
|
|
420
|
+
ambiguous: z.ZodArray<z.ZodString>;
|
|
421
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
422
|
+
id: z.ZodString;
|
|
423
|
+
status: z.ZodEnum<{
|
|
424
|
+
ready: "ready";
|
|
425
|
+
review: "review";
|
|
426
|
+
}>;
|
|
427
|
+
verdict: z.ZodEnum<{
|
|
428
|
+
present: "present";
|
|
429
|
+
missing: "missing";
|
|
430
|
+
ambiguous: "ambiguous";
|
|
431
|
+
}>;
|
|
432
|
+
confidence: z.ZodNumber;
|
|
433
|
+
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
434
|
+
present: "present";
|
|
435
|
+
missing: "missing";
|
|
436
|
+
ambiguous: "ambiguous";
|
|
437
|
+
}>, z.ZodNumber>;
|
|
438
|
+
}, z.core.$strip>>;
|
|
439
|
+
}, z.core.$strip>>;
|
|
440
|
+
route: z.ZodOptional<z.ZodObject<{
|
|
441
|
+
model: z.ZodString;
|
|
442
|
+
usage: z.ZodObject<{
|
|
443
|
+
input_tokens: z.ZodNumber;
|
|
444
|
+
output_tokens: z.ZodNumber;
|
|
445
|
+
}, z.core.$strip>;
|
|
446
|
+
status: z.ZodEnum<{
|
|
447
|
+
ready: "ready";
|
|
448
|
+
review: "review";
|
|
449
|
+
}>;
|
|
450
|
+
route: z.ZodNullable<z.ZodString>;
|
|
451
|
+
suggestedRoute: z.ZodNullable<z.ZodString>;
|
|
452
|
+
confidence: z.ZodNumber;
|
|
453
|
+
probabilities: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
454
|
+
}, z.core.$strip>>;
|
|
455
|
+
rerank: z.ZodOptional<z.ZodObject<{
|
|
456
|
+
model: z.ZodString;
|
|
457
|
+
usage: z.ZodObject<{
|
|
458
|
+
input_tokens: z.ZodNumber;
|
|
459
|
+
output_tokens: z.ZodNumber;
|
|
460
|
+
}, z.core.$strip>;
|
|
461
|
+
status: z.ZodEnum<{
|
|
462
|
+
ready: "ready";
|
|
463
|
+
review: "review";
|
|
464
|
+
}>;
|
|
465
|
+
items: z.ZodArray<z.ZodObject<{
|
|
466
|
+
id: z.ZodString;
|
|
467
|
+
text: z.ZodString;
|
|
468
|
+
relevance: z.ZodNumber;
|
|
469
|
+
}, z.core.$strip>>;
|
|
470
|
+
evaluated: z.ZodNumber;
|
|
471
|
+
}, z.core.$strip>>;
|
|
472
|
+
answerability: z.ZodOptional<z.ZodObject<{
|
|
473
|
+
model: z.ZodString;
|
|
474
|
+
usage: z.ZodObject<{
|
|
475
|
+
input_tokens: z.ZodNumber;
|
|
476
|
+
output_tokens: z.ZodNumber;
|
|
477
|
+
}, z.core.$strip>;
|
|
478
|
+
status: z.ZodEnum<{
|
|
479
|
+
ready: "ready";
|
|
480
|
+
review: "review";
|
|
481
|
+
}>;
|
|
482
|
+
verdict: z.ZodEnum<{
|
|
483
|
+
sufficient: "sufficient";
|
|
484
|
+
partial: "partial";
|
|
485
|
+
insufficient: "insufficient";
|
|
486
|
+
conflicting: "conflicting";
|
|
487
|
+
}>;
|
|
488
|
+
canAnswer: z.ZodBoolean;
|
|
489
|
+
confidence: z.ZodNumber;
|
|
490
|
+
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
491
|
+
sufficient: "sufficient";
|
|
492
|
+
partial: "partial";
|
|
493
|
+
insufficient: "insufficient";
|
|
494
|
+
conflicting: "conflicting";
|
|
495
|
+
}>, z.ZodNumber>;
|
|
496
|
+
}, z.core.$strip>>;
|
|
497
|
+
verify: z.ZodOptional<z.ZodObject<{
|
|
498
|
+
model: z.ZodString;
|
|
499
|
+
usage: z.ZodObject<{
|
|
500
|
+
input_tokens: z.ZodNumber;
|
|
501
|
+
output_tokens: z.ZodNumber;
|
|
502
|
+
}, z.core.$strip>;
|
|
503
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
504
|
+
id: z.ZodString;
|
|
505
|
+
status: z.ZodEnum<{
|
|
506
|
+
ready: "ready";
|
|
507
|
+
review: "review";
|
|
508
|
+
}>;
|
|
509
|
+
verdict: z.ZodEnum<{
|
|
510
|
+
supported: "supported";
|
|
511
|
+
contradicted: "contradicted";
|
|
512
|
+
unsupported: "unsupported";
|
|
513
|
+
}>;
|
|
514
|
+
confidence: z.ZodNumber;
|
|
515
|
+
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
516
|
+
supported: "supported";
|
|
517
|
+
contradicted: "contradicted";
|
|
518
|
+
unsupported: "unsupported";
|
|
519
|
+
}>, z.ZodNumber>;
|
|
520
|
+
}, z.core.$strip>>;
|
|
521
|
+
allSupported: z.ZodBoolean;
|
|
522
|
+
}, z.core.$strip>>;
|
|
523
|
+
}, z.core.$strip>;
|
|
524
|
+
}, z.core.$strip>], "outcome">;
|
|
525
|
+
export declare const supportFixtureSchema: z.ZodObject<{
|
|
526
|
+
input: z.ZodObject<{
|
|
527
|
+
request: z.ZodString;
|
|
528
|
+
context: z.ZodOptional<z.ZodString>;
|
|
529
|
+
routes: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
530
|
+
requirements: z.ZodArray<z.ZodObject<{
|
|
531
|
+
id: z.ZodString;
|
|
532
|
+
description: z.ZodString;
|
|
533
|
+
}, z.core.$strip>>;
|
|
534
|
+
handoffRules: z.ZodArray<z.ZodObject<{
|
|
535
|
+
id: z.ZodString;
|
|
536
|
+
description: z.ZodString;
|
|
537
|
+
}, z.core.$strip>>;
|
|
538
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
539
|
+
id: z.ZodString;
|
|
540
|
+
text: z.ZodString;
|
|
541
|
+
}, z.core.$strip>>;
|
|
542
|
+
minConfidence: z.ZodOptional<z.ZodNumber>;
|
|
543
|
+
minRelevance: z.ZodOptional<z.ZodNumber>;
|
|
544
|
+
topK: z.ZodOptional<z.ZodNumber>;
|
|
545
|
+
}, z.core.$strip>;
|
|
546
|
+
draft: z.ZodObject<{
|
|
547
|
+
claims: z.ZodArray<z.ZodObject<{
|
|
548
|
+
id: z.ZodString;
|
|
549
|
+
claim: z.ZodString;
|
|
550
|
+
evidenceIds: z.ZodArray<z.ZodString>;
|
|
551
|
+
}, z.core.$strip>>;
|
|
552
|
+
}, z.core.$strip>;
|
|
553
|
+
responses: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
554
|
+
model: z.ZodString;
|
|
555
|
+
usage: z.ZodObject<{
|
|
556
|
+
input_tokens: z.ZodNumber;
|
|
557
|
+
output_tokens: z.ZodNumber;
|
|
558
|
+
}, z.core.$strip>;
|
|
559
|
+
answers: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
560
|
+
}, z.core.$strip>>;
|
|
561
|
+
}, z.core.$strip>;
|
|
562
|
+
export type SupportInput = z.infer<typeof supportInputSchema>;
|
|
563
|
+
export type SupportDraftContext = z.infer<typeof supportDraftContextSchema>;
|
|
564
|
+
export type SupportDraft = z.infer<typeof supportDraftSchema>;
|
|
565
|
+
export type SupportDecisions = z.infer<typeof supportDecisionsSchema>;
|
|
566
|
+
export type SupportResult = z.infer<typeof supportResultSchema>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { nonEmptyText, probability, decisionResponseSchema } from '../../src/schema.js';
|
|
3
|
+
import { routeInputSchema, routeResultSchema } from '../../recipes/route/schema.js';
|
|
4
|
+
import { rerankResultSchema } from '../../recipes/rerank/schema.js';
|
|
5
|
+
import { verifyResultSchema } from '../../recipes/verify/schema.js';
|
|
6
|
+
import { answerabilityEvidenceSchema, answerabilityResultSchema, } from '../../recipes/answerability/schema.js';
|
|
7
|
+
import { clarifyInputSchema, clarifyResultSchema } from '../../recipes/clarify/schema.js';
|
|
8
|
+
import { handoffInputSchema, handoffResultSchema } from '../../recipes/handoff/schema.js';
|
|
9
|
+
export const supportInputSchema = z.object({
|
|
10
|
+
request: nonEmptyText,
|
|
11
|
+
context: nonEmptyText.optional(),
|
|
12
|
+
routes: routeInputSchema.shape.routes,
|
|
13
|
+
requirements: clarifyInputSchema.shape.requirements,
|
|
14
|
+
handoffRules: handoffInputSchema.shape.rules,
|
|
15
|
+
evidence: z
|
|
16
|
+
.array(answerabilityEvidenceSchema)
|
|
17
|
+
.max(100)
|
|
18
|
+
.refine((items) => new Set(items.map((item) => item.id)).size === items.length, 'Evidence IDs must be unique.'),
|
|
19
|
+
minConfidence: probability.optional(),
|
|
20
|
+
minRelevance: probability.optional(),
|
|
21
|
+
topK: z.number().int().min(1).max(50).optional(),
|
|
22
|
+
});
|
|
23
|
+
export const supportDraftContextSchema = z.object({
|
|
24
|
+
request: nonEmptyText,
|
|
25
|
+
context: nonEmptyText.optional(),
|
|
26
|
+
route: nonEmptyText,
|
|
27
|
+
evidence: z.array(answerabilityEvidenceSchema).min(1).max(50),
|
|
28
|
+
});
|
|
29
|
+
export const supportDraftSchema = z.object({
|
|
30
|
+
claims: z
|
|
31
|
+
.array(z.object({
|
|
32
|
+
id: nonEmptyText,
|
|
33
|
+
claim: nonEmptyText,
|
|
34
|
+
evidenceIds: z
|
|
35
|
+
.array(nonEmptyText)
|
|
36
|
+
.min(1)
|
|
37
|
+
.max(50)
|
|
38
|
+
.refine((ids) => new Set(ids).size === ids.length, 'Evidence references must be unique.'),
|
|
39
|
+
}))
|
|
40
|
+
.min(1)
|
|
41
|
+
.max(100)
|
|
42
|
+
.refine((claims) => new Set(claims.map((claim) => claim.id)).size === claims.length, 'Claim IDs must be unique.'),
|
|
43
|
+
});
|
|
44
|
+
export const supportDecisionsSchema = z.object({
|
|
45
|
+
handoff: handoffResultSchema.optional(),
|
|
46
|
+
clarify: clarifyResultSchema.optional(),
|
|
47
|
+
route: routeResultSchema.optional(),
|
|
48
|
+
rerank: rerankResultSchema.optional(),
|
|
49
|
+
answerability: answerabilityResultSchema.optional(),
|
|
50
|
+
verify: verifyResultSchema.optional(),
|
|
51
|
+
});
|
|
52
|
+
export const supportResultSchema = z.discriminatedUnion('outcome', [
|
|
53
|
+
z.object({
|
|
54
|
+
outcome: z.literal('answered'),
|
|
55
|
+
answer: nonEmptyText,
|
|
56
|
+
draft: supportDraftSchema,
|
|
57
|
+
decisions: supportDecisionsSchema,
|
|
58
|
+
}),
|
|
59
|
+
z.object({
|
|
60
|
+
outcome: z.enum([
|
|
61
|
+
'human',
|
|
62
|
+
'review',
|
|
63
|
+
'clarification',
|
|
64
|
+
'no_evidence',
|
|
65
|
+
'cannot_answer',
|
|
66
|
+
'unverified',
|
|
67
|
+
]),
|
|
68
|
+
stage: z.enum(['handoff', 'clarify', 'route', 'rerank', 'answerability', 'verify']),
|
|
69
|
+
decisions: supportDecisionsSchema,
|
|
70
|
+
}),
|
|
71
|
+
]);
|
|
72
|
+
export const supportFixtureSchema = z.object({
|
|
73
|
+
input: supportInputSchema,
|
|
74
|
+
draft: supportDraftSchema,
|
|
75
|
+
responses: z.record(nonEmptyText, decisionResponseSchema),
|
|
76
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { RecipeOptions } from '../../src/schema.js';
|
|
2
|
+
import type { SupportInput, SupportDraftContext, SupportDraft, SupportResult } from './schema.js';
|
|
3
|
+
export declare function answerSupportRequest(input: SupportInput, draftAnswer: (context: SupportDraftContext) => Promise<SupportDraft>, options?: RecipeOptions): Promise<SupportResult>;
|