@orq-ai/node 4.16.0-rc.2 → 4.16.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -35
- package/funcs/routerClassifyCreate.d.ts +18 -0
- package/funcs/routerClassifyCreate.d.ts.map +1 -0
- package/funcs/routerClassifyCreate.js +119 -0
- package/funcs/routerClassifyCreate.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +2 -2
- package/lib/config.js +2 -2
- package/models/components/classifyanswer.d.ts +56 -0
- package/models/components/classifyanswer.d.ts.map +1 -0
- package/models/components/classifyanswer.js +66 -0
- package/models/components/classifyanswer.js.map +1 -0
- package/models/components/classifyretryconfig.d.ts +20 -0
- package/models/components/classifyretryconfig.d.ts.map +1 -0
- package/models/components/classifyretryconfig.js +55 -0
- package/models/components/classifyretryconfig.js.map +1 -0
- package/models/components/classifyusage.d.ts +29 -0
- package/models/components/classifyusage.d.ts.map +1 -0
- package/models/components/classifyusage.js +63 -0
- package/models/components/classifyusage.js.map +1 -0
- package/models/components/index.d.ts +3 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +3 -0
- package/models/components/index.js.map +1 -1
- package/models/components/modelmetadata.d.ts +2 -0
- package/models/components/modelmetadata.d.ts.map +1 -1
- package/models/components/modelmetadata.js +4 -0
- package/models/components/modelmetadata.js.map +1 -1
- package/models/components/reasoningpart.js +1 -1
- package/models/errors/createclassify.d.ts +67 -0
- package/models/errors/createclassify.d.ts.map +1 -0
- package/models/errors/createclassify.js +127 -0
- package/models/errors/createclassify.js.map +1 -0
- package/models/errors/index.d.ts +1 -0
- package/models/errors/index.d.ts.map +1 -1
- package/models/errors/index.js +1 -0
- package/models/errors/index.js.map +1 -1
- package/models/operations/createclassify.d.ts +231 -0
- package/models/operations/createclassify.d.ts.map +1 -0
- package/models/operations/createclassify.js +144 -0
- package/models/operations/createclassify.js.map +1 -0
- package/models/operations/createdataset.js +1 -1
- package/models/operations/createdatasetitem.js +5 -5
- package/models/operations/createprompt.d.ts +2 -0
- package/models/operations/createprompt.d.ts.map +1 -1
- package/models/operations/createprompt.js +2 -0
- package/models/operations/createprompt.js.map +1 -1
- package/models/operations/createtool.js +4 -4
- package/models/operations/deploymentgetconfig.d.ts +1 -0
- package/models/operations/deploymentgetconfig.d.ts.map +1 -1
- package/models/operations/deploymentgetconfig.js +1 -0
- package/models/operations/deploymentgetconfig.js.map +1 -1
- package/models/operations/deploymentinvoke.d.ts +1 -0
- package/models/operations/deploymentinvoke.d.ts.map +1 -1
- package/models/operations/deploymentinvoke.js +1 -0
- package/models/operations/deploymentinvoke.js.map +1 -1
- package/models/operations/deployments.d.ts +2 -0
- package/models/operations/deployments.d.ts.map +1 -1
- package/models/operations/deployments.js +2 -0
- package/models/operations/deployments.js.map +1 -1
- package/models/operations/deploymentstream.d.ts +1 -0
- package/models/operations/deploymentstream.d.ts.map +1 -1
- package/models/operations/deploymentstream.js +1 -0
- package/models/operations/deploymentstream.js.map +1 -1
- package/models/operations/getallprompts.d.ts +2 -0
- package/models/operations/getallprompts.d.ts.map +1 -1
- package/models/operations/getallprompts.js +2 -0
- package/models/operations/getallprompts.js.map +1 -1
- package/models/operations/getalltools.js +4 -4
- package/models/operations/getoneprompt.d.ts +2 -0
- package/models/operations/getoneprompt.d.ts.map +1 -1
- package/models/operations/getoneprompt.js +2 -0
- package/models/operations/getoneprompt.js.map +1 -1
- package/models/operations/getpromptversion.d.ts +2 -0
- package/models/operations/getpromptversion.d.ts.map +1 -1
- package/models/operations/getpromptversion.js +2 -0
- package/models/operations/getpromptversion.js.map +1 -1
- package/models/operations/getv2humanevalsets.js +2 -2
- package/models/operations/getv2humanevalsetsid.js +2 -2
- package/models/operations/index.d.ts +1 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +1 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/listdatasetdatapoints.js +5 -5
- package/models/operations/listdatasets.js +1 -1
- package/models/operations/listpromptversions.d.ts +2 -0
- package/models/operations/listpromptversions.d.ts.map +1 -1
- package/models/operations/listpromptversions.js +2 -0
- package/models/operations/listpromptversions.js.map +1 -1
- package/models/operations/patchv2humanevalsetsid.js +2 -2
- package/models/operations/postv2feedbackevaluation.js +4 -4
- package/models/operations/postv2humanevalsets.js +2 -2
- package/models/operations/retrievedatapoint.js +5 -5
- package/models/operations/retrievedataset.js +1 -1
- package/models/operations/retrievetool.js +4 -4
- package/models/operations/runagent.js +1 -1
- package/models/operations/streamrunagent.js +1 -1
- package/models/operations/updatedatapoint.js +5 -5
- package/models/operations/updatedataset.js +1 -1
- package/models/operations/updateprompt.d.ts +2 -0
- package/models/operations/updateprompt.d.ts.map +1 -1
- package/models/operations/updateprompt.js +2 -0
- package/models/operations/updateprompt.js.map +1 -1
- package/models/operations/updatetool.js +4 -4
- package/package.json +1 -1
- package/sdk/classify.d.ts +12 -0
- package/sdk/classify.d.ts.map +1 -0
- package/sdk/classify.js +22 -0
- package/sdk/classify.js.map +1 -0
- package/sdk/router.d.ts +3 -0
- package/sdk/router.d.ts.map +1 -1
- package/sdk/router.js +4 -0
- package/sdk/router.js.map +1 -1
- package/src/funcs/routerClassifyCreate.ts +185 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/classifyanswer.ts +83 -0
- package/src/models/components/classifyretryconfig.ts +45 -0
- package/src/models/components/classifyusage.ts +63 -0
- package/src/models/components/index.ts +3 -0
- package/src/models/components/modelmetadata.ts +6 -0
- package/src/models/components/reasoningpart.ts +1 -1
- package/src/models/errors/createclassify.ts +155 -0
- package/src/models/errors/index.ts +1 -0
- package/src/models/operations/createclassify.ts +371 -0
- package/src/models/operations/createdataset.ts +1 -1
- package/src/models/operations/createdatasetitem.ts +5 -5
- package/src/models/operations/createprompt.ts +2 -0
- package/src/models/operations/createtool.ts +4 -4
- package/src/models/operations/deploymentgetconfig.ts +1 -0
- package/src/models/operations/deploymentinvoke.ts +1 -0
- package/src/models/operations/deployments.ts +2 -0
- package/src/models/operations/deploymentstream.ts +1 -0
- package/src/models/operations/getallprompts.ts +2 -0
- package/src/models/operations/getalltools.ts +4 -4
- package/src/models/operations/getoneprompt.ts +2 -0
- package/src/models/operations/getpromptversion.ts +2 -0
- package/src/models/operations/getv2humanevalsets.ts +2 -2
- package/src/models/operations/getv2humanevalsetsid.ts +2 -2
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/listdatasetdatapoints.ts +5 -5
- package/src/models/operations/listdatasets.ts +1 -1
- package/src/models/operations/listpromptversions.ts +2 -0
- package/src/models/operations/patchv2humanevalsetsid.ts +2 -2
- package/src/models/operations/postv2feedbackevaluation.ts +4 -4
- package/src/models/operations/postv2humanevalsets.ts +2 -2
- package/src/models/operations/retrievedatapoint.ts +5 -5
- package/src/models/operations/retrievedataset.ts +1 -1
- package/src/models/operations/retrievetool.ts +4 -4
- package/src/models/operations/runagent.ts +1 -1
- package/src/models/operations/streamrunagent.ts +1 -1
- package/src/models/operations/updatedatapoint.ts +5 -5
- package/src/models/operations/updatedataset.ts +1 -1
- package/src/models/operations/updateprompt.ts +2 -0
- package/src/models/operations/updatetool.ts +4 -4
- package/src/sdk/classify.ts +27 -0
- package/src/sdk/router.ts +6 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { OrqCore } from "../core.js";
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import {
|
|
15
|
+
ConnectionError,
|
|
16
|
+
InvalidRequestError,
|
|
17
|
+
RequestAbortedError,
|
|
18
|
+
RequestTimeoutError,
|
|
19
|
+
UnexpectedClientError,
|
|
20
|
+
} from "../models/errors/httpclienterrors.js";
|
|
21
|
+
import * as errors from "../models/errors/index.js";
|
|
22
|
+
import { OrqError } from "../models/errors/orqerror.js";
|
|
23
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
24
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Classify
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* **Beta.** Runs typed classification questions (`noul`, `choice`, `score`) against a classify model such as `typesafe/jev-latest`. The request and response proxy the TypeSafe classification contract 1:1; `model` in the response is the orq model id that served the request and `usage` carries the computed cost like the Responses API. This endpoint currently does not apply PII plugins or guardrails.
|
|
34
|
+
*/
|
|
35
|
+
export function routerClassifyCreate(
|
|
36
|
+
client: OrqCore,
|
|
37
|
+
request: operations.CreateClassifyRequestBody,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<
|
|
40
|
+
Result<
|
|
41
|
+
operations.CreateClassifyResponseBody,
|
|
42
|
+
| errors.CreateClassifyResponseBody
|
|
43
|
+
| errors.CreateClassifyRouterClassifyResponseBody
|
|
44
|
+
| errors.CreateClassifyRouterClassifyResponseResponseBody
|
|
45
|
+
| OrqError
|
|
46
|
+
| ResponseValidationError
|
|
47
|
+
| ConnectionError
|
|
48
|
+
| RequestAbortedError
|
|
49
|
+
| RequestTimeoutError
|
|
50
|
+
| InvalidRequestError
|
|
51
|
+
| UnexpectedClientError
|
|
52
|
+
| SDKValidationError
|
|
53
|
+
>
|
|
54
|
+
> {
|
|
55
|
+
return new APIPromise($do(
|
|
56
|
+
client,
|
|
57
|
+
request,
|
|
58
|
+
options,
|
|
59
|
+
));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function $do(
|
|
63
|
+
client: OrqCore,
|
|
64
|
+
request: operations.CreateClassifyRequestBody,
|
|
65
|
+
options?: RequestOptions,
|
|
66
|
+
): Promise<
|
|
67
|
+
[
|
|
68
|
+
Result<
|
|
69
|
+
operations.CreateClassifyResponseBody,
|
|
70
|
+
| errors.CreateClassifyResponseBody
|
|
71
|
+
| errors.CreateClassifyRouterClassifyResponseBody
|
|
72
|
+
| errors.CreateClassifyRouterClassifyResponseResponseBody
|
|
73
|
+
| OrqError
|
|
74
|
+
| ResponseValidationError
|
|
75
|
+
| ConnectionError
|
|
76
|
+
| RequestAbortedError
|
|
77
|
+
| RequestTimeoutError
|
|
78
|
+
| InvalidRequestError
|
|
79
|
+
| UnexpectedClientError
|
|
80
|
+
| SDKValidationError
|
|
81
|
+
>,
|
|
82
|
+
APICall,
|
|
83
|
+
]
|
|
84
|
+
> {
|
|
85
|
+
const parsed = safeParse(
|
|
86
|
+
request,
|
|
87
|
+
(value) => operations.CreateClassifyRequestBody$outboundSchema.parse(value),
|
|
88
|
+
"Input validation failed",
|
|
89
|
+
);
|
|
90
|
+
if (!parsed.ok) {
|
|
91
|
+
return [parsed, { status: "invalid" }];
|
|
92
|
+
}
|
|
93
|
+
const payload = parsed.value;
|
|
94
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
95
|
+
|
|
96
|
+
const path = pathToFunc("/v3/router/classify")();
|
|
97
|
+
|
|
98
|
+
const headers = new Headers(compactMap({
|
|
99
|
+
"Content-Type": "application/json",
|
|
100
|
+
Accept: "application/json",
|
|
101
|
+
}));
|
|
102
|
+
|
|
103
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
104
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
105
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
106
|
+
|
|
107
|
+
const context = {
|
|
108
|
+
options: client._options,
|
|
109
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
110
|
+
operationID: "CreateClassify",
|
|
111
|
+
oAuth2Scopes: null,
|
|
112
|
+
|
|
113
|
+
resolvedSecurity: requestSecurity,
|
|
114
|
+
|
|
115
|
+
securitySource: client._options.apiKey,
|
|
116
|
+
retryConfig: options?.retries
|
|
117
|
+
|| client._options.retryConfig
|
|
118
|
+
|| { strategy: "none" },
|
|
119
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const requestRes = client._createRequest(context, {
|
|
123
|
+
security: requestSecurity,
|
|
124
|
+
method: "POST",
|
|
125
|
+
baseURL: options?.serverURL,
|
|
126
|
+
path: path,
|
|
127
|
+
headers: headers,
|
|
128
|
+
body: body,
|
|
129
|
+
userAgent: client._options.userAgent,
|
|
130
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
|
|
131
|
+
}, options);
|
|
132
|
+
if (!requestRes.ok) {
|
|
133
|
+
return [requestRes, { status: "invalid" }];
|
|
134
|
+
}
|
|
135
|
+
const req = requestRes.value;
|
|
136
|
+
|
|
137
|
+
const doResult = await client._do(req, {
|
|
138
|
+
context,
|
|
139
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
140
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
141
|
+
retryConfig: context.retryConfig,
|
|
142
|
+
retryCodes: context.retryCodes,
|
|
143
|
+
});
|
|
144
|
+
if (!doResult.ok) {
|
|
145
|
+
return [doResult, { status: "request-error", request: req }];
|
|
146
|
+
}
|
|
147
|
+
const response = doResult.value;
|
|
148
|
+
|
|
149
|
+
const responseFields = {
|
|
150
|
+
HttpMeta: { Response: response, Request: req },
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const [result] = await M.match<
|
|
154
|
+
operations.CreateClassifyResponseBody,
|
|
155
|
+
| errors.CreateClassifyResponseBody
|
|
156
|
+
| errors.CreateClassifyRouterClassifyResponseBody
|
|
157
|
+
| errors.CreateClassifyRouterClassifyResponseResponseBody
|
|
158
|
+
| OrqError
|
|
159
|
+
| ResponseValidationError
|
|
160
|
+
| ConnectionError
|
|
161
|
+
| RequestAbortedError
|
|
162
|
+
| RequestTimeoutError
|
|
163
|
+
| InvalidRequestError
|
|
164
|
+
| UnexpectedClientError
|
|
165
|
+
| SDKValidationError
|
|
166
|
+
>(
|
|
167
|
+
M.json(200, operations.CreateClassifyResponseBody$inboundSchema),
|
|
168
|
+
M.jsonErr(400, errors.CreateClassifyResponseBody$inboundSchema),
|
|
169
|
+
M.jsonErr(
|
|
170
|
+
422,
|
|
171
|
+
errors.CreateClassifyRouterClassifyResponseBody$inboundSchema,
|
|
172
|
+
),
|
|
173
|
+
M.jsonErr(
|
|
174
|
+
429,
|
|
175
|
+
errors.CreateClassifyRouterClassifyResponseResponseBody$inboundSchema,
|
|
176
|
+
),
|
|
177
|
+
M.fail("4XX"),
|
|
178
|
+
M.fail("5XX"),
|
|
179
|
+
)(response, req, { extraFields: responseFields });
|
|
180
|
+
if (!result.ok) {
|
|
181
|
+
return [result, { status: "complete", request: req, response }];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return [result, { status: "complete", request: req, response }];
|
|
185
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -58,7 +58,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
58
58
|
export const SDK_METADATA = {
|
|
59
59
|
language: "typescript",
|
|
60
60
|
openapiDocVersion: "2.0",
|
|
61
|
-
sdkVersion: "4.16.0-rc.
|
|
61
|
+
sdkVersion: "4.16.0-rc.4",
|
|
62
62
|
genVersion: "2.937.18",
|
|
63
|
-
userAgent: "speakeasy-sdk/typescript 4.16.0-rc.
|
|
63
|
+
userAgent: "speakeasy-sdk/typescript 4.16.0-rc.4 2.937.18 2.0 @orq-ai/node",
|
|
64
64
|
} as const;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The question type this answer belongs to.
|
|
13
|
+
*/
|
|
14
|
+
export const ClassifyAnswerType = {
|
|
15
|
+
Noul: "noul",
|
|
16
|
+
Choice: "choice",
|
|
17
|
+
Score: "score",
|
|
18
|
+
} as const;
|
|
19
|
+
/**
|
|
20
|
+
* The question type this answer belongs to.
|
|
21
|
+
*/
|
|
22
|
+
export type ClassifyAnswerType = ClosedEnum<typeof ClassifyAnswerType>;
|
|
23
|
+
|
|
24
|
+
export type ClassifyAnswer = {
|
|
25
|
+
/**
|
|
26
|
+
* The selected option. Present for choice answers.
|
|
27
|
+
*/
|
|
28
|
+
choice?: string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Confidence in the selected option or level. Present for choice and score answers.
|
|
31
|
+
*/
|
|
32
|
+
confidence?: number | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Level index to level description. Present for score answers.
|
|
35
|
+
*/
|
|
36
|
+
legend?: { [k: string]: string } | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Probability between 0 and 1 that the statement holds. Present for noul answers.
|
|
39
|
+
*/
|
|
40
|
+
noul?: number | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Probability distribution over the options or levels. Present for choice and score answers.
|
|
43
|
+
*/
|
|
44
|
+
probabilities?: { [k: string]: number } | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* The selected level index. Present for score answers.
|
|
47
|
+
*/
|
|
48
|
+
score?: number | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* The question type this answer belongs to.
|
|
51
|
+
*/
|
|
52
|
+
type: ClassifyAnswerType;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** @internal */
|
|
56
|
+
export const ClassifyAnswerType$inboundSchema: z.ZodNativeEnum<
|
|
57
|
+
typeof ClassifyAnswerType
|
|
58
|
+
> = z.nativeEnum(ClassifyAnswerType);
|
|
59
|
+
|
|
60
|
+
/** @internal */
|
|
61
|
+
export const ClassifyAnswer$inboundSchema: z.ZodType<
|
|
62
|
+
ClassifyAnswer,
|
|
63
|
+
z.ZodTypeDef,
|
|
64
|
+
unknown
|
|
65
|
+
> = z.object({
|
|
66
|
+
choice: z.string().optional(),
|
|
67
|
+
confidence: z.number().optional(),
|
|
68
|
+
legend: z.record(z.string()).optional(),
|
|
69
|
+
noul: z.number().optional(),
|
|
70
|
+
probabilities: z.record(z.number()).optional(),
|
|
71
|
+
score: z.number().optional(),
|
|
72
|
+
type: ClassifyAnswerType$inboundSchema,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export function classifyAnswerFromJSON(
|
|
76
|
+
jsonString: string,
|
|
77
|
+
): SafeParseResult<ClassifyAnswer, SDKValidationError> {
|
|
78
|
+
return safeParse(
|
|
79
|
+
jsonString,
|
|
80
|
+
(x) => ClassifyAnswer$inboundSchema.parse(JSON.parse(x)),
|
|
81
|
+
`Failed to parse 'ClassifyAnswer' from JSON`,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
|
|
8
|
+
export type ClassifyRetryConfig = {
|
|
9
|
+
/**
|
|
10
|
+
* Number of retry attempts (1-5).
|
|
11
|
+
*/
|
|
12
|
+
count: number;
|
|
13
|
+
/**
|
|
14
|
+
* HTTP status codes that trigger retry logic.
|
|
15
|
+
*/
|
|
16
|
+
onCodes: Array<number> | null;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export type ClassifyRetryConfig$Outbound = {
|
|
21
|
+
count: number;
|
|
22
|
+
on_codes: Array<number> | null;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const ClassifyRetryConfig$outboundSchema: z.ZodType<
|
|
27
|
+
ClassifyRetryConfig$Outbound,
|
|
28
|
+
z.ZodTypeDef,
|
|
29
|
+
ClassifyRetryConfig
|
|
30
|
+
> = z.object({
|
|
31
|
+
count: z.number().int(),
|
|
32
|
+
onCodes: z.nullable(z.array(z.number().int())),
|
|
33
|
+
}).transform((v) => {
|
|
34
|
+
return remap$(v, {
|
|
35
|
+
onCodes: "on_codes",
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export function classifyRetryConfigToJSON(
|
|
40
|
+
classifyRetryConfig: ClassifyRetryConfig,
|
|
41
|
+
): string {
|
|
42
|
+
return JSON.stringify(
|
|
43
|
+
ClassifyRetryConfig$outboundSchema.parse(classifyRetryConfig),
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type ClassifyUsage = {
|
|
12
|
+
/**
|
|
13
|
+
* Cost (USD) of input tokens. Present when billing was computed for this request.
|
|
14
|
+
*/
|
|
15
|
+
inputCost?: number | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* The number of input tokens processed.
|
|
18
|
+
*/
|
|
19
|
+
inputTokens: number;
|
|
20
|
+
/**
|
|
21
|
+
* Cost (USD) of output tokens, always 0 for classify. Present when billing was computed for this request.
|
|
22
|
+
*/
|
|
23
|
+
outputCost?: number | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* The number of output tokens generated. Not billed.
|
|
26
|
+
*/
|
|
27
|
+
outputTokens: number;
|
|
28
|
+
/**
|
|
29
|
+
* Total cost (USD) of the request. Present when billing was computed for this request.
|
|
30
|
+
*/
|
|
31
|
+
totalCost?: number | undefined;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** @internal */
|
|
35
|
+
export const ClassifyUsage$inboundSchema: z.ZodType<
|
|
36
|
+
ClassifyUsage,
|
|
37
|
+
z.ZodTypeDef,
|
|
38
|
+
unknown
|
|
39
|
+
> = z.object({
|
|
40
|
+
input_cost: z.number().optional(),
|
|
41
|
+
input_tokens: z.number().int(),
|
|
42
|
+
output_cost: z.number().optional(),
|
|
43
|
+
output_tokens: z.number().int(),
|
|
44
|
+
total_cost: z.number().optional(),
|
|
45
|
+
}).transform((v) => {
|
|
46
|
+
return remap$(v, {
|
|
47
|
+
"input_cost": "inputCost",
|
|
48
|
+
"input_tokens": "inputTokens",
|
|
49
|
+
"output_cost": "outputCost",
|
|
50
|
+
"output_tokens": "outputTokens",
|
|
51
|
+
"total_cost": "totalCost",
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export function classifyUsageFromJSON(
|
|
56
|
+
jsonString: string,
|
|
57
|
+
): SafeParseResult<ClassifyUsage, SDKValidationError> {
|
|
58
|
+
return safeParse(
|
|
59
|
+
jsonString,
|
|
60
|
+
(x) => ClassifyUsage$inboundSchema.parse(JSON.parse(x)),
|
|
61
|
+
`Failed to parse 'ClassifyUsage' from JSON`,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
@@ -89,6 +89,9 @@ export * from "./chunksservicelistpaginatedresponse.js";
|
|
|
89
89
|
export * from "./chunksservicelistresponse.js";
|
|
90
90
|
export * from "./chunksservicesetenabledrequest.js";
|
|
91
91
|
export * from "./chunksserviceupdaterequest.js";
|
|
92
|
+
export * from "./classifyanswer.js";
|
|
93
|
+
export * from "./classifyretryconfig.js";
|
|
94
|
+
export * from "./classifyusage.js";
|
|
92
95
|
export * from "./codeinterpretertoolinput.js";
|
|
93
96
|
export * from "./codetoolinput.js";
|
|
94
97
|
export * from "./conversationparam.js";
|
|
@@ -96,6 +96,7 @@ export type ModelMetadata = {
|
|
|
96
96
|
supportsBatchApi?: boolean | undefined;
|
|
97
97
|
supportsCacheControl?: boolean | undefined;
|
|
98
98
|
supportsCitations?: boolean | undefined;
|
|
99
|
+
supportsClassify?: boolean | undefined;
|
|
99
100
|
supportsCodeExecution?: boolean | undefined;
|
|
100
101
|
supportsCommercialUse?: boolean | undefined;
|
|
101
102
|
supportsComputerUse?: boolean | undefined;
|
|
@@ -229,6 +230,7 @@ export const ModelMetadata$inboundSchema: z.ZodType<
|
|
|
229
230
|
supports_batch_api: z.boolean().optional(),
|
|
230
231
|
supports_cache_control: z.boolean().optional(),
|
|
231
232
|
supports_citations: z.boolean().optional(),
|
|
233
|
+
supports_classify: z.boolean().optional(),
|
|
232
234
|
supports_code_execution: z.boolean().optional(),
|
|
233
235
|
supports_commercial_use: z.boolean().optional(),
|
|
234
236
|
supports_computer_use: z.boolean().optional(),
|
|
@@ -354,6 +356,7 @@ export const ModelMetadata$inboundSchema: z.ZodType<
|
|
|
354
356
|
"supports_batch_api": "supportsBatchApi",
|
|
355
357
|
"supports_cache_control": "supportsCacheControl",
|
|
356
358
|
"supports_citations": "supportsCitations",
|
|
359
|
+
"supports_classify": "supportsClassify",
|
|
357
360
|
"supports_code_execution": "supportsCodeExecution",
|
|
358
361
|
"supports_commercial_use": "supportsCommercialUse",
|
|
359
362
|
"supports_computer_use": "supportsComputerUse",
|
|
@@ -484,6 +487,7 @@ export type ModelMetadata$Outbound = {
|
|
|
484
487
|
supports_batch_api?: boolean | undefined;
|
|
485
488
|
supports_cache_control?: boolean | undefined;
|
|
486
489
|
supports_citations?: boolean | undefined;
|
|
490
|
+
supports_classify?: boolean | undefined;
|
|
487
491
|
supports_code_execution?: boolean | undefined;
|
|
488
492
|
supports_commercial_use?: boolean | undefined;
|
|
489
493
|
supports_computer_use?: boolean | undefined;
|
|
@@ -617,6 +621,7 @@ export const ModelMetadata$outboundSchema: z.ZodType<
|
|
|
617
621
|
supportsBatchApi: z.boolean().optional(),
|
|
618
622
|
supportsCacheControl: z.boolean().optional(),
|
|
619
623
|
supportsCitations: z.boolean().optional(),
|
|
624
|
+
supportsClassify: z.boolean().optional(),
|
|
620
625
|
supportsCodeExecution: z.boolean().optional(),
|
|
621
626
|
supportsCommercialUse: z.boolean().optional(),
|
|
622
627
|
supportsComputerUse: z.boolean().optional(),
|
|
@@ -742,6 +747,7 @@ export const ModelMetadata$outboundSchema: z.ZodType<
|
|
|
742
747
|
supportsBatchApi: "supports_batch_api",
|
|
743
748
|
supportsCacheControl: "supports_cache_control",
|
|
744
749
|
supportsCitations: "supports_citations",
|
|
750
|
+
supportsClassify: "supports_classify",
|
|
745
751
|
supportsCodeExecution: "supports_code_execution",
|
|
746
752
|
supportsCommercialUse: "supports_commercial_use",
|
|
747
753
|
supportsComputerUse: "supports_computer_use",
|
|
@@ -40,7 +40,7 @@ export const ReasoningPart$inboundSchema: z.ZodType<
|
|
|
40
40
|
z.ZodTypeDef,
|
|
41
41
|
unknown
|
|
42
42
|
> = z.object({
|
|
43
|
-
_id: z.string().default("
|
|
43
|
+
_id: z.string().default("reasoning_01m2t6y9j90wbd02pm1mxqcrb5"),
|
|
44
44
|
metadata: z.record(z.any()).optional(),
|
|
45
45
|
kind: z.literal("reasoning"),
|
|
46
46
|
reasoning: z.string(),
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import * as components from "../components/index.js";
|
|
7
|
+
import { OrqError } from "./orqerror.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Rate limited by the provider.
|
|
11
|
+
*/
|
|
12
|
+
export type CreateClassifyRouterClassifyResponseResponseBodyData = {
|
|
13
|
+
error: components.APIError;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Rate limited by the provider.
|
|
18
|
+
*/
|
|
19
|
+
export class CreateClassifyRouterClassifyResponseResponseBody extends OrqError {
|
|
20
|
+
error: components.APIError;
|
|
21
|
+
|
|
22
|
+
/** The original data that was passed to this error instance. */
|
|
23
|
+
data$: CreateClassifyRouterClassifyResponseResponseBodyData;
|
|
24
|
+
|
|
25
|
+
constructor(
|
|
26
|
+
err: CreateClassifyRouterClassifyResponseResponseBodyData,
|
|
27
|
+
httpMeta: { response: Response; request: Request; body: string },
|
|
28
|
+
) {
|
|
29
|
+
const message = err.error?.message
|
|
30
|
+
|| `API error occurred: ${JSON.stringify(err)}`;
|
|
31
|
+
super(message, httpMeta);
|
|
32
|
+
this.data$ = err;
|
|
33
|
+
this.error = err.error;
|
|
34
|
+
|
|
35
|
+
this.name = "CreateClassifyRouterClassifyResponseResponseBody";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The state or a question violates the classification contract.
|
|
41
|
+
*/
|
|
42
|
+
export type CreateClassifyRouterClassifyResponseBodyData = {
|
|
43
|
+
error: components.APIError;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The state or a question violates the classification contract.
|
|
48
|
+
*/
|
|
49
|
+
export class CreateClassifyRouterClassifyResponseBody extends OrqError {
|
|
50
|
+
error: components.APIError;
|
|
51
|
+
|
|
52
|
+
/** The original data that was passed to this error instance. */
|
|
53
|
+
data$: CreateClassifyRouterClassifyResponseBodyData;
|
|
54
|
+
|
|
55
|
+
constructor(
|
|
56
|
+
err: CreateClassifyRouterClassifyResponseBodyData,
|
|
57
|
+
httpMeta: { response: Response; request: Request; body: string },
|
|
58
|
+
) {
|
|
59
|
+
const message = err.error?.message
|
|
60
|
+
|| `API error occurred: ${JSON.stringify(err)}`;
|
|
61
|
+
super(message, httpMeta);
|
|
62
|
+
this.data$ = err;
|
|
63
|
+
this.error = err.error;
|
|
64
|
+
|
|
65
|
+
this.name = "CreateClassifyRouterClassifyResponseBody";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Malformed JSON or missing model.
|
|
71
|
+
*/
|
|
72
|
+
export type CreateClassifyResponseBodyData = {
|
|
73
|
+
error: components.APIError;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Malformed JSON or missing model.
|
|
78
|
+
*/
|
|
79
|
+
export class CreateClassifyResponseBody extends OrqError {
|
|
80
|
+
error: components.APIError;
|
|
81
|
+
|
|
82
|
+
/** The original data that was passed to this error instance. */
|
|
83
|
+
data$: CreateClassifyResponseBodyData;
|
|
84
|
+
|
|
85
|
+
constructor(
|
|
86
|
+
err: CreateClassifyResponseBodyData,
|
|
87
|
+
httpMeta: { response: Response; request: Request; body: string },
|
|
88
|
+
) {
|
|
89
|
+
const message = err.error?.message
|
|
90
|
+
|| `API error occurred: ${JSON.stringify(err)}`;
|
|
91
|
+
super(message, httpMeta);
|
|
92
|
+
this.data$ = err;
|
|
93
|
+
this.error = err.error;
|
|
94
|
+
|
|
95
|
+
this.name = "CreateClassifyResponseBody";
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** @internal */
|
|
100
|
+
export const CreateClassifyRouterClassifyResponseResponseBody$inboundSchema:
|
|
101
|
+
z.ZodType<
|
|
102
|
+
CreateClassifyRouterClassifyResponseResponseBody,
|
|
103
|
+
z.ZodTypeDef,
|
|
104
|
+
unknown
|
|
105
|
+
> = z.object({
|
|
106
|
+
error: components.APIError$inboundSchema,
|
|
107
|
+
request$: z.instanceof(Request),
|
|
108
|
+
response$: z.instanceof(Response),
|
|
109
|
+
body$: z.string(),
|
|
110
|
+
})
|
|
111
|
+
.transform((v) => {
|
|
112
|
+
return new CreateClassifyRouterClassifyResponseResponseBody(v, {
|
|
113
|
+
request: v.request$,
|
|
114
|
+
response: v.response$,
|
|
115
|
+
body: v.body$,
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
/** @internal */
|
|
120
|
+
export const CreateClassifyRouterClassifyResponseBody$inboundSchema: z.ZodType<
|
|
121
|
+
CreateClassifyRouterClassifyResponseBody,
|
|
122
|
+
z.ZodTypeDef,
|
|
123
|
+
unknown
|
|
124
|
+
> = z.object({
|
|
125
|
+
error: components.APIError$inboundSchema,
|
|
126
|
+
request$: z.instanceof(Request),
|
|
127
|
+
response$: z.instanceof(Response),
|
|
128
|
+
body$: z.string(),
|
|
129
|
+
})
|
|
130
|
+
.transform((v) => {
|
|
131
|
+
return new CreateClassifyRouterClassifyResponseBody(v, {
|
|
132
|
+
request: v.request$,
|
|
133
|
+
response: v.response$,
|
|
134
|
+
body: v.body$,
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
/** @internal */
|
|
139
|
+
export const CreateClassifyResponseBody$inboundSchema: z.ZodType<
|
|
140
|
+
CreateClassifyResponseBody,
|
|
141
|
+
z.ZodTypeDef,
|
|
142
|
+
unknown
|
|
143
|
+
> = z.object({
|
|
144
|
+
error: components.APIError$inboundSchema,
|
|
145
|
+
request$: z.instanceof(Request),
|
|
146
|
+
response$: z.instanceof(Response),
|
|
147
|
+
body$: z.string(),
|
|
148
|
+
})
|
|
149
|
+
.transform((v) => {
|
|
150
|
+
return new CreateClassifyResponseBody(v, {
|
|
151
|
+
request: v.request$,
|
|
152
|
+
response: v.response$,
|
|
153
|
+
body: v.body$,
|
|
154
|
+
});
|
|
155
|
+
});
|