@openrouter/sdk 1.5.24 → 1.5.25
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/esm/funcs/alphaExtractionsCreate.d.ts +19 -0
- package/esm/funcs/alphaExtractionsCreate.js +105 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/decisionsresponse.d.ts +3 -3
- package/esm/models/decisionsresponse.js +3 -3
- package/esm/models/extractiondateanswer.d.ts +46 -0
- package/esm/models/extractiondateanswer.js +37 -0
- package/esm/models/extractiondatefield.d.ts +22 -0
- package/esm/models/extractiondatefield.js +20 -0
- package/esm/models/extractiondatetimeanswer.d.ts +46 -0
- package/esm/models/extractiondatetimeanswer.js +37 -0
- package/esm/models/extractiondatetimefield.d.ts +22 -0
- package/esm/models/extractiondatetimefield.js +20 -0
- package/esm/models/extractiondurationanswer.d.ts +50 -0
- package/esm/models/extractiondurationanswer.js +38 -0
- package/esm/models/extractiondurationfield.d.ts +34 -0
- package/esm/models/extractiondurationfield.js +23 -0
- package/esm/models/extractionestimateanswer.d.ts +89 -0
- package/esm/models/extractionestimateanswer.js +80 -0
- package/esm/models/extractionestimatefield.d.ts +70 -0
- package/esm/models/extractionestimatefield.js +65 -0
- package/esm/models/extractionforecastanswer.d.ts +72 -0
- package/esm/models/extractionforecastanswer.js +72 -0
- package/esm/models/extractionforecastfield.d.ts +90 -0
- package/esm/models/extractionforecastfield.js +80 -0
- package/esm/models/extractionforecaststep.d.ts +50 -0
- package/esm/models/extractionforecaststep.js +57 -0
- package/esm/models/extractionlistanswer.d.ts +51 -0
- package/esm/models/extractionlistanswer.js +47 -0
- package/esm/models/extractionlistfield.d.ts +38 -0
- package/esm/models/extractionlistfield.js +31 -0
- package/esm/models/extractionnumberanswer.d.ts +46 -0
- package/esm/models/extractionnumberanswer.js +37 -0
- package/esm/models/extractionnumberfield.d.ts +31 -0
- package/esm/models/extractionnumberfield.js +23 -0
- package/esm/models/extractionsrequest.d.ts +75 -0
- package/esm/models/extractionsrequest.js +65 -0
- package/esm/models/extractionsresponse.d.ts +42 -0
- package/esm/models/extractionsresponse.js +61 -0
- package/esm/models/extractionsusage.d.ts +19 -0
- package/esm/models/extractionsusage.js +29 -0
- package/esm/models/extractiontextanswer.d.ts +46 -0
- package/esm/models/extractiontextanswer.js +37 -0
- package/esm/models/extractiontextfield.d.ts +22 -0
- package/esm/models/extractiontextfield.js +20 -0
- package/esm/models/extractiontimeanswer.d.ts +46 -0
- package/esm/models/extractiontimeanswer.js +37 -0
- package/esm/models/extractiontimefield.d.ts +22 -0
- package/esm/models/extractiontimefield.js +20 -0
- package/esm/models/generationresponse.d.ts +1 -0
- package/esm/models/generationresponse.js +1 -0
- package/esm/models/index.d.ts +22 -0
- package/esm/models/index.js +22 -0
- package/esm/models/operations/createapialphaextractions.d.ts +57 -0
- package/esm/models/operations/createapialphaextractions.js +26 -0
- package/esm/models/operations/index.d.ts +1 -0
- package/esm/models/operations/index.js +1 -0
- package/esm/sdk/alpha.d.ts +3 -0
- package/esm/sdk/alpha.js +4 -0
- package/esm/sdk/extractions.d.ts +13 -0
- package/esm/sdk/extractions.js +19 -0
- package/jsr.json +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
export type ExtractionForecastStepMean = number | string;
|
|
5
|
+
export type ExtractionForecastStepMedian = number | string;
|
|
6
|
+
export type ExtractionForecastStepP10 = number | string;
|
|
7
|
+
export type ExtractionForecastStepP90 = number | string;
|
|
8
|
+
export type ExtractionForecastStepQuantile = number | string;
|
|
9
|
+
export type ExtractionForecastStepValue = number | string;
|
|
10
|
+
export type ExtractionForecastStep = {
|
|
11
|
+
mean?: number | string | undefined;
|
|
12
|
+
median?: number | string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Probability mass above `max`.
|
|
15
|
+
*/
|
|
16
|
+
pAbove?: number | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Probability mass below `min`.
|
|
19
|
+
*/
|
|
20
|
+
pBelow?: number | undefined;
|
|
21
|
+
p10?: number | string | undefined;
|
|
22
|
+
p90?: number | string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* 99 percentiles, present when the provider is asked for quantiles.
|
|
25
|
+
*/
|
|
26
|
+
quantiles?: Array<number | string> | undefined;
|
|
27
|
+
value: number | string | null;
|
|
28
|
+
};
|
|
29
|
+
/** @internal */
|
|
30
|
+
export declare const ExtractionForecastStepMean$inboundSchema: z.ZodType<ExtractionForecastStepMean, unknown>;
|
|
31
|
+
export declare function extractionForecastStepMeanFromJSON(jsonString: string): SafeParseResult<ExtractionForecastStepMean, SDKValidationError>;
|
|
32
|
+
/** @internal */
|
|
33
|
+
export declare const ExtractionForecastStepMedian$inboundSchema: z.ZodType<ExtractionForecastStepMedian, unknown>;
|
|
34
|
+
export declare function extractionForecastStepMedianFromJSON(jsonString: string): SafeParseResult<ExtractionForecastStepMedian, SDKValidationError>;
|
|
35
|
+
/** @internal */
|
|
36
|
+
export declare const ExtractionForecastStepP10$inboundSchema: z.ZodType<ExtractionForecastStepP10, unknown>;
|
|
37
|
+
export declare function extractionForecastStepP10FromJSON(jsonString: string): SafeParseResult<ExtractionForecastStepP10, SDKValidationError>;
|
|
38
|
+
/** @internal */
|
|
39
|
+
export declare const ExtractionForecastStepP90$inboundSchema: z.ZodType<ExtractionForecastStepP90, unknown>;
|
|
40
|
+
export declare function extractionForecastStepP90FromJSON(jsonString: string): SafeParseResult<ExtractionForecastStepP90, SDKValidationError>;
|
|
41
|
+
/** @internal */
|
|
42
|
+
export declare const ExtractionForecastStepQuantile$inboundSchema: z.ZodType<ExtractionForecastStepQuantile, unknown>;
|
|
43
|
+
export declare function extractionForecastStepQuantileFromJSON(jsonString: string): SafeParseResult<ExtractionForecastStepQuantile, SDKValidationError>;
|
|
44
|
+
/** @internal */
|
|
45
|
+
export declare const ExtractionForecastStepValue$inboundSchema: z.ZodType<ExtractionForecastStepValue, unknown>;
|
|
46
|
+
export declare function extractionForecastStepValueFromJSON(jsonString: string): SafeParseResult<ExtractionForecastStepValue, SDKValidationError>;
|
|
47
|
+
/** @internal */
|
|
48
|
+
export declare const ExtractionForecastStep$inboundSchema: z.ZodType<ExtractionForecastStep, unknown>;
|
|
49
|
+
export declare function extractionForecastStepFromJSON(jsonString: string): SafeParseResult<ExtractionForecastStep, SDKValidationError>;
|
|
50
|
+
//# sourceMappingURL=extractionforecaststep.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 5e3688a043e1
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const ExtractionForecastStepMean$inboundSchema = z.union([z.number(), z.string()]);
|
|
10
|
+
export function extractionForecastStepMeanFromJSON(jsonString) {
|
|
11
|
+
return safeParse(jsonString, (x) => ExtractionForecastStepMean$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionForecastStepMean' from JSON`);
|
|
12
|
+
}
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const ExtractionForecastStepMedian$inboundSchema = z.union([z.number(), z.string()]);
|
|
15
|
+
export function extractionForecastStepMedianFromJSON(jsonString) {
|
|
16
|
+
return safeParse(jsonString, (x) => ExtractionForecastStepMedian$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionForecastStepMedian' from JSON`);
|
|
17
|
+
}
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const ExtractionForecastStepP10$inboundSchema = z.union([z.number(), z.string()]);
|
|
20
|
+
export function extractionForecastStepP10FromJSON(jsonString) {
|
|
21
|
+
return safeParse(jsonString, (x) => ExtractionForecastStepP10$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionForecastStepP10' from JSON`);
|
|
22
|
+
}
|
|
23
|
+
/** @internal */
|
|
24
|
+
export const ExtractionForecastStepP90$inboundSchema = z.union([z.number(), z.string()]);
|
|
25
|
+
export function extractionForecastStepP90FromJSON(jsonString) {
|
|
26
|
+
return safeParse(jsonString, (x) => ExtractionForecastStepP90$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionForecastStepP90' from JSON`);
|
|
27
|
+
}
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const ExtractionForecastStepQuantile$inboundSchema = z.union([z.number(), z.string()]);
|
|
30
|
+
export function extractionForecastStepQuantileFromJSON(jsonString) {
|
|
31
|
+
return safeParse(jsonString, (x) => ExtractionForecastStepQuantile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionForecastStepQuantile' from JSON`);
|
|
32
|
+
}
|
|
33
|
+
/** @internal */
|
|
34
|
+
export const ExtractionForecastStepValue$inboundSchema = z.union([z.number(), z.string()]);
|
|
35
|
+
export function extractionForecastStepValueFromJSON(jsonString) {
|
|
36
|
+
return safeParse(jsonString, (x) => ExtractionForecastStepValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionForecastStepValue' from JSON`);
|
|
37
|
+
}
|
|
38
|
+
/** @internal */
|
|
39
|
+
export const ExtractionForecastStep$inboundSchema = z.object({
|
|
40
|
+
mean: z.union([z.number(), z.string()]).optional(),
|
|
41
|
+
median: z.union([z.number(), z.string()]).optional(),
|
|
42
|
+
p_above: z.number().optional(),
|
|
43
|
+
p_below: z.number().optional(),
|
|
44
|
+
p10: z.union([z.number(), z.string()]).optional(),
|
|
45
|
+
p90: z.union([z.number(), z.string()]).optional(),
|
|
46
|
+
quantiles: z.array(z.union([z.number(), z.string()])).optional(),
|
|
47
|
+
value: z.nullable(z.union([z.number(), z.string()])),
|
|
48
|
+
}).transform((v) => {
|
|
49
|
+
return remap$(v, {
|
|
50
|
+
"p_above": "pAbove",
|
|
51
|
+
"p_below": "pBelow",
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
export function extractionForecastStepFromJSON(jsonString) {
|
|
55
|
+
return safeParse(jsonString, (x) => ExtractionForecastStep$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionForecastStep' from JSON`);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=extractionforecaststep.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
export type ExtractionListAnswerGuess = string | number;
|
|
6
|
+
/**
|
|
7
|
+
* Set to `image` when the answer was read from an image rather than the state text.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ExtractionListAnswerSource: {
|
|
10
|
+
readonly State: "state";
|
|
11
|
+
readonly Image: "image";
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Set to `image` when the answer was read from an image rather than the state text.
|
|
15
|
+
*/
|
|
16
|
+
export type ExtractionListAnswerSource = OpenEnum<typeof ExtractionListAnswerSource>;
|
|
17
|
+
export type ExtractionListAnswerValue = string | number;
|
|
18
|
+
export type ExtractionListAnswer = {
|
|
19
|
+
confidence?: number | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* The most likely value even when `value` is null because `p_null` crossed the threshold.
|
|
22
|
+
*/
|
|
23
|
+
guess?: Array<string | number> | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Probability that the state contains nothing for this field.
|
|
26
|
+
*/
|
|
27
|
+
pNull?: number | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Set to `image` when the answer was read from an image rather than the state text.
|
|
30
|
+
*/
|
|
31
|
+
source?: ExtractionListAnswerSource | undefined;
|
|
32
|
+
spans?: Array<Array<number>> | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Confidence in the spelling of text read from an image.
|
|
35
|
+
*/
|
|
36
|
+
spellConfidence?: number | undefined;
|
|
37
|
+
type: "list";
|
|
38
|
+
value: Array<string | number> | null;
|
|
39
|
+
};
|
|
40
|
+
/** @internal */
|
|
41
|
+
export declare const ExtractionListAnswerGuess$inboundSchema: z.ZodType<ExtractionListAnswerGuess, unknown>;
|
|
42
|
+
export declare function extractionListAnswerGuessFromJSON(jsonString: string): SafeParseResult<ExtractionListAnswerGuess, SDKValidationError>;
|
|
43
|
+
/** @internal */
|
|
44
|
+
export declare const ExtractionListAnswerSource$inboundSchema: z.ZodType<ExtractionListAnswerSource, unknown>;
|
|
45
|
+
/** @internal */
|
|
46
|
+
export declare const ExtractionListAnswerValue$inboundSchema: z.ZodType<ExtractionListAnswerValue, unknown>;
|
|
47
|
+
export declare function extractionListAnswerValueFromJSON(jsonString: string): SafeParseResult<ExtractionListAnswerValue, SDKValidationError>;
|
|
48
|
+
/** @internal */
|
|
49
|
+
export declare const ExtractionListAnswer$inboundSchema: z.ZodType<ExtractionListAnswer, unknown>;
|
|
50
|
+
export declare function extractionListAnswerFromJSON(jsonString: string): SafeParseResult<ExtractionListAnswer, SDKValidationError>;
|
|
51
|
+
//# sourceMappingURL=extractionlistanswer.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 26a830a1b9b0
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import * as openEnums from "../types/enums.js";
|
|
9
|
+
/**
|
|
10
|
+
* Set to `image` when the answer was read from an image rather than the state text.
|
|
11
|
+
*/
|
|
12
|
+
export const ExtractionListAnswerSource = {
|
|
13
|
+
State: "state",
|
|
14
|
+
Image: "image",
|
|
15
|
+
};
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const ExtractionListAnswerGuess$inboundSchema = z.union([z.string(), z.number()]);
|
|
18
|
+
export function extractionListAnswerGuessFromJSON(jsonString) {
|
|
19
|
+
return safeParse(jsonString, (x) => ExtractionListAnswerGuess$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionListAnswerGuess' from JSON`);
|
|
20
|
+
}
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const ExtractionListAnswerSource$inboundSchema = openEnums.inboundSchema(ExtractionListAnswerSource);
|
|
23
|
+
/** @internal */
|
|
24
|
+
export const ExtractionListAnswerValue$inboundSchema = z.union([z.string(), z.number()]);
|
|
25
|
+
export function extractionListAnswerValueFromJSON(jsonString) {
|
|
26
|
+
return safeParse(jsonString, (x) => ExtractionListAnswerValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionListAnswerValue' from JSON`);
|
|
27
|
+
}
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const ExtractionListAnswer$inboundSchema = z.object({
|
|
30
|
+
confidence: z.number().optional(),
|
|
31
|
+
guess: z.array(z.union([z.string(), z.number()])).optional(),
|
|
32
|
+
p_null: z.number().optional(),
|
|
33
|
+
source: ExtractionListAnswerSource$inboundSchema.optional(),
|
|
34
|
+
spans: z.array(z.array(z.int())).optional(),
|
|
35
|
+
spell_confidence: z.number().optional(),
|
|
36
|
+
type: z.literal("list"),
|
|
37
|
+
value: z.nullable(z.array(z.union([z.string(), z.number()]))),
|
|
38
|
+
}).transform((v) => {
|
|
39
|
+
return remap$(v, {
|
|
40
|
+
"p_null": "pNull",
|
|
41
|
+
"spell_confidence": "spellConfidence",
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
export function extractionListAnswerFromJSON(jsonString) {
|
|
45
|
+
return safeParse(jsonString, (x) => ExtractionListAnswer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionListAnswer' from JSON`);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=extractionlistanswer.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
export declare const Items: {
|
|
4
|
+
readonly Text: "text";
|
|
5
|
+
readonly Number: "number";
|
|
6
|
+
readonly Date: "date";
|
|
7
|
+
};
|
|
8
|
+
export type Items = OpenEnum<typeof Items>;
|
|
9
|
+
export type ExtractionListField = {
|
|
10
|
+
/**
|
|
11
|
+
* Decimal places kept in `value`.
|
|
12
|
+
*/
|
|
13
|
+
decimals?: number | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* What the field should contain.
|
|
16
|
+
*/
|
|
17
|
+
instructions?: string | undefined;
|
|
18
|
+
items: Items;
|
|
19
|
+
/**
|
|
20
|
+
* Probability of null above which `value` is null. Default 0.5.
|
|
21
|
+
*/
|
|
22
|
+
nullThreshold?: number | undefined;
|
|
23
|
+
type: "list";
|
|
24
|
+
};
|
|
25
|
+
/** @internal */
|
|
26
|
+
export declare const Items$outboundSchema: z.ZodType<string, Items>;
|
|
27
|
+
/** @internal */
|
|
28
|
+
export type ExtractionListField$Outbound = {
|
|
29
|
+
decimals?: number | undefined;
|
|
30
|
+
instructions?: string | undefined;
|
|
31
|
+
items: string;
|
|
32
|
+
null_threshold?: number | undefined;
|
|
33
|
+
type: "list";
|
|
34
|
+
};
|
|
35
|
+
/** @internal */
|
|
36
|
+
export declare const ExtractionListField$outboundSchema: z.ZodType<ExtractionListField$Outbound, ExtractionListField>;
|
|
37
|
+
export declare function extractionListFieldToJSON(extractionListField: ExtractionListField): string;
|
|
38
|
+
//# sourceMappingURL=extractionlistfield.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: babad368b81e
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import * as openEnums from "../types/enums.js";
|
|
8
|
+
export const Items = {
|
|
9
|
+
Text: "text",
|
|
10
|
+
Number: "number",
|
|
11
|
+
Date: "date",
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const Items$outboundSchema = openEnums
|
|
15
|
+
.outboundSchema(Items);
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const ExtractionListField$outboundSchema = z.object({
|
|
18
|
+
decimals: z.int().optional(),
|
|
19
|
+
instructions: z.string().optional(),
|
|
20
|
+
items: Items$outboundSchema,
|
|
21
|
+
nullThreshold: z.number().optional(),
|
|
22
|
+
type: z.literal("list"),
|
|
23
|
+
}).transform((v) => {
|
|
24
|
+
return remap$(v, {
|
|
25
|
+
nullThreshold: "null_threshold",
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
export function extractionListFieldToJSON(extractionListField) {
|
|
29
|
+
return JSON.stringify(ExtractionListField$outboundSchema.parse(extractionListField));
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=extractionlistfield.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
/**
|
|
6
|
+
* Set to `image` when the answer was read from an image rather than the state text.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ExtractionNumberAnswerSource: {
|
|
9
|
+
readonly State: "state";
|
|
10
|
+
readonly Image: "image";
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Set to `image` when the answer was read from an image rather than the state text.
|
|
14
|
+
*/
|
|
15
|
+
export type ExtractionNumberAnswerSource = OpenEnum<typeof ExtractionNumberAnswerSource>;
|
|
16
|
+
export type ExtractionNumberAnswer = {
|
|
17
|
+
confidence?: number | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The most likely value even when `value` is null because `p_null` crossed the threshold.
|
|
20
|
+
*/
|
|
21
|
+
guess?: number | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Probability that the state contains nothing for this field.
|
|
24
|
+
*/
|
|
25
|
+
pNull?: number | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Set to `image` when the answer was read from an image rather than the state text.
|
|
28
|
+
*/
|
|
29
|
+
source?: ExtractionNumberAnswerSource | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once.
|
|
32
|
+
*/
|
|
33
|
+
span?: Array<number> | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Confidence in the spelling of text read from an image.
|
|
36
|
+
*/
|
|
37
|
+
spellConfidence?: number | undefined;
|
|
38
|
+
type: "number";
|
|
39
|
+
value: number | null;
|
|
40
|
+
};
|
|
41
|
+
/** @internal */
|
|
42
|
+
export declare const ExtractionNumberAnswerSource$inboundSchema: z.ZodType<ExtractionNumberAnswerSource, unknown>;
|
|
43
|
+
/** @internal */
|
|
44
|
+
export declare const ExtractionNumberAnswer$inboundSchema: z.ZodType<ExtractionNumberAnswer, unknown>;
|
|
45
|
+
export declare function extractionNumberAnswerFromJSON(jsonString: string): SafeParseResult<ExtractionNumberAnswer, SDKValidationError>;
|
|
46
|
+
//# sourceMappingURL=extractionnumberanswer.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 39bb8411110e
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import * as openEnums from "../types/enums.js";
|
|
9
|
+
/**
|
|
10
|
+
* Set to `image` when the answer was read from an image rather than the state text.
|
|
11
|
+
*/
|
|
12
|
+
export const ExtractionNumberAnswerSource = {
|
|
13
|
+
State: "state",
|
|
14
|
+
Image: "image",
|
|
15
|
+
};
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const ExtractionNumberAnswerSource$inboundSchema = openEnums.inboundSchema(ExtractionNumberAnswerSource);
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const ExtractionNumberAnswer$inboundSchema = z.object({
|
|
20
|
+
confidence: z.number().optional(),
|
|
21
|
+
guess: z.number().optional(),
|
|
22
|
+
p_null: z.number().optional(),
|
|
23
|
+
source: ExtractionNumberAnswerSource$inboundSchema.optional(),
|
|
24
|
+
span: z.array(z.int()).optional(),
|
|
25
|
+
spell_confidence: z.number().optional(),
|
|
26
|
+
type: z.literal("number"),
|
|
27
|
+
value: z.nullable(z.number()),
|
|
28
|
+
}).transform((v) => {
|
|
29
|
+
return remap$(v, {
|
|
30
|
+
"p_null": "pNull",
|
|
31
|
+
"spell_confidence": "spellConfidence",
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
export function extractionNumberAnswerFromJSON(jsonString) {
|
|
35
|
+
return safeParse(jsonString, (x) => ExtractionNumberAnswer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionNumberAnswer' from JSON`);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=extractionnumberanswer.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
export type ExtractionNumberField = {
|
|
3
|
+
/**
|
|
4
|
+
* Decimal places kept in `value`.
|
|
5
|
+
*/
|
|
6
|
+
decimals?: number | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* What the field should contain.
|
|
9
|
+
*/
|
|
10
|
+
instructions?: string | undefined;
|
|
11
|
+
integer?: boolean | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Probability of null above which `value` is null. Default 0.5.
|
|
14
|
+
*/
|
|
15
|
+
nullThreshold?: number | undefined;
|
|
16
|
+
type: "number";
|
|
17
|
+
unit?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
/** @internal */
|
|
20
|
+
export type ExtractionNumberField$Outbound = {
|
|
21
|
+
decimals?: number | undefined;
|
|
22
|
+
instructions?: string | undefined;
|
|
23
|
+
integer?: boolean | undefined;
|
|
24
|
+
null_threshold?: number | undefined;
|
|
25
|
+
type: "number";
|
|
26
|
+
unit?: string | undefined;
|
|
27
|
+
};
|
|
28
|
+
/** @internal */
|
|
29
|
+
export declare const ExtractionNumberField$outboundSchema: z.ZodType<ExtractionNumberField$Outbound, ExtractionNumberField>;
|
|
30
|
+
export declare function extractionNumberFieldToJSON(extractionNumberField: ExtractionNumberField): string;
|
|
31
|
+
//# sourceMappingURL=extractionnumberfield.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: c4c239c1c3f9
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const ExtractionNumberField$outboundSchema = z.object({
|
|
9
|
+
decimals: z.int().optional(),
|
|
10
|
+
instructions: z.string().optional(),
|
|
11
|
+
integer: z.boolean().optional(),
|
|
12
|
+
nullThreshold: z.number().optional(),
|
|
13
|
+
type: z.literal("number"),
|
|
14
|
+
unit: z.string().optional(),
|
|
15
|
+
}).transform((v) => {
|
|
16
|
+
return remap$(v, {
|
|
17
|
+
nullThreshold: "null_threshold",
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
export function extractionNumberFieldToJSON(extractionNumberField) {
|
|
21
|
+
return JSON.stringify(ExtractionNumberField$outboundSchema.parse(extractionNumberField));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=extractionnumberfield.js.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { DecisionsImageAsset, DecisionsImageAsset$Outbound } from "./decisionsimageasset.js";
|
|
3
|
+
import { ExtractionDateField, ExtractionDateField$Outbound } from "./extractiondatefield.js";
|
|
4
|
+
import { ExtractionDatetimeField, ExtractionDatetimeField$Outbound } from "./extractiondatetimefield.js";
|
|
5
|
+
import { ExtractionDurationField, ExtractionDurationField$Outbound } from "./extractiondurationfield.js";
|
|
6
|
+
import { ExtractionEstimateField, ExtractionEstimateField$Outbound } from "./extractionestimatefield.js";
|
|
7
|
+
import { ExtractionForecastField, ExtractionForecastField$Outbound } from "./extractionforecastfield.js";
|
|
8
|
+
import { ExtractionListField, ExtractionListField$Outbound } from "./extractionlistfield.js";
|
|
9
|
+
import { ExtractionNumberField, ExtractionNumberField$Outbound } from "./extractionnumberfield.js";
|
|
10
|
+
import { ExtractionTextField, ExtractionTextField$Outbound } from "./extractiontextfield.js";
|
|
11
|
+
import { ExtractionTimeField, ExtractionTimeField$Outbound } from "./extractiontimefield.js";
|
|
12
|
+
import { ProviderPreferences, ProviderPreferences$Outbound } from "./providerpreferences.js";
|
|
13
|
+
import { TraceConfig, TraceConfig$Outbound } from "./traceconfig.js";
|
|
14
|
+
/**
|
|
15
|
+
* A typed field to extract, compute, estimate or forecast from the state. Which types a model answers is model-specific; unsupported types are rejected with 400.
|
|
16
|
+
*/
|
|
17
|
+
export type Fields = ExtractionDateField | ExtractionDatetimeField | ExtractionDurationField | ExtractionEstimateField | ExtractionForecastField | ExtractionListField | ExtractionNumberField | ExtractionTextField | ExtractionTimeField;
|
|
18
|
+
export type ExtractionsRequest = {
|
|
19
|
+
/**
|
|
20
|
+
* Images keyed by reference string, as in TypeSafe's API. Write a reference wherever the image belongs in `state`, `instructions`, or `criteria`; every asset must be referenced at least once. Jev reads a reference as a whole string value or inside longer text. Other Decisions models read a whole-string reference wherever they read an `image_url` part and reject a reference inside longer text.
|
|
21
|
+
*/
|
|
22
|
+
assets?: {
|
|
23
|
+
[k: string]: DecisionsImageAsset;
|
|
24
|
+
} | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Map of field name to typed field spec.
|
|
27
|
+
*/
|
|
28
|
+
fields: {
|
|
29
|
+
[k: string]: ExtractionDateField | ExtractionDatetimeField | ExtractionDurationField | ExtractionEstimateField | ExtractionForecastField | ExtractionListField | ExtractionNumberField | ExtractionTextField | ExtractionTimeField;
|
|
30
|
+
};
|
|
31
|
+
model: string;
|
|
32
|
+
provider?: ProviderPreferences | null | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* ISO date that anchors dates written without a year.
|
|
35
|
+
*/
|
|
36
|
+
referenceDate?: string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.
|
|
39
|
+
*/
|
|
40
|
+
sessionId?: string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* The text to read from. May be empty only when the request carries image assets.
|
|
43
|
+
*/
|
|
44
|
+
state: string;
|
|
45
|
+
/**
|
|
46
|
+
* Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
|
|
47
|
+
*/
|
|
48
|
+
trace?: TraceConfig | undefined;
|
|
49
|
+
user?: string | undefined;
|
|
50
|
+
};
|
|
51
|
+
/** @internal */
|
|
52
|
+
export type Fields$Outbound = ExtractionDateField$Outbound | ExtractionDatetimeField$Outbound | ExtractionDurationField$Outbound | ExtractionEstimateField$Outbound | ExtractionForecastField$Outbound | ExtractionListField$Outbound | ExtractionNumberField$Outbound | ExtractionTextField$Outbound | ExtractionTimeField$Outbound;
|
|
53
|
+
/** @internal */
|
|
54
|
+
export declare const Fields$outboundSchema: z.ZodType<Fields$Outbound, Fields>;
|
|
55
|
+
export declare function fieldsToJSON(fields: Fields): string;
|
|
56
|
+
/** @internal */
|
|
57
|
+
export type ExtractionsRequest$Outbound = {
|
|
58
|
+
assets?: {
|
|
59
|
+
[k: string]: DecisionsImageAsset$Outbound;
|
|
60
|
+
} | undefined;
|
|
61
|
+
fields: {
|
|
62
|
+
[k: string]: ExtractionDateField$Outbound | ExtractionDatetimeField$Outbound | ExtractionDurationField$Outbound | ExtractionEstimateField$Outbound | ExtractionForecastField$Outbound | ExtractionListField$Outbound | ExtractionNumberField$Outbound | ExtractionTextField$Outbound | ExtractionTimeField$Outbound;
|
|
63
|
+
};
|
|
64
|
+
model: string;
|
|
65
|
+
provider?: ProviderPreferences$Outbound | null | undefined;
|
|
66
|
+
reference_date?: string | undefined;
|
|
67
|
+
session_id?: string | undefined;
|
|
68
|
+
state: string;
|
|
69
|
+
trace?: TraceConfig$Outbound | undefined;
|
|
70
|
+
user?: string | undefined;
|
|
71
|
+
};
|
|
72
|
+
/** @internal */
|
|
73
|
+
export declare const ExtractionsRequest$outboundSchema: z.ZodType<ExtractionsRequest$Outbound, ExtractionsRequest>;
|
|
74
|
+
export declare function extractionsRequestToJSON(extractionsRequest: ExtractionsRequest): string;
|
|
75
|
+
//# sourceMappingURL=extractionsrequest.d.ts.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 43bff9429754
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { DecisionsImageAsset$outboundSchema, } from "./decisionsimageasset.js";
|
|
8
|
+
import { ExtractionDateField$outboundSchema, } from "./extractiondatefield.js";
|
|
9
|
+
import { ExtractionDatetimeField$outboundSchema, } from "./extractiondatetimefield.js";
|
|
10
|
+
import { ExtractionDurationField$outboundSchema, } from "./extractiondurationfield.js";
|
|
11
|
+
import { ExtractionEstimateField$outboundSchema, } from "./extractionestimatefield.js";
|
|
12
|
+
import { ExtractionForecastField$outboundSchema, } from "./extractionforecastfield.js";
|
|
13
|
+
import { ExtractionListField$outboundSchema, } from "./extractionlistfield.js";
|
|
14
|
+
import { ExtractionNumberField$outboundSchema, } from "./extractionnumberfield.js";
|
|
15
|
+
import { ExtractionTextField$outboundSchema, } from "./extractiontextfield.js";
|
|
16
|
+
import { ExtractionTimeField$outboundSchema, } from "./extractiontimefield.js";
|
|
17
|
+
import { ProviderPreferences$outboundSchema, } from "./providerpreferences.js";
|
|
18
|
+
import { TraceConfig$outboundSchema, } from "./traceconfig.js";
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const Fields$outboundSchema = z
|
|
21
|
+
.union([
|
|
22
|
+
ExtractionDateField$outboundSchema,
|
|
23
|
+
ExtractionDatetimeField$outboundSchema,
|
|
24
|
+
ExtractionDurationField$outboundSchema,
|
|
25
|
+
ExtractionEstimateField$outboundSchema,
|
|
26
|
+
ExtractionForecastField$outboundSchema,
|
|
27
|
+
ExtractionListField$outboundSchema,
|
|
28
|
+
ExtractionNumberField$outboundSchema,
|
|
29
|
+
ExtractionTextField$outboundSchema,
|
|
30
|
+
ExtractionTimeField$outboundSchema,
|
|
31
|
+
]);
|
|
32
|
+
export function fieldsToJSON(fields) {
|
|
33
|
+
return JSON.stringify(Fields$outboundSchema.parse(fields));
|
|
34
|
+
}
|
|
35
|
+
/** @internal */
|
|
36
|
+
export const ExtractionsRequest$outboundSchema = z.object({
|
|
37
|
+
assets: z.record(z.string(), DecisionsImageAsset$outboundSchema).optional(),
|
|
38
|
+
fields: z.record(z.string(), z.union([
|
|
39
|
+
ExtractionDateField$outboundSchema,
|
|
40
|
+
ExtractionDatetimeField$outboundSchema,
|
|
41
|
+
ExtractionDurationField$outboundSchema,
|
|
42
|
+
ExtractionEstimateField$outboundSchema,
|
|
43
|
+
ExtractionForecastField$outboundSchema,
|
|
44
|
+
ExtractionListField$outboundSchema,
|
|
45
|
+
ExtractionNumberField$outboundSchema,
|
|
46
|
+
ExtractionTextField$outboundSchema,
|
|
47
|
+
ExtractionTimeField$outboundSchema,
|
|
48
|
+
])),
|
|
49
|
+
model: z.string(),
|
|
50
|
+
provider: z.nullable(ProviderPreferences$outboundSchema).optional(),
|
|
51
|
+
referenceDate: z.string().optional(),
|
|
52
|
+
sessionId: z.string().optional(),
|
|
53
|
+
state: z.string(),
|
|
54
|
+
trace: TraceConfig$outboundSchema.optional(),
|
|
55
|
+
user: z.string().optional(),
|
|
56
|
+
}).transform((v) => {
|
|
57
|
+
return remap$(v, {
|
|
58
|
+
referenceDate: "reference_date",
|
|
59
|
+
sessionId: "session_id",
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
export function extractionsRequestToJSON(extractionsRequest) {
|
|
63
|
+
return JSON.stringify(ExtractionsRequest$outboundSchema.parse(extractionsRequest));
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=extractionsrequest.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import * as discriminatedUnionTypes from "../types/discriminatedUnion.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
import { ExtractionDateAnswer } from "./extractiondateanswer.js";
|
|
6
|
+
import { ExtractionDatetimeAnswer } from "./extractiondatetimeanswer.js";
|
|
7
|
+
import { ExtractionDurationAnswer } from "./extractiondurationanswer.js";
|
|
8
|
+
import { ExtractionEstimateAnswer } from "./extractionestimateanswer.js";
|
|
9
|
+
import { ExtractionForecastAnswer } from "./extractionforecastanswer.js";
|
|
10
|
+
import { ExtractionListAnswer } from "./extractionlistanswer.js";
|
|
11
|
+
import { ExtractionNumberAnswer } from "./extractionnumberanswer.js";
|
|
12
|
+
import { ExtractionsUsage } from "./extractionsusage.js";
|
|
13
|
+
import { ExtractionTextAnswer } from "./extractiontextanswer.js";
|
|
14
|
+
import { ExtractionTimeAnswer } from "./extractiontimeanswer.js";
|
|
15
|
+
/**
|
|
16
|
+
* One answer per requested field. `value` is null when the state does not determine it.
|
|
17
|
+
*/
|
|
18
|
+
export type ExtractionsResponseAnswers = ExtractionDateAnswer | ExtractionDatetimeAnswer | ExtractionDurationAnswer | ExtractionEstimateAnswer | ExtractionForecastAnswer | ExtractionListAnswer | ExtractionNumberAnswer | ExtractionTextAnswer | ExtractionTimeAnswer | discriminatedUnionTypes.Unknown<"type">;
|
|
19
|
+
export type ExtractionsResponse = {
|
|
20
|
+
answers: {
|
|
21
|
+
[k: string]: ExtractionDateAnswer | ExtractionDatetimeAnswer | ExtractionDurationAnswer | ExtractionEstimateAnswer | ExtractionForecastAnswer | ExtractionListAnswer | ExtractionNumberAnswer | ExtractionTextAnswer | ExtractionTimeAnswer | discriminatedUnionTypes.Unknown<"type">;
|
|
22
|
+
};
|
|
23
|
+
id?: string | undefined;
|
|
24
|
+
model: string;
|
|
25
|
+
provider?: string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The text that spans index into, when requested through provider options.
|
|
28
|
+
*/
|
|
29
|
+
stateText?: string | null | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* True when the provider read only a prefix of the state.
|
|
32
|
+
*/
|
|
33
|
+
truncated?: boolean | undefined;
|
|
34
|
+
usage: ExtractionsUsage;
|
|
35
|
+
};
|
|
36
|
+
/** @internal */
|
|
37
|
+
export declare const ExtractionsResponseAnswers$inboundSchema: z.ZodType<ExtractionsResponseAnswers, unknown>;
|
|
38
|
+
export declare function extractionsResponseAnswersFromJSON(jsonString: string): SafeParseResult<ExtractionsResponseAnswers, SDKValidationError>;
|
|
39
|
+
/** @internal */
|
|
40
|
+
export declare const ExtractionsResponse$inboundSchema: z.ZodType<ExtractionsResponse, unknown>;
|
|
41
|
+
export declare function extractionsResponseFromJSON(jsonString: string): SafeParseResult<ExtractionsResponse, SDKValidationError>;
|
|
42
|
+
//# sourceMappingURL=extractionsresponse.d.ts.map
|