@openrouter/sdk 1.5.24 → 1.5.26
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/imagegenerationproviderpreferences.d.ts +1 -1
- 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/models/provideroptions.d.ts +1 -1
- package/esm/models/providerpreferences.d.ts +1 -1
- package/esm/models/speechrequest.d.ts +1 -1
- package/esm/models/sttrequest.d.ts +1 -1
- package/esm/models/videogenerationrequest.d.ts +1 -1
- 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 +9 -9
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as models from "../models/index.js";
|
|
9
|
+
import * as operations from "../models/operations/index.js";
|
|
10
|
+
import { APIPromise } from "../types/async.js";
|
|
11
|
+
import { Result } from "../types/fp.js";
|
|
12
|
+
/**
|
|
13
|
+
* Submit an Extractions request
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Extracts, computes, estimates or forecasts typed fields from a state string and image assets using an extraction-style System One model. Alpha: the shape is not stable.
|
|
17
|
+
*/
|
|
18
|
+
export declare function alphaExtractionsCreate(client: OpenRouterCore, request: operations.CreateApiAlphaExtractionsRequest, options?: RequestOptions): APIPromise<Result<models.ExtractionsResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.PayloadTooLargeResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=alphaExtractionsCreate.d.ts.map
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 317c66b4f586
|
|
4
|
+
*/
|
|
5
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import { BadGatewayResponseError$inboundSchema as errors_BadGatewayResponseError$inboundSchema } from "../models/errors/badgatewayresponseerror.js"; import { BadRequestResponseError$inboundSchema as errors_BadRequestResponseError$inboundSchema } from "../models/errors/badrequestresponseerror.js"; import { EdgeNetworkTimeoutResponseError$inboundSchema as errors_EdgeNetworkTimeoutResponseError$inboundSchema } from "../models/errors/edgenetworktimeoutresponseerror.js"; import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { PayloadTooLargeResponseError$inboundSchema as errors_PayloadTooLargeResponseError$inboundSchema } from "../models/errors/payloadtoolargeresponseerror.js"; import { PaymentRequiredResponseError$inboundSchema as errors_PaymentRequiredResponseError$inboundSchema } from "../models/errors/paymentrequiredresponseerror.js"; import { ProviderOverloadedResponseError$inboundSchema as errors_ProviderOverloadedResponseError$inboundSchema } from "../models/errors/provideroverloadedresponseerror.js"; import { ServiceUnavailableResponseError$inboundSchema as errors_ServiceUnavailableResponseError$inboundSchema } from "../models/errors/serviceunavailableresponseerror.js"; import { TooManyRequestsResponseError$inboundSchema as errors_TooManyRequestsResponseError$inboundSchema } from "../models/errors/toomanyrequestsresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js";
|
|
13
|
+
import { ExtractionsResponse$inboundSchema as models_ExtractionsResponse$inboundSchema } from "../models/extractionsresponse.js";
|
|
14
|
+
import { CreateApiAlphaExtractionsServerList } from "../models/operations/createapialphaextractions.js";
|
|
15
|
+
import { CreateApiAlphaExtractionsRequest$outboundSchema as operations_CreateApiAlphaExtractionsRequest$outboundSchema } from "../models/operations/createapialphaextractions.js";
|
|
16
|
+
import { APIPromise } from "../types/async.js";
|
|
17
|
+
/**
|
|
18
|
+
* Submit an Extractions request
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Extracts, computes, estimates or forecasts typed fields from a state string and image assets using an extraction-style System One model. Alpha: the shape is not stable.
|
|
22
|
+
*/
|
|
23
|
+
export function alphaExtractionsCreate(client, request, options) {
|
|
24
|
+
return new APIPromise($do(client, request, options));
|
|
25
|
+
}
|
|
26
|
+
async function $do(client, request, options) {
|
|
27
|
+
const parsed = safeParse(request, (value) => operations_CreateApiAlphaExtractionsRequest$outboundSchema.parse(value), "Input validation failed");
|
|
28
|
+
if (!parsed.ok) {
|
|
29
|
+
return [parsed, { status: "invalid" }];
|
|
30
|
+
}
|
|
31
|
+
const payload = parsed.value;
|
|
32
|
+
const body = encodeJSON("body", payload.ExtractionsRequest, {
|
|
33
|
+
explode: true,
|
|
34
|
+
});
|
|
35
|
+
const baseURL = options?.serverURL
|
|
36
|
+
|| pathToFunc(CreateApiAlphaExtractionsServerList[0], {
|
|
37
|
+
charEncoding: "percent",
|
|
38
|
+
})();
|
|
39
|
+
const path = pathToFunc("/api/alpha/extractions")();
|
|
40
|
+
const headers = new Headers(compactMap({
|
|
41
|
+
"Content-Type": "application/json",
|
|
42
|
+
Accept: "application/json",
|
|
43
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
44
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
45
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
46
|
+
}));
|
|
47
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
48
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
49
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
50
|
+
const context = {
|
|
51
|
+
options: client._options,
|
|
52
|
+
baseURL: baseURL ?? "",
|
|
53
|
+
operationID: "createApiAlphaExtractions",
|
|
54
|
+
oAuth2Scopes: null,
|
|
55
|
+
resolvedSecurity: requestSecurity,
|
|
56
|
+
securitySource: client._options.apiKey,
|
|
57
|
+
retryConfig: options?.retries
|
|
58
|
+
|| client._options.retryConfig
|
|
59
|
+
|| {
|
|
60
|
+
strategy: "backoff",
|
|
61
|
+
backoff: {
|
|
62
|
+
initialInterval: 500,
|
|
63
|
+
maxInterval: 60000,
|
|
64
|
+
exponent: 1.5,
|
|
65
|
+
maxElapsedTime: 3600000,
|
|
66
|
+
},
|
|
67
|
+
retryConnectionErrors: true,
|
|
68
|
+
}
|
|
69
|
+
|| { strategy: "none" },
|
|
70
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
71
|
+
};
|
|
72
|
+
const requestRes = client._createRequest(context, {
|
|
73
|
+
security: requestSecurity,
|
|
74
|
+
method: "POST",
|
|
75
|
+
baseURL: baseURL,
|
|
76
|
+
path: path,
|
|
77
|
+
headers: headers,
|
|
78
|
+
body: body,
|
|
79
|
+
userAgent: client._options.userAgent,
|
|
80
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
81
|
+
}, options);
|
|
82
|
+
if (!requestRes.ok) {
|
|
83
|
+
return [requestRes, { status: "invalid" }];
|
|
84
|
+
}
|
|
85
|
+
const req = requestRes.value;
|
|
86
|
+
const doResult = await client._do(req, {
|
|
87
|
+
context,
|
|
88
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
89
|
+
retryConfig: context.retryConfig,
|
|
90
|
+
retryCodes: context.retryCodes,
|
|
91
|
+
});
|
|
92
|
+
if (!doResult.ok) {
|
|
93
|
+
return [doResult, { status: "request-error", request: req }];
|
|
94
|
+
}
|
|
95
|
+
const response = doResult.value;
|
|
96
|
+
const responseFields = {
|
|
97
|
+
HttpMeta: { Response: response, Request: req },
|
|
98
|
+
};
|
|
99
|
+
const [result] = await M.match(M.json(200, models_ExtractionsResponse$inboundSchema), M.jsonErr(400, errors_BadRequestResponseError$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors_PaymentRequiredResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(413, errors_PayloadTooLargeResponseError$inboundSchema), M.jsonErr(429, errors_TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.jsonErr(502, errors_BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors_ServiceUnavailableResponseError$inboundSchema), M.jsonErr(524, errors_EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors_ProviderOverloadedResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
100
|
+
if (!result.ok) {
|
|
101
|
+
return [result, { status: "complete", request: req, response }];
|
|
102
|
+
}
|
|
103
|
+
return [result, { status: "complete", request: req, response }];
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=alphaExtractionsCreate.js.map
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -50,8 +50,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
50
50
|
export declare const SDK_METADATA: {
|
|
51
51
|
readonly language: "typescript";
|
|
52
52
|
readonly openapiDocVersion: "1.0.0";
|
|
53
|
-
readonly sdkVersion: "1.5.
|
|
53
|
+
readonly sdkVersion: "1.5.26";
|
|
54
54
|
readonly genVersion: "2.950.13";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.5.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.5.26 2.950.13 1.0.0 @openrouter/sdk";
|
|
56
56
|
};
|
|
57
57
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -29,8 +29,8 @@ export function serverURLFromOptions(options) {
|
|
|
29
29
|
export const SDK_METADATA = {
|
|
30
30
|
language: "typescript",
|
|
31
31
|
openapiDocVersion: "1.0.0",
|
|
32
|
-
sdkVersion: "1.5.
|
|
32
|
+
sdkVersion: "1.5.26",
|
|
33
33
|
genVersion: "2.950.13",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.5.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.5.26 2.950.13 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
|
@@ -9,7 +9,7 @@ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
|
9
9
|
/**
|
|
10
10
|
* A Decisions answer using a boolean, choice, score, or image bounding-box evaluation.
|
|
11
11
|
*/
|
|
12
|
-
export type
|
|
12
|
+
export type DecisionsResponseAnswers = DecisionsBoxAnswer | DecisionsChoiceAnswer | DecisionsNoulAnswer | DecisionsScoreAnswer | discriminatedUnionTypes.Unknown<"type">;
|
|
13
13
|
export type DecisionsResponseUsage = {
|
|
14
14
|
cost?: number | undefined;
|
|
15
15
|
inputTokens: number;
|
|
@@ -25,8 +25,8 @@ export type DecisionsResponse = {
|
|
|
25
25
|
usage: DecisionsResponseUsage;
|
|
26
26
|
};
|
|
27
27
|
/** @internal */
|
|
28
|
-
export declare const
|
|
29
|
-
export declare function
|
|
28
|
+
export declare const DecisionsResponseAnswers$inboundSchema: z.ZodType<DecisionsResponseAnswers, unknown>;
|
|
29
|
+
export declare function decisionsResponseAnswersFromJSON(jsonString: string): SafeParseResult<DecisionsResponseAnswers, SDKValidationError>;
|
|
30
30
|
/** @internal */
|
|
31
31
|
export declare const DecisionsResponseUsage$inboundSchema: z.ZodType<DecisionsResponseUsage, unknown>;
|
|
32
32
|
export declare function decisionsResponseUsageFromJSON(jsonString: string): SafeParseResult<DecisionsResponseUsage, SDKValidationError>;
|
|
@@ -11,14 +11,14 @@ import { DecisionsChoiceAnswer$inboundSchema, } from "./decisionschoiceanswer.js
|
|
|
11
11
|
import { DecisionsNoulAnswer$inboundSchema, } from "./decisionsnoulanswer.js";
|
|
12
12
|
import { DecisionsScoreAnswer$inboundSchema, } from "./decisionsscoreanswer.js";
|
|
13
13
|
/** @internal */
|
|
14
|
-
export const
|
|
14
|
+
export const DecisionsResponseAnswers$inboundSchema = discriminatedUnion("type", {
|
|
15
15
|
box: DecisionsBoxAnswer$inboundSchema,
|
|
16
16
|
choice: DecisionsChoiceAnswer$inboundSchema,
|
|
17
17
|
noul: DecisionsNoulAnswer$inboundSchema,
|
|
18
18
|
score: DecisionsScoreAnswer$inboundSchema,
|
|
19
19
|
});
|
|
20
|
-
export function
|
|
21
|
-
return safeParse(jsonString, (x) =>
|
|
20
|
+
export function decisionsResponseAnswersFromJSON(jsonString) {
|
|
21
|
+
return safeParse(jsonString, (x) => DecisionsResponseAnswers$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DecisionsResponseAnswers' from JSON`);
|
|
22
22
|
}
|
|
23
23
|
/** @internal */
|
|
24
24
|
export const DecisionsResponseUsage$inboundSchema = z.object({
|
|
@@ -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 ExtractionDateAnswerSource: {
|
|
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 ExtractionDateAnswerSource = OpenEnum<typeof ExtractionDateAnswerSource>;
|
|
16
|
+
export type ExtractionDateAnswer = {
|
|
17
|
+
confidence?: number | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The most likely value even when `value` is null because `p_null` crossed the threshold.
|
|
20
|
+
*/
|
|
21
|
+
guess?: string | 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?: ExtractionDateAnswerSource | 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: "date";
|
|
39
|
+
value: string | null;
|
|
40
|
+
};
|
|
41
|
+
/** @internal */
|
|
42
|
+
export declare const ExtractionDateAnswerSource$inboundSchema: z.ZodType<ExtractionDateAnswerSource, unknown>;
|
|
43
|
+
/** @internal */
|
|
44
|
+
export declare const ExtractionDateAnswer$inboundSchema: z.ZodType<ExtractionDateAnswer, unknown>;
|
|
45
|
+
export declare function extractionDateAnswerFromJSON(jsonString: string): SafeParseResult<ExtractionDateAnswer, SDKValidationError>;
|
|
46
|
+
//# sourceMappingURL=extractiondateanswer.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: f956b3a98040
|
|
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 ExtractionDateAnswerSource = {
|
|
13
|
+
State: "state",
|
|
14
|
+
Image: "image",
|
|
15
|
+
};
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const ExtractionDateAnswerSource$inboundSchema = openEnums.inboundSchema(ExtractionDateAnswerSource);
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const ExtractionDateAnswer$inboundSchema = z.object({
|
|
20
|
+
confidence: z.number().optional(),
|
|
21
|
+
guess: z.string().optional(),
|
|
22
|
+
p_null: z.number().optional(),
|
|
23
|
+
source: ExtractionDateAnswerSource$inboundSchema.optional(),
|
|
24
|
+
span: z.array(z.int()).optional(),
|
|
25
|
+
spell_confidence: z.number().optional(),
|
|
26
|
+
type: z.literal("date"),
|
|
27
|
+
value: z.nullable(z.string()),
|
|
28
|
+
}).transform((v) => {
|
|
29
|
+
return remap$(v, {
|
|
30
|
+
"p_null": "pNull",
|
|
31
|
+
"spell_confidence": "spellConfidence",
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
export function extractionDateAnswerFromJSON(jsonString) {
|
|
35
|
+
return safeParse(jsonString, (x) => ExtractionDateAnswer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionDateAnswer' from JSON`);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=extractiondateanswer.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
export type ExtractionDateField = {
|
|
3
|
+
/**
|
|
4
|
+
* What the field should contain.
|
|
5
|
+
*/
|
|
6
|
+
instructions?: string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Probability of null above which `value` is null. Default 0.5.
|
|
9
|
+
*/
|
|
10
|
+
nullThreshold?: number | undefined;
|
|
11
|
+
type: "date";
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export type ExtractionDateField$Outbound = {
|
|
15
|
+
instructions?: string | undefined;
|
|
16
|
+
null_threshold?: number | undefined;
|
|
17
|
+
type: "date";
|
|
18
|
+
};
|
|
19
|
+
/** @internal */
|
|
20
|
+
export declare const ExtractionDateField$outboundSchema: z.ZodType<ExtractionDateField$Outbound, ExtractionDateField>;
|
|
21
|
+
export declare function extractionDateFieldToJSON(extractionDateField: ExtractionDateField): string;
|
|
22
|
+
//# sourceMappingURL=extractiondatefield.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 1c94ff9c9db3
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const ExtractionDateField$outboundSchema = z.object({
|
|
9
|
+
instructions: z.string().optional(),
|
|
10
|
+
nullThreshold: z.number().optional(),
|
|
11
|
+
type: z.literal("date"),
|
|
12
|
+
}).transform((v) => {
|
|
13
|
+
return remap$(v, {
|
|
14
|
+
nullThreshold: "null_threshold",
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
export function extractionDateFieldToJSON(extractionDateField) {
|
|
18
|
+
return JSON.stringify(ExtractionDateField$outboundSchema.parse(extractionDateField));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=extractiondatefield.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 ExtractionDatetimeAnswerSource: {
|
|
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 ExtractionDatetimeAnswerSource = OpenEnum<typeof ExtractionDatetimeAnswerSource>;
|
|
16
|
+
export type ExtractionDatetimeAnswer = {
|
|
17
|
+
confidence?: number | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The most likely value even when `value` is null because `p_null` crossed the threshold.
|
|
20
|
+
*/
|
|
21
|
+
guess?: string | 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?: ExtractionDatetimeAnswerSource | 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: "datetime";
|
|
39
|
+
value: string | null;
|
|
40
|
+
};
|
|
41
|
+
/** @internal */
|
|
42
|
+
export declare const ExtractionDatetimeAnswerSource$inboundSchema: z.ZodType<ExtractionDatetimeAnswerSource, unknown>;
|
|
43
|
+
/** @internal */
|
|
44
|
+
export declare const ExtractionDatetimeAnswer$inboundSchema: z.ZodType<ExtractionDatetimeAnswer, unknown>;
|
|
45
|
+
export declare function extractionDatetimeAnswerFromJSON(jsonString: string): SafeParseResult<ExtractionDatetimeAnswer, SDKValidationError>;
|
|
46
|
+
//# sourceMappingURL=extractiondatetimeanswer.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 78957c3e6418
|
|
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 ExtractionDatetimeAnswerSource = {
|
|
13
|
+
State: "state",
|
|
14
|
+
Image: "image",
|
|
15
|
+
};
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const ExtractionDatetimeAnswerSource$inboundSchema = openEnums.inboundSchema(ExtractionDatetimeAnswerSource);
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const ExtractionDatetimeAnswer$inboundSchema = z.object({
|
|
20
|
+
confidence: z.number().optional(),
|
|
21
|
+
guess: z.string().optional(),
|
|
22
|
+
p_null: z.number().optional(),
|
|
23
|
+
source: ExtractionDatetimeAnswerSource$inboundSchema.optional(),
|
|
24
|
+
span: z.array(z.int()).optional(),
|
|
25
|
+
spell_confidence: z.number().optional(),
|
|
26
|
+
type: z.literal("datetime"),
|
|
27
|
+
value: z.nullable(z.string()),
|
|
28
|
+
}).transform((v) => {
|
|
29
|
+
return remap$(v, {
|
|
30
|
+
"p_null": "pNull",
|
|
31
|
+
"spell_confidence": "spellConfidence",
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
export function extractionDatetimeAnswerFromJSON(jsonString) {
|
|
35
|
+
return safeParse(jsonString, (x) => ExtractionDatetimeAnswer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionDatetimeAnswer' from JSON`);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=extractiondatetimeanswer.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
export type ExtractionDatetimeField = {
|
|
3
|
+
/**
|
|
4
|
+
* What the field should contain.
|
|
5
|
+
*/
|
|
6
|
+
instructions?: string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Probability of null above which `value` is null. Default 0.5.
|
|
9
|
+
*/
|
|
10
|
+
nullThreshold?: number | undefined;
|
|
11
|
+
type: "datetime";
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export type ExtractionDatetimeField$Outbound = {
|
|
15
|
+
instructions?: string | undefined;
|
|
16
|
+
null_threshold?: number | undefined;
|
|
17
|
+
type: "datetime";
|
|
18
|
+
};
|
|
19
|
+
/** @internal */
|
|
20
|
+
export declare const ExtractionDatetimeField$outboundSchema: z.ZodType<ExtractionDatetimeField$Outbound, ExtractionDatetimeField>;
|
|
21
|
+
export declare function extractionDatetimeFieldToJSON(extractionDatetimeField: ExtractionDatetimeField): string;
|
|
22
|
+
//# sourceMappingURL=extractiondatetimefield.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 432acb0eac7e
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const ExtractionDatetimeField$outboundSchema = z.object({
|
|
9
|
+
instructions: z.string().optional(),
|
|
10
|
+
nullThreshold: z.number().optional(),
|
|
11
|
+
type: z.literal("datetime"),
|
|
12
|
+
}).transform((v) => {
|
|
13
|
+
return remap$(v, {
|
|
14
|
+
nullThreshold: "null_threshold",
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
export function extractionDatetimeFieldToJSON(extractionDatetimeField) {
|
|
18
|
+
return JSON.stringify(ExtractionDatetimeField$outboundSchema.parse(extractionDatetimeField));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=extractiondatetimefield.js.map
|
|
@@ -0,0 +1,50 @@
|
|
|
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 ExtractionDurationAnswerSource: {
|
|
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 ExtractionDurationAnswerSource = OpenEnum<typeof ExtractionDurationAnswerSource>;
|
|
16
|
+
export type ExtractionDurationAnswer = {
|
|
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?: ExtractionDurationAnswerSource | 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: "duration";
|
|
39
|
+
/**
|
|
40
|
+
* The unit `value` is expressed in.
|
|
41
|
+
*/
|
|
42
|
+
unit?: string | undefined;
|
|
43
|
+
value: number | null;
|
|
44
|
+
};
|
|
45
|
+
/** @internal */
|
|
46
|
+
export declare const ExtractionDurationAnswerSource$inboundSchema: z.ZodType<ExtractionDurationAnswerSource, unknown>;
|
|
47
|
+
/** @internal */
|
|
48
|
+
export declare const ExtractionDurationAnswer$inboundSchema: z.ZodType<ExtractionDurationAnswer, unknown>;
|
|
49
|
+
export declare function extractionDurationAnswerFromJSON(jsonString: string): SafeParseResult<ExtractionDurationAnswer, SDKValidationError>;
|
|
50
|
+
//# sourceMappingURL=extractiondurationanswer.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 807f782479d4
|
|
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 ExtractionDurationAnswerSource = {
|
|
13
|
+
State: "state",
|
|
14
|
+
Image: "image",
|
|
15
|
+
};
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const ExtractionDurationAnswerSource$inboundSchema = openEnums.inboundSchema(ExtractionDurationAnswerSource);
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const ExtractionDurationAnswer$inboundSchema = z.object({
|
|
20
|
+
confidence: z.number().optional(),
|
|
21
|
+
guess: z.number().optional(),
|
|
22
|
+
p_null: z.number().optional(),
|
|
23
|
+
source: ExtractionDurationAnswerSource$inboundSchema.optional(),
|
|
24
|
+
span: z.array(z.int()).optional(),
|
|
25
|
+
spell_confidence: z.number().optional(),
|
|
26
|
+
type: z.literal("duration"),
|
|
27
|
+
unit: z.string().optional(),
|
|
28
|
+
value: z.nullable(z.number()),
|
|
29
|
+
}).transform((v) => {
|
|
30
|
+
return remap$(v, {
|
|
31
|
+
"p_null": "pNull",
|
|
32
|
+
"spell_confidence": "spellConfidence",
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
export function extractionDurationAnswerFromJSON(jsonString) {
|
|
36
|
+
return safeParse(jsonString, (x) => ExtractionDurationAnswer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtractionDurationAnswer' from JSON`);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=extractiondurationanswer.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
export type ExtractionDurationField = {
|
|
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: "duration";
|
|
17
|
+
/**
|
|
18
|
+
* seconds, minutes, hours, days, weeks, months or years.
|
|
19
|
+
*/
|
|
20
|
+
unit?: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
/** @internal */
|
|
23
|
+
export type ExtractionDurationField$Outbound = {
|
|
24
|
+
decimals?: number | undefined;
|
|
25
|
+
instructions?: string | undefined;
|
|
26
|
+
integer?: boolean | undefined;
|
|
27
|
+
null_threshold?: number | undefined;
|
|
28
|
+
type: "duration";
|
|
29
|
+
unit?: string | undefined;
|
|
30
|
+
};
|
|
31
|
+
/** @internal */
|
|
32
|
+
export declare const ExtractionDurationField$outboundSchema: z.ZodType<ExtractionDurationField$Outbound, ExtractionDurationField>;
|
|
33
|
+
export declare function extractionDurationFieldToJSON(extractionDurationField: ExtractionDurationField): string;
|
|
34
|
+
//# sourceMappingURL=extractiondurationfield.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 235530926c12
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const ExtractionDurationField$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("duration"),
|
|
14
|
+
unit: z.string().optional(),
|
|
15
|
+
}).transform((v) => {
|
|
16
|
+
return remap$(v, {
|
|
17
|
+
nullThreshold: "null_threshold",
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
export function extractionDurationFieldToJSON(extractionDurationField) {
|
|
21
|
+
return JSON.stringify(ExtractionDurationField$outboundSchema.parse(extractionDurationField));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=extractiondurationfield.js.map
|