@abhishek944/pi-classifier 0.6.0 → 0.7.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/CHANGELOG.md +13 -0
- package/README.md +122 -37
- package/dist/choices.js +1 -1
- package/dist/classify.d.ts +9 -1
- package/dist/classify.js +24 -10
- package/dist/config.d.ts +48 -2
- package/dist/config.js +77 -6
- package/dist/cost.js +5 -0
- package/dist/extension.js +7 -5
- package/dist/extract.d.ts +5 -1
- package/dist/extract.js +190 -3
- package/dist/index.d.ts +1 -1
- package/dist/inputs.d.ts +2 -2
- package/dist/inputs.js +47 -14
- package/dist/providers.js +62 -0
- package/dist/tool-contracts.d.ts +101 -226
- package/dist/tool-contracts.js +61 -116
- package/dist/types.d.ts +42 -8
- package/dist/validation.d.ts +8 -1
- package/dist/validation.js +158 -125
- package/package.json +1 -1
- package/src/choices.ts +1 -1
- package/src/classify.ts +44 -15
- package/src/config.ts +80 -6
- package/src/cost.ts +5 -0
- package/src/extension.ts +7 -5
- package/src/extract.ts +194 -5
- package/src/index.ts +3 -0
- package/src/inputs.ts +51 -18
- package/src/providers.ts +108 -0
- package/src/tool-contracts.ts +107 -150
- package/src/types.ts +46 -7
- package/src/validation.ts +142 -105
package/dist/providers.js
CHANGED
|
@@ -37,6 +37,12 @@ export async function classifyWithProvider(route, input, apiKey, signal) {
|
|
|
37
37
|
return classifySarvam(route, input, apiKey, signal);
|
|
38
38
|
case "system-one":
|
|
39
39
|
return classifySystemOne(route, input, apiKey, signal);
|
|
40
|
+
case "subq-system-one":
|
|
41
|
+
return classifySubQ(route, input, apiKey, signal);
|
|
42
|
+
case "alibaba-system-one":
|
|
43
|
+
return classifyAlibaba(route, input, apiKey, signal);
|
|
44
|
+
case "fireworks-system-one":
|
|
45
|
+
return classifyFireworks(route, input, apiKey, signal);
|
|
40
46
|
case "liquid-system-one":
|
|
41
47
|
return classifyLiquid(route, input, apiKey, signal);
|
|
42
48
|
case "microsoft-system-one":
|
|
@@ -1386,6 +1392,62 @@ async function classifySystemOne(route, input, apiKey, signal) {
|
|
|
1386
1392
|
fail(TYPESAFE_LABEL + " returned an unexpected response.");
|
|
1387
1393
|
return finish(route, parseTypedAnswers(TYPESAFE_LABEL, body.answers, input.questions), body.usage, requestId);
|
|
1388
1394
|
}
|
|
1395
|
+
/* SubQ Snap --------------------------------------------------------------- */
|
|
1396
|
+
const SUBQ_LABEL = "SubQ Snap";
|
|
1397
|
+
async function classifySubQ(route, input, apiKey, signal) {
|
|
1398
|
+
const payload = {
|
|
1399
|
+
model: route.model,
|
|
1400
|
+
state: input.state,
|
|
1401
|
+
questions: systemOneQuestions(input.questions, false),
|
|
1402
|
+
};
|
|
1403
|
+
if (input.images.length > 0)
|
|
1404
|
+
payload.images = input.images.map((image) => {
|
|
1405
|
+
if ("url" in image)
|
|
1406
|
+
throw new ClassifierError("capability", "SubQ accepts inline image bytes only.");
|
|
1407
|
+
return { mediaType: image.mimeType, base64: image.data };
|
|
1408
|
+
});
|
|
1409
|
+
const { body, requestId } = await postJson(route, "v1/systemone", payload, apiKey, signal);
|
|
1410
|
+
if (!isRecord(body))
|
|
1411
|
+
fail(SUBQ_LABEL + " returned an unexpected response.");
|
|
1412
|
+
return finish(route, parseTypedAnswers(SUBQ_LABEL, body.answers, input.questions), body.usage, requestId);
|
|
1413
|
+
}
|
|
1414
|
+
/* Alibaba Model Studio Decision Model ------------------------------------ */
|
|
1415
|
+
const ALIBABA_LABEL = "Alibaba Decision Model";
|
|
1416
|
+
async function classifyAlibaba(route, input, apiKey, signal) {
|
|
1417
|
+
const payload = {
|
|
1418
|
+
model: route.model,
|
|
1419
|
+
state: input.state,
|
|
1420
|
+
questions: systemOneQuestions(input.questions, false),
|
|
1421
|
+
};
|
|
1422
|
+
if (input.images.length > 0) {
|
|
1423
|
+
// Alibaba takes its own `image`/`images` entries whose `url` accepts a Base64 data URL.
|
|
1424
|
+
const images = input.images.map((image) => {
|
|
1425
|
+
if ("url" in image)
|
|
1426
|
+
throw new ClassifierError("capability", "Alibaba Decision Model requires local image data.");
|
|
1427
|
+
return { url: imageUrl(image) };
|
|
1428
|
+
});
|
|
1429
|
+
if (images.length === 1)
|
|
1430
|
+
payload.image = images[0];
|
|
1431
|
+
else
|
|
1432
|
+
payload.images = images;
|
|
1433
|
+
}
|
|
1434
|
+
const { body, requestId } = await postJson(route, "compatible-mode/v1/systemone", payload, apiKey, signal);
|
|
1435
|
+
if (!isRecord(body))
|
|
1436
|
+
fail(ALIBABA_LABEL + " returned an unexpected response.");
|
|
1437
|
+
return finish(route, parseTypedAnswers(ALIBABA_LABEL, body.answers, input.questions), body.usage, requestId);
|
|
1438
|
+
}
|
|
1439
|
+
/* Fireworks Rune ---------------------------------------------------------- */
|
|
1440
|
+
const FIREWORKS_LABEL = "Fireworks System One";
|
|
1441
|
+
async function classifyFireworks(route, input, apiKey, signal) {
|
|
1442
|
+
const { body, requestId } = await postJson(route, "systemone", {
|
|
1443
|
+
model: route.model,
|
|
1444
|
+
state: input.state,
|
|
1445
|
+
questions: systemOneQuestions(input.questions, false),
|
|
1446
|
+
}, apiKey, signal);
|
|
1447
|
+
if (!isRecord(body))
|
|
1448
|
+
fail(FIREWORKS_LABEL + " returned an unexpected response.");
|
|
1449
|
+
return finish(route, parseTypedAnswers(FIREWORKS_LABEL, body.answers, input.questions), body.usage, requestId);
|
|
1450
|
+
}
|
|
1389
1451
|
/* Cloudflare Workers AI (Clef and third-party System One envelopes) ------- */
|
|
1390
1452
|
function clefBodyModel(model) {
|
|
1391
1453
|
return /^@cf\/cloudflare\/(clef(?:-flash|-omni)?)$/.exec(model)?.[1];
|
package/dist/tool-contracts.d.ts
CHANGED
|
@@ -9,10 +9,10 @@ export declare const CLASSIFY_TOOL = "classify";
|
|
|
9
9
|
export declare const CLASSIFY_COMPARE_TOOL = "classify_compare";
|
|
10
10
|
export declare const CLASSIFY_TREE_TOOL = "classify_tree";
|
|
11
11
|
export declare const CLASSIFIER_BOX_TOOL = "classifier_box_image";
|
|
12
|
-
export declare const CLASSIFY_TOOL_DESCRIPTION = "Ask a decision model
|
|
13
|
-
export declare const CLASSIFY_COMPARE_TOOL_DESCRIPTION = "Explicitly compare the same
|
|
12
|
+
export declare const CLASSIFY_TOOL_DESCRIPTION = "Ask a decision model classification questions about text, JSON, images and supported audio/video: yes/no (bool), category (choice), multi-choice (multiple labels) and score. Extraction reads (text, numbers, dates, passages, box/boxes locations, locate offsets, estimates, Inception extract) are not classification and are rejected here; send the same question to classify_extract. Legacy image paths are shared; named path/url descriptors require explicit {$image:id} references. Jev supports images in instructions/criteria; OpenAI supports instruction images and hosted URLs. Unsupported placements fail locally. Returns bool probabilities, choices, multi-choice probabilities and scores, plus reported token usage and estimated USD cost (or an explicit unavailable reason). mode: web_grounding is an explicit Perplexity opt-in that sends question text and the start of state to web search and adds billed searches/fetches; cost.nonToken reports the documented fees. Provider/model are fixed by pi-classifier.default (or legacy defaultProvider/defaultModel); this tool cannot override them. API-key authentication is independent of Codex chat login. Only explicitly configured fallback routes may be used after a missing key or HTTP 401/404/429 before any batch has completed; never after uncertainty, refusals, timeouts or network failures. Use /classifier list or status to inspect configuration.";
|
|
13
|
+
export declare const CLASSIFY_COMPARE_TOOL_DESCRIPTION = "Explicitly compare the same classification questions and state using exactly pi-classifier.compare provider/model pairs. Each entry makes potentially billable requests, including multiple requests when choice batching is configured. No fallback, default substitution, provider/model overrides, or default changes. Returns labeled results, duration, usage, estimated USD costs (or unavailable reasons) and safe per-entry failures; cancellation retains completed results and prevents later requests.";
|
|
14
14
|
export declare const CLASSIFY_TREE_TOOL_DESCRIPTION = "Classify text, JSON or supported images through a nested classification tree. tree is an inline roots/id/description/children object or a local JSON file inside cwd. Choose among siblings, automatically follow sole children without model calls, and return Level1/Level2/etc under levels with per-step provenance, total providerCalls, reported usage and estimated USD cost. NONE, batching and initial fallback follow configured settings; after a successful decision the route is pinned. no_match, ambiguous and refusal retain only the selected prefix. Automatic steps are structural, not model confirmation; greedy traversal is not a global best-path guarantee. No provider/model override or comparison.";
|
|
15
|
-
export declare const CLASSIFIER_BOX_TOOL_DESCRIPTION = "Render a normalized bounding box on a local image, or crop to it, entirely locally. Use to inspect a box
|
|
15
|
+
export declare const CLASSIFIER_BOX_TOOL_DESCRIPTION = "Render a normalized bounding box on a local image, or crop to it, entirely locally. Use to inspect a box value returned by classify_extract. overlay keeps the image and draws a rectangle; crop returns only the clamped region. Returns a PNG plus exact source-pixel box metadata. No provider request, upload, resizing or disk write. A box is a localization hint, not proof that the object exists.";
|
|
16
16
|
export declare const classifyParameters: Type.TObject<{
|
|
17
17
|
state: Type.TUnion<[Type.TString, Type.TRecord<"^.*$", Type.TUnknown>, Type.TArray<Type.TUnknown>]>;
|
|
18
18
|
questions: Type.TRecord<"^.*$", Type.TUnion<[Type.TObject<{
|
|
@@ -46,66 +46,6 @@ export declare const classifyParameters: Type.TObject<{
|
|
|
46
46
|
$image: Type.TString;
|
|
47
47
|
}>]>>]>>;
|
|
48
48
|
descriptions: Type.TOptional<Type.TArray<Type.TString>>;
|
|
49
|
-
}>, Type.TObject<{
|
|
50
|
-
type: Type.TLiteral<"box">;
|
|
51
|
-
instructions: Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
52
|
-
$image: Type.TString;
|
|
53
|
-
}>]>>]>;
|
|
54
|
-
}>, Type.TObject<{
|
|
55
|
-
type: Type.TLiteral<"extract">;
|
|
56
|
-
instructions: Type.TOptional<Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
57
|
-
$image: Type.TString;
|
|
58
|
-
}>]>>]>>;
|
|
59
|
-
criteria: Type.TRecord<"^.*$", Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
60
|
-
$image: Type.TString;
|
|
61
|
-
}>]>>]>>;
|
|
62
|
-
source: Type.TOptional<Type.TString>;
|
|
63
|
-
threshold: Type.TOptional<Type.TNumber>;
|
|
64
|
-
snapToWords: Type.TOptional<Type.TBoolean>;
|
|
65
|
-
debug: Type.TOptional<Type.TBoolean>;
|
|
66
|
-
}>, Type.TObject<{
|
|
67
|
-
type: Type.TLiteral<"locate">;
|
|
68
|
-
instructions: Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
69
|
-
$image: Type.TString;
|
|
70
|
-
}>]>>]>;
|
|
71
|
-
}>, Type.TObject<{
|
|
72
|
-
type: Type.TLiteral<"text">;
|
|
73
|
-
instructions: Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
74
|
-
$image: Type.TString;
|
|
75
|
-
}>]>>]>;
|
|
76
|
-
}>, Type.TObject<{
|
|
77
|
-
type: Type.TLiteral<"number">;
|
|
78
|
-
instructions: Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
79
|
-
$image: Type.TString;
|
|
80
|
-
}>]>>]>;
|
|
81
|
-
unit: Type.TOptional<Type.TString>;
|
|
82
|
-
range: Type.TOptional<Type.TTuple<[Type.TNumber, Type.TNumber]>>;
|
|
83
|
-
step: Type.TOptional<Type.TNumber>;
|
|
84
|
-
}>, Type.TObject<{
|
|
85
|
-
type: Type.TLiteral<"date">;
|
|
86
|
-
instructions: Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
87
|
-
$image: Type.TString;
|
|
88
|
-
}>]>>]>;
|
|
89
|
-
}>, Type.TObject<{
|
|
90
|
-
type: Type.TLiteral<"spans">;
|
|
91
|
-
instructions: Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
92
|
-
$image: Type.TString;
|
|
93
|
-
}>]>>]>;
|
|
94
|
-
max: Type.TOptional<Type.TInteger>;
|
|
95
|
-
}>, Type.TObject<{
|
|
96
|
-
type: Type.TLiteral<"boxes">;
|
|
97
|
-
instructions: Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
98
|
-
$image: Type.TString;
|
|
99
|
-
}>]>>]>;
|
|
100
|
-
max: Type.TOptional<Type.TInteger>;
|
|
101
|
-
}>, Type.TObject<{
|
|
102
|
-
type: Type.TLiteral<"estimate">;
|
|
103
|
-
instructions: Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
104
|
-
$image: Type.TString;
|
|
105
|
-
}>]>>]>;
|
|
106
|
-
range: Type.TTuple<[Type.TNumber, Type.TNumber]>;
|
|
107
|
-
step: Type.TOptional<Type.TNumber>;
|
|
108
|
-
unit: Type.TOptional<Type.TString>;
|
|
109
49
|
}>, Type.TObject<{
|
|
110
50
|
type: Type.TLiteral<"multi_choice">;
|
|
111
51
|
instructions: Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
@@ -154,86 +94,6 @@ export declare const classifyOutput: Type.TObject<{
|
|
|
154
94
|
score: Type.TNumber;
|
|
155
95
|
confidence: Type.TNumber;
|
|
156
96
|
probabilities: Type.TOptional<Type.TRecord<"^.*$", Type.TNumber>>;
|
|
157
|
-
}>, Type.TObject<{
|
|
158
|
-
type: Type.TLiteral<"box">;
|
|
159
|
-
box: Type.TObject<{
|
|
160
|
-
top: Type.TNumber;
|
|
161
|
-
bottom: Type.TNumber;
|
|
162
|
-
left: Type.TNumber;
|
|
163
|
-
right: Type.TNumber;
|
|
164
|
-
}>;
|
|
165
|
-
confidence: Type.TNumber;
|
|
166
|
-
found: Type.TOptional<Type.TNumber>;
|
|
167
|
-
}>, Type.TObject<{
|
|
168
|
-
type: Type.TLiteral<"locate">;
|
|
169
|
-
spans: Type.TArray<Type.TObject<{
|
|
170
|
-
start: Type.TInteger;
|
|
171
|
-
end: Type.TInteger;
|
|
172
|
-
text: Type.TString;
|
|
173
|
-
score: Type.TNumber;
|
|
174
|
-
searchResult: Type.TOptional<Type.TInteger>;
|
|
175
|
-
}>>;
|
|
176
|
-
}>, Type.TObject<{
|
|
177
|
-
type: Type.TLiteral<"extract">;
|
|
178
|
-
spans: Type.TRecord<"^.*$", Type.TArray<Type.TObject<{
|
|
179
|
-
start: Type.TInteger;
|
|
180
|
-
end: Type.TInteger;
|
|
181
|
-
text: Type.TString;
|
|
182
|
-
score: Type.TNumber;
|
|
183
|
-
searchResult: Type.TOptional<Type.TInteger>;
|
|
184
|
-
}>>>;
|
|
185
|
-
notStated: Type.TRecord<"^.*$", Type.TNumber>;
|
|
186
|
-
}>, Type.TObject<{
|
|
187
|
-
type: Type.TLiteral<"text">;
|
|
188
|
-
text: Type.TString;
|
|
189
|
-
span: Type.TOptional<Type.TUnion<[Type.TTuple<[Type.TInteger, Type.TInteger]>, Type.TNull]>>;
|
|
190
|
-
found: Type.TOptional<Type.TNumber>;
|
|
191
|
-
path: Type.TOptional<Type.TString>;
|
|
192
|
-
}>, Type.TObject<{
|
|
193
|
-
type: Type.TLiteral<"number">;
|
|
194
|
-
value: Type.TUnion<[Type.TNumber, Type.TNull]>;
|
|
195
|
-
unit: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
196
|
-
text: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
197
|
-
span: Type.TOptional<Type.TUnion<[Type.TTuple<[Type.TInteger, Type.TInteger]>, Type.TNull]>>;
|
|
198
|
-
found: Type.TOptional<Type.TNumber>;
|
|
199
|
-
path: Type.TOptional<Type.TString>;
|
|
200
|
-
}>, Type.TObject<{
|
|
201
|
-
type: Type.TLiteral<"date">;
|
|
202
|
-
date: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
203
|
-
text: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
204
|
-
span: Type.TOptional<Type.TUnion<[Type.TTuple<[Type.TInteger, Type.TInteger]>, Type.TNull]>>;
|
|
205
|
-
found: Type.TOptional<Type.TNumber>;
|
|
206
|
-
path: Type.TOptional<Type.TString>;
|
|
207
|
-
}>, Type.TObject<{
|
|
208
|
-
type: Type.TLiteral<"spans">;
|
|
209
|
-
spans: Type.TArray<Type.TObject<{
|
|
210
|
-
text: Type.TString;
|
|
211
|
-
span: Type.TTuple<[Type.TInteger, Type.TInteger]>;
|
|
212
|
-
found: Type.TNumber;
|
|
213
|
-
}>>;
|
|
214
|
-
count: Type.TInteger;
|
|
215
|
-
atLeast: Type.TBoolean;
|
|
216
|
-
presence: Type.TArray<Type.TNumber>;
|
|
217
|
-
}>, Type.TObject<{
|
|
218
|
-
type: Type.TLiteral<"boxes">;
|
|
219
|
-
boxes: Type.TArray<Type.TObject<{
|
|
220
|
-
box: Type.TObject<{
|
|
221
|
-
top: Type.TNumber;
|
|
222
|
-
bottom: Type.TNumber;
|
|
223
|
-
left: Type.TNumber;
|
|
224
|
-
right: Type.TNumber;
|
|
225
|
-
}>;
|
|
226
|
-
found: Type.TNumber;
|
|
227
|
-
confidence: Type.TNumber;
|
|
228
|
-
}>>;
|
|
229
|
-
count: Type.TInteger;
|
|
230
|
-
atLeast: Type.TBoolean;
|
|
231
|
-
presence: Type.TArray<Type.TNumber>;
|
|
232
|
-
}>, Type.TObject<{
|
|
233
|
-
type: Type.TLiteral<"estimate">;
|
|
234
|
-
value: Type.TNumber;
|
|
235
|
-
interval: Type.TTuple<[Type.TNumber, Type.TNumber]>;
|
|
236
|
-
unit: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
237
97
|
}>, Type.TObject<{
|
|
238
98
|
type: Type.TLiteral<"multi_choice">;
|
|
239
99
|
choices: Type.TArray<Type.TString>;
|
|
@@ -358,86 +218,6 @@ export declare const classifyCompareOutput: Type.TObject<{
|
|
|
358
218
|
score: Type.TNumber;
|
|
359
219
|
confidence: Type.TNumber;
|
|
360
220
|
probabilities: Type.TOptional<Type.TRecord<"^.*$", Type.TNumber>>;
|
|
361
|
-
}>, Type.TObject<{
|
|
362
|
-
type: Type.TLiteral<"box">;
|
|
363
|
-
box: Type.TObject<{
|
|
364
|
-
top: Type.TNumber;
|
|
365
|
-
bottom: Type.TNumber;
|
|
366
|
-
left: Type.TNumber;
|
|
367
|
-
right: Type.TNumber;
|
|
368
|
-
}>;
|
|
369
|
-
confidence: Type.TNumber;
|
|
370
|
-
found: Type.TOptional<Type.TNumber>;
|
|
371
|
-
}>, Type.TObject<{
|
|
372
|
-
type: Type.TLiteral<"locate">;
|
|
373
|
-
spans: Type.TArray<Type.TObject<{
|
|
374
|
-
start: Type.TInteger;
|
|
375
|
-
end: Type.TInteger;
|
|
376
|
-
text: Type.TString;
|
|
377
|
-
score: Type.TNumber;
|
|
378
|
-
searchResult: Type.TOptional<Type.TInteger>;
|
|
379
|
-
}>>;
|
|
380
|
-
}>, Type.TObject<{
|
|
381
|
-
type: Type.TLiteral<"extract">;
|
|
382
|
-
spans: Type.TRecord<"^.*$", Type.TArray<Type.TObject<{
|
|
383
|
-
start: Type.TInteger;
|
|
384
|
-
end: Type.TInteger;
|
|
385
|
-
text: Type.TString;
|
|
386
|
-
score: Type.TNumber;
|
|
387
|
-
searchResult: Type.TOptional<Type.TInteger>;
|
|
388
|
-
}>>>;
|
|
389
|
-
notStated: Type.TRecord<"^.*$", Type.TNumber>;
|
|
390
|
-
}>, Type.TObject<{
|
|
391
|
-
type: Type.TLiteral<"text">;
|
|
392
|
-
text: Type.TString;
|
|
393
|
-
span: Type.TOptional<Type.TUnion<[Type.TTuple<[Type.TInteger, Type.TInteger]>, Type.TNull]>>;
|
|
394
|
-
found: Type.TOptional<Type.TNumber>;
|
|
395
|
-
path: Type.TOptional<Type.TString>;
|
|
396
|
-
}>, Type.TObject<{
|
|
397
|
-
type: Type.TLiteral<"number">;
|
|
398
|
-
value: Type.TUnion<[Type.TNumber, Type.TNull]>;
|
|
399
|
-
unit: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
400
|
-
text: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
401
|
-
span: Type.TOptional<Type.TUnion<[Type.TTuple<[Type.TInteger, Type.TInteger]>, Type.TNull]>>;
|
|
402
|
-
found: Type.TOptional<Type.TNumber>;
|
|
403
|
-
path: Type.TOptional<Type.TString>;
|
|
404
|
-
}>, Type.TObject<{
|
|
405
|
-
type: Type.TLiteral<"date">;
|
|
406
|
-
date: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
407
|
-
text: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
408
|
-
span: Type.TOptional<Type.TUnion<[Type.TTuple<[Type.TInteger, Type.TInteger]>, Type.TNull]>>;
|
|
409
|
-
found: Type.TOptional<Type.TNumber>;
|
|
410
|
-
path: Type.TOptional<Type.TString>;
|
|
411
|
-
}>, Type.TObject<{
|
|
412
|
-
type: Type.TLiteral<"spans">;
|
|
413
|
-
spans: Type.TArray<Type.TObject<{
|
|
414
|
-
text: Type.TString;
|
|
415
|
-
span: Type.TTuple<[Type.TInteger, Type.TInteger]>;
|
|
416
|
-
found: Type.TNumber;
|
|
417
|
-
}>>;
|
|
418
|
-
count: Type.TInteger;
|
|
419
|
-
atLeast: Type.TBoolean;
|
|
420
|
-
presence: Type.TArray<Type.TNumber>;
|
|
421
|
-
}>, Type.TObject<{
|
|
422
|
-
type: Type.TLiteral<"boxes">;
|
|
423
|
-
boxes: Type.TArray<Type.TObject<{
|
|
424
|
-
box: Type.TObject<{
|
|
425
|
-
top: Type.TNumber;
|
|
426
|
-
bottom: Type.TNumber;
|
|
427
|
-
left: Type.TNumber;
|
|
428
|
-
right: Type.TNumber;
|
|
429
|
-
}>;
|
|
430
|
-
found: Type.TNumber;
|
|
431
|
-
confidence: Type.TNumber;
|
|
432
|
-
}>>;
|
|
433
|
-
count: Type.TInteger;
|
|
434
|
-
atLeast: Type.TBoolean;
|
|
435
|
-
presence: Type.TArray<Type.TNumber>;
|
|
436
|
-
}>, Type.TObject<{
|
|
437
|
-
type: Type.TLiteral<"estimate">;
|
|
438
|
-
value: Type.TNumber;
|
|
439
|
-
interval: Type.TTuple<[Type.TNumber, Type.TNumber]>;
|
|
440
|
-
unit: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
441
221
|
}>, Type.TObject<{
|
|
442
222
|
type: Type.TLiteral<"multi_choice">;
|
|
443
223
|
choices: Type.TArray<Type.TString>;
|
|
@@ -665,10 +445,10 @@ export declare const boxOutput: Type.TObject<{
|
|
|
665
445
|
byteLength: Type.TInteger;
|
|
666
446
|
}>;
|
|
667
447
|
export declare const CLASSIFY_EXTRACT_TOOL = "classify_extract";
|
|
668
|
-
export declare const CLASSIFY_EXTRACT_TOOL_DESCRIPTION = "
|
|
448
|
+
export declare const CLASSIFY_EXTRACT_TOOL_DESCRIPTION = "Read values out of source material; this tool does not make classification decisions. Use fields for Clairic-shaped field specifications (text, number, date, enum, object, list, estimate, forecast) on clairic-api, openrouter-extractions-api or litellm-extraction-api, or questions for typed extraction reads (text, number, date, spans, box, boxes, locate, estimate and Inception extract) on the configured decision route, including direct liquid-api d1.2 and d1.2-ultra. Supply exactly one of fields or questions. State is text/JSON plus optional images; field mode also accepts PDF documents. Question answers return {type, value, ...metadata} such as span, found, path and confidence. Returns reported token usage and estimated USD cost; truncated reports incomplete generated field output. The tool cannot override the provider or model.";
|
|
669
449
|
export declare const classifyExtractParameters: Type.TObject<{
|
|
670
450
|
state: Type.TOptional<Type.TUnion<[Type.TString, Type.TRecord<"^.*$", Type.TUnknown>, Type.TArray<Type.TUnknown>]>>;
|
|
671
|
-
fields: Type.TRecord<"^.*$", Type.TObject<{
|
|
451
|
+
fields: Type.TOptional<Type.TRecord<"^.*$", Type.TObject<{
|
|
672
452
|
type: Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"number">, Type.TLiteral<"compute">, Type.TLiteral<"date">, Type.TLiteral<"time">, Type.TLiteral<"datetime">, Type.TLiteral<"duration">, Type.TLiteral<"boolean">, Type.TLiteral<"enum">, Type.TLiteral<"object">, Type.TLiteral<"list">, Type.TLiteral<"estimate">, Type.TLiteral<"forecast">]>;
|
|
673
453
|
instructions: Type.TOptional<Type.TString>;
|
|
674
454
|
nullable: Type.TOptional<Type.TBoolean>;
|
|
@@ -698,17 +478,89 @@ export declare const classifyExtractParameters: Type.TObject<{
|
|
|
698
478
|
scale: Type.TOptional<Type.TUnion<[Type.TLiteral<"linear">, Type.TLiteral<"log">]>>;
|
|
699
479
|
horizon: Type.TOptional<Type.TInteger>;
|
|
700
480
|
interval: Type.TOptional<Type.TUnion<[Type.TLiteral<"step">, Type.TLiteral<"minute">, Type.TLiteral<"hour">, Type.TLiteral<"day">, Type.TLiteral<"week">, Type.TLiteral<"month">, Type.TLiteral<"quarter">, Type.TLiteral<"year">]>>;
|
|
701
|
-
}
|
|
481
|
+
}>>>;
|
|
482
|
+
questions: Type.TOptional<Type.TRecord<"^.*$", Type.TUnion<[Type.TObject<{
|
|
483
|
+
type: Type.TLiteral<"box">;
|
|
484
|
+
instructions: Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
485
|
+
$image: Type.TString;
|
|
486
|
+
}>]>>]>;
|
|
487
|
+
}>, Type.TObject<{
|
|
488
|
+
type: Type.TLiteral<"extract">;
|
|
489
|
+
instructions: Type.TOptional<Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
490
|
+
$image: Type.TString;
|
|
491
|
+
}>]>>]>>;
|
|
492
|
+
criteria: Type.TRecord<"^.*$", Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
493
|
+
$image: Type.TString;
|
|
494
|
+
}>]>>]>>;
|
|
495
|
+
source: Type.TOptional<Type.TString>;
|
|
496
|
+
threshold: Type.TOptional<Type.TNumber>;
|
|
497
|
+
snapToWords: Type.TOptional<Type.TBoolean>;
|
|
498
|
+
debug: Type.TOptional<Type.TBoolean>;
|
|
499
|
+
}>, Type.TObject<{
|
|
500
|
+
type: Type.TLiteral<"locate">;
|
|
501
|
+
instructions: Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
502
|
+
$image: Type.TString;
|
|
503
|
+
}>]>>]>;
|
|
504
|
+
}>, Type.TObject<{
|
|
505
|
+
type: Type.TLiteral<"text">;
|
|
506
|
+
instructions: Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
507
|
+
$image: Type.TString;
|
|
508
|
+
}>]>>]>;
|
|
509
|
+
}>, Type.TObject<{
|
|
510
|
+
type: Type.TLiteral<"number">;
|
|
511
|
+
instructions: Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
512
|
+
$image: Type.TString;
|
|
513
|
+
}>]>>]>;
|
|
514
|
+
unit: Type.TOptional<Type.TString>;
|
|
515
|
+
range: Type.TOptional<Type.TTuple<[Type.TNumber, Type.TNumber]>>;
|
|
516
|
+
step: Type.TOptional<Type.TNumber>;
|
|
517
|
+
}>, Type.TObject<{
|
|
518
|
+
type: Type.TLiteral<"date">;
|
|
519
|
+
instructions: Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
520
|
+
$image: Type.TString;
|
|
521
|
+
}>]>>]>;
|
|
522
|
+
}>, Type.TObject<{
|
|
523
|
+
type: Type.TLiteral<"spans">;
|
|
524
|
+
instructions: Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
525
|
+
$image: Type.TString;
|
|
526
|
+
}>]>>]>;
|
|
527
|
+
max: Type.TOptional<Type.TInteger>;
|
|
528
|
+
}>, Type.TObject<{
|
|
529
|
+
type: Type.TLiteral<"boxes">;
|
|
530
|
+
instructions: Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
531
|
+
$image: Type.TString;
|
|
532
|
+
}>]>>]>;
|
|
533
|
+
max: Type.TOptional<Type.TInteger>;
|
|
534
|
+
}>, Type.TObject<{
|
|
535
|
+
type: Type.TLiteral<"estimate">;
|
|
536
|
+
instructions: Type.TUnion<[Type.TString, Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
537
|
+
$image: Type.TString;
|
|
538
|
+
}>]>>]>;
|
|
539
|
+
range: Type.TTuple<[Type.TNumber, Type.TNumber]>;
|
|
540
|
+
step: Type.TOptional<Type.TNumber>;
|
|
541
|
+
unit: Type.TOptional<Type.TString>;
|
|
542
|
+
}>]>>>;
|
|
702
543
|
images: Type.TOptional<Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
|
|
544
|
+
id: Type.TString;
|
|
545
|
+
path: Type.TString;
|
|
546
|
+
}>, Type.TObject<{
|
|
547
|
+
id: Type.TString;
|
|
548
|
+
url: Type.TString;
|
|
549
|
+
}>, Type.TObject<{
|
|
703
550
|
path: Type.TString;
|
|
704
551
|
rotation: Type.TOptional<Type.TUnion<[Type.TLiteral<0>, Type.TLiteral<90>, Type.TLiteral<180>, Type.TLiteral<270>]>>;
|
|
705
552
|
}>]>>>;
|
|
553
|
+
media: Type.TOptional<Type.TArray<Type.TObject<{
|
|
554
|
+
type: Type.TUnion<[Type.TLiteral<"audio">, Type.TLiteral<"video">]>;
|
|
555
|
+
path: Type.TString;
|
|
556
|
+
}>>>;
|
|
706
557
|
documents: Type.TOptional<Type.TArray<Type.TString>>;
|
|
707
558
|
referenceDate: Type.TOptional<Type.TString>;
|
|
708
559
|
options: Type.TOptional<Type.TObject<{
|
|
709
560
|
includeQuantiles: Type.TOptional<Type.TBoolean>;
|
|
710
561
|
returnStateText: Type.TOptional<Type.TBoolean>;
|
|
711
562
|
}>>;
|
|
563
|
+
mode: Type.TOptional<Type.TLiteral<"web_grounding">>;
|
|
712
564
|
}>;
|
|
713
565
|
export declare const classifyExtractOutput: Type.TObject<{
|
|
714
566
|
provider: Type.TString;
|
|
@@ -782,4 +634,27 @@ export declare const classifyExtractOutput: Type.TObject<{
|
|
|
782
634
|
}>>;
|
|
783
635
|
requestId: Type.TOptional<Type.TString>;
|
|
784
636
|
stateText: Type.TOptional<Type.TString>;
|
|
637
|
+
citations: Type.TOptional<Type.TArray<Type.TObject<{
|
|
638
|
+
url: Type.TString;
|
|
639
|
+
title: Type.TOptional<Type.TString>;
|
|
640
|
+
excerpts: Type.TOptional<Type.TArray<Type.TString>>;
|
|
641
|
+
}>>>;
|
|
642
|
+
webGrounding: Type.TOptional<Type.TObject<{
|
|
643
|
+
searchResults: Type.TArray<Type.TObject<{
|
|
644
|
+
title: Type.TString;
|
|
645
|
+
url: Type.TString;
|
|
646
|
+
snippet: Type.TString;
|
|
647
|
+
date: Type.TOptional<Type.TString>;
|
|
648
|
+
lastUpdated: Type.TOptional<Type.TString>;
|
|
649
|
+
}>>;
|
|
650
|
+
fetchedResults: Type.TOptional<Type.TArray<Type.TObject<{
|
|
651
|
+
title: Type.TString;
|
|
652
|
+
url: Type.TString;
|
|
653
|
+
snippet: Type.TString;
|
|
654
|
+
}>>>;
|
|
655
|
+
}>>;
|
|
656
|
+
attemptedRoutes: Type.TOptional<Type.TArray<Type.TObject<{
|
|
657
|
+
provider: Type.TString;
|
|
658
|
+
model: Type.TString;
|
|
659
|
+
}>>>;
|
|
785
660
|
}>;
|