@orq-ai/node 4.16.0-rc.56 → 4.16.0-rc.58
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 +68 -52
- package/funcs/routerClassifyCreate.d.ts +2 -2
- package/funcs/routerClassifyCreate.d.ts.map +1 -1
- package/funcs/routerClassifyCreate.js +2 -2
- package/funcs/routerClassifyCreate.js.map +1 -1
- package/funcs/routerDecisionsCreate.d.ts +18 -0
- package/funcs/routerDecisionsCreate.d.ts.map +1 -0
- package/funcs/routerDecisionsCreate.js +123 -0
- package/funcs/routerDecisionsCreate.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 +6 -47
- package/models/components/classifyanswer.d.ts.map +1 -1
- package/models/components/classifyanswer.js +11 -20
- package/models/components/classifyanswer.js.map +1 -1
- package/models/components/classifychoiceanswer.d.ts +24 -0
- package/models/components/classifychoiceanswer.d.ts.map +1 -0
- package/models/components/classifychoiceanswer.js +53 -0
- package/models/components/classifychoiceanswer.js.map +1 -0
- package/models/components/classifyinputtokensdetails.d.ts +17 -0
- package/models/components/classifyinputtokensdetails.d.ts.map +1 -0
- package/models/components/classifyinputtokensdetails.js +57 -0
- package/models/components/classifyinputtokensdetails.js.map +1 -0
- package/models/components/classifynoulanswer.d.ts +14 -0
- package/models/components/classifynoulanswer.d.ts.map +1 -0
- package/models/components/classifynoulanswer.js +51 -0
- package/models/components/classifynoulanswer.js.map +1 -0
- package/models/components/classifyrefusalanswer.d.ts +10 -0
- package/models/components/classifyrefusalanswer.d.ts.map +1 -0
- package/models/components/classifyrefusalanswer.js +50 -0
- package/models/components/classifyrefusalanswer.js.map +1 -0
- package/models/components/classifyretryconfig.d.ts +4 -4
- package/models/components/classifyretryconfig.d.ts.map +1 -1
- package/models/components/classifyretryconfig.js +1 -1
- package/models/components/classifyretryconfig.js.map +1 -1
- package/models/components/classifyscoreanswer.d.ts +30 -0
- package/models/components/classifyscoreanswer.d.ts.map +1 -0
- package/models/components/classifyscoreanswer.js +54 -0
- package/models/components/classifyscoreanswer.js.map +1 -0
- package/models/components/classifyusage.d.ts +4 -2
- package/models/components/classifyusage.d.ts.map +1 -1
- package/models/components/classifyusage.js +3 -0
- package/models/components/classifyusage.js.map +1 -1
- package/models/components/index.d.ts +5 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +5 -0
- package/models/components/index.js.map +1 -1
- package/models/components/model.d.ts +4 -0
- package/models/components/model.d.ts.map +1 -1
- package/models/components/model.js +1 -0
- package/models/components/model.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/publicplugin.d.ts +1 -1
- package/models/components/reasoningpart.js +1 -1
- package/models/errors/createclassify.d.ts +90 -6
- package/models/errors/createclassify.d.ts.map +1 -1
- package/models/errors/createclassify.js +116 -4
- package/models/errors/createclassify.js.map +1 -1
- package/models/errors/createdecisions.d.ts +151 -0
- package/models/errors/createdecisions.d.ts.map +1 -0
- package/models/errors/createdecisions.js +239 -0
- package/models/errors/createdecisions.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 +9 -4
- package/models/operations/createclassify.d.ts.map +1 -1
- package/models/operations/createclassify.js +2 -0
- package/models/operations/createclassify.js.map +1 -1
- package/models/operations/createdecisions.d.ts +237 -0
- package/models/operations/createdecisions.d.ts.map +1 -0
- package/models/operations/createdecisions.js +148 -0
- package/models/operations/createdecisions.js.map +1 -0
- package/models/operations/createprompt.d.ts +1 -0
- package/models/operations/createprompt.d.ts.map +1 -1
- package/models/operations/createprompt.js +1 -0
- package/models/operations/createprompt.js.map +1 -1
- package/models/operations/createtool.js +4 -4
- 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 +1 -0
- package/models/operations/deployments.d.ts.map +1 -1
- package/models/operations/deployments.js +1 -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 +1 -0
- package/models/operations/getallprompts.d.ts.map +1 -1
- package/models/operations/getallprompts.js +1 -0
- package/models/operations/getallprompts.js.map +1 -1
- package/models/operations/getalltools.js +4 -4
- package/models/operations/getoneprompt.d.ts +1 -0
- package/models/operations/getoneprompt.d.ts.map +1 -1
- package/models/operations/getoneprompt.js +1 -0
- package/models/operations/getoneprompt.js.map +1 -1
- package/models/operations/getpromptversion.d.ts +1 -0
- package/models/operations/getpromptversion.d.ts.map +1 -1
- package/models/operations/getpromptversion.js +1 -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/listpromptversions.d.ts +1 -0
- package/models/operations/listpromptversions.d.ts.map +1 -1
- package/models/operations/listpromptversions.js +1 -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/retrievetool.js +4 -4
- package/models/operations/runagent.js +1 -1
- package/models/operations/streamrunagent.js +1 -1
- package/models/operations/updateprompt.d.ts +1 -0
- package/models/operations/updateprompt.d.ts.map +1 -1
- package/models/operations/updateprompt.js +1 -0
- package/models/operations/updateprompt.js.map +1 -1
- package/models/operations/updatetool.js +4 -4
- package/package.json +9 -9
- package/sdk/classify.d.ts +1 -1
- package/sdk/classify.js +1 -1
- package/sdk/decisions.d.ts +12 -0
- package/sdk/decisions.d.ts.map +1 -0
- package/sdk/decisions.js +22 -0
- package/sdk/decisions.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 +31 -3
- package/src/funcs/routerDecisionsCreate.ts +218 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/classifyanswer.ts +28 -56
- package/src/models/components/classifychoiceanswer.ts +46 -0
- package/src/models/components/classifyinputtokensdetails.ts +45 -0
- package/src/models/components/classifynoulanswer.ts +36 -0
- package/src/models/components/classifyrefusalanswer.ts +31 -0
- package/src/models/components/classifyretryconfig.ts +5 -5
- package/src/models/components/classifyscoreanswer.ts +51 -0
- package/src/models/components/classifyusage.ts +9 -2
- package/src/models/components/index.ts +5 -0
- package/src/models/components/model.ts +5 -0
- package/src/models/components/modelmetadata.ts +6 -0
- package/src/models/components/publicplugin.ts +1 -1
- package/src/models/components/reasoningpart.ts +1 -1
- package/src/models/errors/createclassify.ts +214 -6
- package/src/models/errors/createdecisions.ts +363 -0
- package/src/models/errors/index.ts +1 -0
- package/src/models/operations/createclassify.ts +11 -4
- package/src/models/operations/createdecisions.ts +434 -0
- package/src/models/operations/createprompt.ts +1 -0
- package/src/models/operations/createtool.ts +4 -4
- package/src/models/operations/deploymentinvoke.ts +1 -0
- package/src/models/operations/deployments.ts +1 -0
- package/src/models/operations/deploymentstream.ts +1 -0
- package/src/models/operations/getallprompts.ts +1 -0
- package/src/models/operations/getalltools.ts +4 -4
- package/src/models/operations/getoneprompt.ts +1 -0
- package/src/models/operations/getpromptversion.ts +1 -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/listpromptversions.ts +1 -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/retrievetool.ts +4 -4
- package/src/models/operations/runagent.ts +1 -1
- package/src/models/operations/streamrunagent.ts +1 -1
- package/src/models/operations/updateprompt.ts +1 -0
- package/src/models/operations/updatetool.ts +4 -4
- package/src/sdk/classify.ts +1 -1
- package/src/sdk/decisions.ts +27 -0
- package/src/sdk/router.ts +6 -0
|
@@ -0,0 +1,218 @@
|
|
|
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
|
+
* Decisions
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* **Beta.** Runs typed classification questions (`noul`, `choice`, `score`) against a native classify provider, including OpenAI Decisions with `openai/gpt-6-luna`, or a chat model that supports classify emulation. Emulated models answer through one structured-output call and their probabilities are model-reported rather than calibrated. Native providers can return `refusal` for individual questions; refused answers contain only `type`. The request and response follow the TypeSafe classification contract; `model` in the response identifies the primary or fallback model that answered and `usage` carries the computed cost like the Responses API. Both `/v3/router/classify` and `/v3/router/decisions` use this contract, including ordered `fallbacks`, request-level `retry`, and `identity` attribution. Both require `classify.execute`. This endpoint currently does not apply PII plugins or guardrails.
|
|
34
|
+
*/
|
|
35
|
+
export function routerDecisionsCreate(
|
|
36
|
+
client: OrqCore,
|
|
37
|
+
request: operations.CreateDecisionsRequestBody,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<
|
|
40
|
+
Result<
|
|
41
|
+
operations.CreateDecisionsResponseBody,
|
|
42
|
+
| errors.CreateDecisionsResponseBody
|
|
43
|
+
| errors.CreateDecisionsRouterDecisionsResponseBody
|
|
44
|
+
| errors.CreateDecisionsRouterDecisionsResponseResponseBody
|
|
45
|
+
| errors.CreateDecisionsRouterDecisionsResponse422ResponseBody
|
|
46
|
+
| errors.CreateDecisionsRouterDecisionsResponse429ResponseBody
|
|
47
|
+
| errors.CreateDecisionsRouterDecisionsResponse500ResponseBody
|
|
48
|
+
| errors.CreateDecisionsRouterDecisionsResponse502ResponseBody
|
|
49
|
+
| OrqError
|
|
50
|
+
| ResponseValidationError
|
|
51
|
+
| ConnectionError
|
|
52
|
+
| RequestAbortedError
|
|
53
|
+
| RequestTimeoutError
|
|
54
|
+
| InvalidRequestError
|
|
55
|
+
| UnexpectedClientError
|
|
56
|
+
| SDKValidationError
|
|
57
|
+
>
|
|
58
|
+
> {
|
|
59
|
+
return new APIPromise($do(
|
|
60
|
+
client,
|
|
61
|
+
request,
|
|
62
|
+
options,
|
|
63
|
+
));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function $do(
|
|
67
|
+
client: OrqCore,
|
|
68
|
+
request: operations.CreateDecisionsRequestBody,
|
|
69
|
+
options?: RequestOptions,
|
|
70
|
+
): Promise<
|
|
71
|
+
[
|
|
72
|
+
Result<
|
|
73
|
+
operations.CreateDecisionsResponseBody,
|
|
74
|
+
| errors.CreateDecisionsResponseBody
|
|
75
|
+
| errors.CreateDecisionsRouterDecisionsResponseBody
|
|
76
|
+
| errors.CreateDecisionsRouterDecisionsResponseResponseBody
|
|
77
|
+
| errors.CreateDecisionsRouterDecisionsResponse422ResponseBody
|
|
78
|
+
| errors.CreateDecisionsRouterDecisionsResponse429ResponseBody
|
|
79
|
+
| errors.CreateDecisionsRouterDecisionsResponse500ResponseBody
|
|
80
|
+
| errors.CreateDecisionsRouterDecisionsResponse502ResponseBody
|
|
81
|
+
| OrqError
|
|
82
|
+
| ResponseValidationError
|
|
83
|
+
| ConnectionError
|
|
84
|
+
| RequestAbortedError
|
|
85
|
+
| RequestTimeoutError
|
|
86
|
+
| InvalidRequestError
|
|
87
|
+
| UnexpectedClientError
|
|
88
|
+
| SDKValidationError
|
|
89
|
+
>,
|
|
90
|
+
APICall,
|
|
91
|
+
]
|
|
92
|
+
> {
|
|
93
|
+
const parsed = safeParse(
|
|
94
|
+
request,
|
|
95
|
+
(value) =>
|
|
96
|
+
operations.CreateDecisionsRequestBody$outboundSchema.parse(value),
|
|
97
|
+
"Input validation failed",
|
|
98
|
+
);
|
|
99
|
+
if (!parsed.ok) {
|
|
100
|
+
return [parsed, { status: "invalid" }];
|
|
101
|
+
}
|
|
102
|
+
const payload = parsed.value;
|
|
103
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
104
|
+
|
|
105
|
+
const path = pathToFunc("/v3/router/decisions")();
|
|
106
|
+
|
|
107
|
+
const headers = new Headers(compactMap({
|
|
108
|
+
"Content-Type": "application/json",
|
|
109
|
+
Accept: "application/json",
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
113
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
114
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
115
|
+
|
|
116
|
+
const context = {
|
|
117
|
+
options: client._options,
|
|
118
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
119
|
+
operationID: "CreateDecisions",
|
|
120
|
+
oAuth2Scopes: null,
|
|
121
|
+
|
|
122
|
+
resolvedSecurity: requestSecurity,
|
|
123
|
+
|
|
124
|
+
securitySource: client._options.apiKey,
|
|
125
|
+
retryConfig: options?.retries
|
|
126
|
+
|| client._options.retryConfig
|
|
127
|
+
|| { strategy: "none" },
|
|
128
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const requestRes = client._createRequest(context, {
|
|
132
|
+
security: requestSecurity,
|
|
133
|
+
method: "POST",
|
|
134
|
+
baseURL: options?.serverURL,
|
|
135
|
+
path: path,
|
|
136
|
+
headers: headers,
|
|
137
|
+
body: body,
|
|
138
|
+
userAgent: client._options.userAgent,
|
|
139
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
|
|
140
|
+
}, options);
|
|
141
|
+
if (!requestRes.ok) {
|
|
142
|
+
return [requestRes, { status: "invalid" }];
|
|
143
|
+
}
|
|
144
|
+
const req = requestRes.value;
|
|
145
|
+
|
|
146
|
+
const doResult = await client._do(req, {
|
|
147
|
+
context,
|
|
148
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
149
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
150
|
+
retryConfig: context.retryConfig,
|
|
151
|
+
retryCodes: context.retryCodes,
|
|
152
|
+
});
|
|
153
|
+
if (!doResult.ok) {
|
|
154
|
+
return [doResult, { status: "request-error", request: req }];
|
|
155
|
+
}
|
|
156
|
+
const response = doResult.value;
|
|
157
|
+
|
|
158
|
+
const responseFields = {
|
|
159
|
+
HttpMeta: { Response: response, Request: req },
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const [result] = await M.match<
|
|
163
|
+
operations.CreateDecisionsResponseBody,
|
|
164
|
+
| errors.CreateDecisionsResponseBody
|
|
165
|
+
| errors.CreateDecisionsRouterDecisionsResponseBody
|
|
166
|
+
| errors.CreateDecisionsRouterDecisionsResponseResponseBody
|
|
167
|
+
| errors.CreateDecisionsRouterDecisionsResponse422ResponseBody
|
|
168
|
+
| errors.CreateDecisionsRouterDecisionsResponse429ResponseBody
|
|
169
|
+
| errors.CreateDecisionsRouterDecisionsResponse500ResponseBody
|
|
170
|
+
| errors.CreateDecisionsRouterDecisionsResponse502ResponseBody
|
|
171
|
+
| OrqError
|
|
172
|
+
| ResponseValidationError
|
|
173
|
+
| ConnectionError
|
|
174
|
+
| RequestAbortedError
|
|
175
|
+
| RequestTimeoutError
|
|
176
|
+
| InvalidRequestError
|
|
177
|
+
| UnexpectedClientError
|
|
178
|
+
| SDKValidationError
|
|
179
|
+
>(
|
|
180
|
+
M.json(200, operations.CreateDecisionsResponseBody$inboundSchema),
|
|
181
|
+
M.jsonErr(400, errors.CreateDecisionsResponseBody$inboundSchema),
|
|
182
|
+
M.jsonErr(
|
|
183
|
+
401,
|
|
184
|
+
errors.CreateDecisionsRouterDecisionsResponseBody$inboundSchema,
|
|
185
|
+
),
|
|
186
|
+
M.jsonErr(
|
|
187
|
+
403,
|
|
188
|
+
errors.CreateDecisionsRouterDecisionsResponseResponseBody$inboundSchema,
|
|
189
|
+
),
|
|
190
|
+
M.jsonErr(
|
|
191
|
+
422,
|
|
192
|
+
errors
|
|
193
|
+
.CreateDecisionsRouterDecisionsResponse422ResponseBody$inboundSchema,
|
|
194
|
+
),
|
|
195
|
+
M.jsonErr(
|
|
196
|
+
429,
|
|
197
|
+
errors
|
|
198
|
+
.CreateDecisionsRouterDecisionsResponse429ResponseBody$inboundSchema,
|
|
199
|
+
),
|
|
200
|
+
M.jsonErr(
|
|
201
|
+
500,
|
|
202
|
+
errors
|
|
203
|
+
.CreateDecisionsRouterDecisionsResponse500ResponseBody$inboundSchema,
|
|
204
|
+
),
|
|
205
|
+
M.jsonErr(
|
|
206
|
+
502,
|
|
207
|
+
errors
|
|
208
|
+
.CreateDecisionsRouterDecisionsResponse502ResponseBody$inboundSchema,
|
|
209
|
+
),
|
|
210
|
+
M.fail("4XX"),
|
|
211
|
+
M.fail("5XX"),
|
|
212
|
+
)(response, req, { extraFields: responseFields });
|
|
213
|
+
if (!result.ok) {
|
|
214
|
+
return [result, { status: "complete", request: req, response }];
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return [result, { status: "complete", request: req, response }];
|
|
218
|
+
}
|
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.58",
|
|
62
62
|
genVersion: "2.943.0",
|
|
63
|
-
userAgent: "speakeasy-sdk/typescript 4.16.0-rc.
|
|
63
|
+
userAgent: "speakeasy-sdk/typescript 4.16.0-rc.58 2.943.0 2.0 @orq-ai/node",
|
|
64
64
|
} as const;
|
|
@@ -4,73 +4,45 @@
|
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
-
import { ClosedEnum } from "../../types/enums.js";
|
|
8
7
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
8
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
ClassifyChoiceAnswer,
|
|
11
|
+
ClassifyChoiceAnswer$inboundSchema,
|
|
12
|
+
} from "./classifychoiceanswer.js";
|
|
13
|
+
import {
|
|
14
|
+
ClassifyNoulAnswer,
|
|
15
|
+
ClassifyNoulAnswer$inboundSchema,
|
|
16
|
+
} from "./classifynoulanswer.js";
|
|
17
|
+
import {
|
|
18
|
+
ClassifyRefusalAnswer,
|
|
19
|
+
ClassifyRefusalAnswer$inboundSchema,
|
|
20
|
+
} from "./classifyrefusalanswer.js";
|
|
21
|
+
import {
|
|
22
|
+
ClassifyScoreAnswer,
|
|
23
|
+
ClassifyScoreAnswer$inboundSchema,
|
|
24
|
+
} from "./classifyscoreanswer.js";
|
|
10
25
|
|
|
11
26
|
/**
|
|
12
|
-
*
|
|
27
|
+
* One answer to a classification question. The type selects the answer fields. A refusal contains only type.
|
|
13
28
|
*/
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
* How sure the model is of the answer it selected: on chat models the largest value in probabilities, so it adds nothing the distribution does not; typesafe/jev-latest returns its own calibrated value, which can sit below the largest probability. 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
|
-
* Position on the scale, not an index: on chat models the weighted index, each level index multiplied by that level probability and summed, so the value is usually fractional; typesafe/jev-latest returns its own score. 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);
|
|
29
|
+
export type ClassifyAnswer =
|
|
30
|
+
| ClassifyChoiceAnswer
|
|
31
|
+
| ClassifyNoulAnswer
|
|
32
|
+
| ClassifyRefusalAnswer
|
|
33
|
+
| ClassifyScoreAnswer;
|
|
59
34
|
|
|
60
35
|
/** @internal */
|
|
61
36
|
export const ClassifyAnswer$inboundSchema: z.ZodType<
|
|
62
37
|
ClassifyAnswer,
|
|
63
38
|
z.ZodTypeDef,
|
|
64
39
|
unknown
|
|
65
|
-
> = z.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
score: z.number().optional(),
|
|
72
|
-
type: ClassifyAnswerType$inboundSchema,
|
|
73
|
-
});
|
|
40
|
+
> = z.union([
|
|
41
|
+
ClassifyChoiceAnswer$inboundSchema,
|
|
42
|
+
ClassifyNoulAnswer$inboundSchema,
|
|
43
|
+
ClassifyRefusalAnswer$inboundSchema,
|
|
44
|
+
ClassifyScoreAnswer$inboundSchema,
|
|
45
|
+
]);
|
|
74
46
|
|
|
75
47
|
export function classifyAnswerFromJSON(
|
|
76
48
|
jsonString: string,
|
|
@@ -0,0 +1,46 @@
|
|
|
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 { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type ClassifyChoiceAnswer = {
|
|
11
|
+
/**
|
|
12
|
+
* The selected option. Present for choice answers.
|
|
13
|
+
*/
|
|
14
|
+
choice: string;
|
|
15
|
+
/**
|
|
16
|
+
* How sure the model is of the answer it selected: on emulated chat models the largest value in probabilities, so it adds nothing the distribution does not; native providers return their own confidence value, which can sit below the largest probability. Present for choice and score answers.
|
|
17
|
+
*/
|
|
18
|
+
confidence?: number | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Probability distribution over the options or levels. Present for choice and score answers.
|
|
21
|
+
*/
|
|
22
|
+
probabilities?: { [k: string]: number } | undefined;
|
|
23
|
+
type: "choice";
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** @internal */
|
|
27
|
+
export const ClassifyChoiceAnswer$inboundSchema: z.ZodType<
|
|
28
|
+
ClassifyChoiceAnswer,
|
|
29
|
+
z.ZodTypeDef,
|
|
30
|
+
unknown
|
|
31
|
+
> = z.object({
|
|
32
|
+
choice: z.string(),
|
|
33
|
+
confidence: z.number().optional(),
|
|
34
|
+
probabilities: z.record(z.number()).optional(),
|
|
35
|
+
type: z.literal("choice"),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export function classifyChoiceAnswerFromJSON(
|
|
39
|
+
jsonString: string,
|
|
40
|
+
): SafeParseResult<ClassifyChoiceAnswer, SDKValidationError> {
|
|
41
|
+
return safeParse(
|
|
42
|
+
jsonString,
|
|
43
|
+
(x) => ClassifyChoiceAnswer$inboundSchema.parse(JSON.parse(x)),
|
|
44
|
+
`Failed to parse 'ClassifyChoiceAnswer' from JSON`,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -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
|
+
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 ClassifyInputTokensDetails = {
|
|
12
|
+
/**
|
|
13
|
+
* Input tokens written to cache.
|
|
14
|
+
*/
|
|
15
|
+
cacheWriteTokens: number;
|
|
16
|
+
/**
|
|
17
|
+
* Input tokens read from cache.
|
|
18
|
+
*/
|
|
19
|
+
cachedTokens: number;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** @internal */
|
|
23
|
+
export const ClassifyInputTokensDetails$inboundSchema: z.ZodType<
|
|
24
|
+
ClassifyInputTokensDetails,
|
|
25
|
+
z.ZodTypeDef,
|
|
26
|
+
unknown
|
|
27
|
+
> = z.object({
|
|
28
|
+
cache_write_tokens: z.number().int(),
|
|
29
|
+
cached_tokens: z.number().int(),
|
|
30
|
+
}).transform((v) => {
|
|
31
|
+
return remap$(v, {
|
|
32
|
+
"cache_write_tokens": "cacheWriteTokens",
|
|
33
|
+
"cached_tokens": "cachedTokens",
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export function classifyInputTokensDetailsFromJSON(
|
|
38
|
+
jsonString: string,
|
|
39
|
+
): SafeParseResult<ClassifyInputTokensDetails, SDKValidationError> {
|
|
40
|
+
return safeParse(
|
|
41
|
+
jsonString,
|
|
42
|
+
(x) => ClassifyInputTokensDetails$inboundSchema.parse(JSON.parse(x)),
|
|
43
|
+
`Failed to parse 'ClassifyInputTokensDetails' from JSON`,
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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 { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type ClassifyNoulAnswer = {
|
|
11
|
+
/**
|
|
12
|
+
* Probability between 0 and 1 that the statement holds. Present for noul answers.
|
|
13
|
+
*/
|
|
14
|
+
noul: number;
|
|
15
|
+
type: "noul";
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const ClassifyNoulAnswer$inboundSchema: z.ZodType<
|
|
20
|
+
ClassifyNoulAnswer,
|
|
21
|
+
z.ZodTypeDef,
|
|
22
|
+
unknown
|
|
23
|
+
> = z.object({
|
|
24
|
+
noul: z.number(),
|
|
25
|
+
type: z.literal("noul"),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export function classifyNoulAnswerFromJSON(
|
|
29
|
+
jsonString: string,
|
|
30
|
+
): SafeParseResult<ClassifyNoulAnswer, SDKValidationError> {
|
|
31
|
+
return safeParse(
|
|
32
|
+
jsonString,
|
|
33
|
+
(x) => ClassifyNoulAnswer$inboundSchema.parse(JSON.parse(x)),
|
|
34
|
+
`Failed to parse 'ClassifyNoulAnswer' from JSON`,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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 { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type ClassifyRefusalAnswer = {
|
|
11
|
+
type: "refusal";
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const ClassifyRefusalAnswer$inboundSchema: z.ZodType<
|
|
16
|
+
ClassifyRefusalAnswer,
|
|
17
|
+
z.ZodTypeDef,
|
|
18
|
+
unknown
|
|
19
|
+
> = z.object({
|
|
20
|
+
type: z.literal("refusal"),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export function classifyRefusalAnswerFromJSON(
|
|
24
|
+
jsonString: string,
|
|
25
|
+
): SafeParseResult<ClassifyRefusalAnswer, SDKValidationError> {
|
|
26
|
+
return safeParse(
|
|
27
|
+
jsonString,
|
|
28
|
+
(x) => ClassifyRefusalAnswer$inboundSchema.parse(JSON.parse(x)),
|
|
29
|
+
`Failed to parse 'ClassifyRefusalAnswer' from JSON`,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -7,19 +7,19 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
7
7
|
|
|
8
8
|
export type ClassifyRetryConfig = {
|
|
9
9
|
/**
|
|
10
|
-
* Number of
|
|
10
|
+
* Number of retries per model after the initial attempt (1-5). No retries are made when retry is omitted.
|
|
11
11
|
*/
|
|
12
12
|
count: number;
|
|
13
13
|
/**
|
|
14
|
-
* HTTP status codes that trigger
|
|
14
|
+
* HTTP status codes that trigger retries, between 100 and 599. Retry-After is honored; otherwise the gateway waits one second.
|
|
15
15
|
*/
|
|
16
|
-
onCodes: Array<number
|
|
16
|
+
onCodes: Array<number>;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
/** @internal */
|
|
20
20
|
export type ClassifyRetryConfig$Outbound = {
|
|
21
21
|
count: number;
|
|
22
|
-
on_codes: Array<number
|
|
22
|
+
on_codes: Array<number>;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
/** @internal */
|
|
@@ -29,7 +29,7 @@ export const ClassifyRetryConfig$outboundSchema: z.ZodType<
|
|
|
29
29
|
ClassifyRetryConfig
|
|
30
30
|
> = z.object({
|
|
31
31
|
count: z.number().int(),
|
|
32
|
-
onCodes: z.
|
|
32
|
+
onCodes: z.array(z.number().int()),
|
|
33
33
|
}).transform((v) => {
|
|
34
34
|
return remap$(v, {
|
|
35
35
|
onCodes: "on_codes",
|
|
@@ -0,0 +1,51 @@
|
|
|
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 { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type ClassifyScoreAnswer = {
|
|
11
|
+
/**
|
|
12
|
+
* How sure the model is of the answer it selected: on emulated chat models the largest value in probabilities, so it adds nothing the distribution does not; native providers return their own confidence value, which can sit below the largest probability. Present for choice and score answers.
|
|
13
|
+
*/
|
|
14
|
+
confidence?: number | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Level index to level description. Present for score answers.
|
|
17
|
+
*/
|
|
18
|
+
legend?: { [k: string]: string } | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Probability distribution over the options or levels. Present for choice and score answers.
|
|
21
|
+
*/
|
|
22
|
+
probabilities?: { [k: string]: number } | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Position on the scale, not an index: on emulated chat models and OpenAI Decisions the weighted index, each level index multiplied by that level probability and summed, so the value is usually fractional; typesafe/jev-latest returns its own score. Present for score answers.
|
|
25
|
+
*/
|
|
26
|
+
score: number;
|
|
27
|
+
type: "score";
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
export const ClassifyScoreAnswer$inboundSchema: z.ZodType<
|
|
32
|
+
ClassifyScoreAnswer,
|
|
33
|
+
z.ZodTypeDef,
|
|
34
|
+
unknown
|
|
35
|
+
> = z.object({
|
|
36
|
+
confidence: z.number().optional(),
|
|
37
|
+
legend: z.record(z.string()).optional(),
|
|
38
|
+
probabilities: z.record(z.number()).optional(),
|
|
39
|
+
score: z.number(),
|
|
40
|
+
type: z.literal("score"),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export function classifyScoreAnswerFromJSON(
|
|
44
|
+
jsonString: string,
|
|
45
|
+
): SafeParseResult<ClassifyScoreAnswer, SDKValidationError> {
|
|
46
|
+
return safeParse(
|
|
47
|
+
jsonString,
|
|
48
|
+
(x) => ClassifyScoreAnswer$inboundSchema.parse(JSON.parse(x)),
|
|
49
|
+
`Failed to parse 'ClassifyScoreAnswer' from JSON`,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -7,6 +7,10 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
8
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
ClassifyInputTokensDetails,
|
|
12
|
+
ClassifyInputTokensDetails$inboundSchema,
|
|
13
|
+
} from "./classifyinputtokensdetails.js";
|
|
10
14
|
|
|
11
15
|
export type ClassifyUsage = {
|
|
12
16
|
/**
|
|
@@ -17,12 +21,13 @@ export type ClassifyUsage = {
|
|
|
17
21
|
* The number of input tokens processed.
|
|
18
22
|
*/
|
|
19
23
|
inputTokens: number;
|
|
24
|
+
inputTokensDetails?: ClassifyInputTokensDetails | undefined;
|
|
20
25
|
/**
|
|
21
|
-
* Cost (USD) of output tokens. 0 for
|
|
26
|
+
* Cost (USD) of output tokens. 0 for native classify providers, including OpenAI Decisions. Present when billing was computed for this request.
|
|
22
27
|
*/
|
|
23
28
|
outputCost?: number | undefined;
|
|
24
29
|
/**
|
|
25
|
-
* The number of output tokens generated. Free for
|
|
30
|
+
* The number of output tokens generated. Free for native classify providers, billed at the model rate for emulated chat models.
|
|
26
31
|
*/
|
|
27
32
|
outputTokens: number;
|
|
28
33
|
/**
|
|
@@ -39,6 +44,7 @@ export const ClassifyUsage$inboundSchema: z.ZodType<
|
|
|
39
44
|
> = z.object({
|
|
40
45
|
input_cost: z.number().optional(),
|
|
41
46
|
input_tokens: z.number().int(),
|
|
47
|
+
input_tokens_details: ClassifyInputTokensDetails$inboundSchema.optional(),
|
|
42
48
|
output_cost: z.number().optional(),
|
|
43
49
|
output_tokens: z.number().int(),
|
|
44
50
|
total_cost: z.number().optional(),
|
|
@@ -46,6 +52,7 @@ export const ClassifyUsage$inboundSchema: z.ZodType<
|
|
|
46
52
|
return remap$(v, {
|
|
47
53
|
"input_cost": "inputCost",
|
|
48
54
|
"input_tokens": "inputTokens",
|
|
55
|
+
"input_tokens_details": "inputTokensDetails",
|
|
49
56
|
"output_cost": "outputCost",
|
|
50
57
|
"output_tokens": "outputTokens",
|
|
51
58
|
"total_cost": "totalCost",
|
|
@@ -85,7 +85,12 @@ export * from "./chunksservicelistresponse.js";
|
|
|
85
85
|
export * from "./chunksservicesetenabledrequest.js";
|
|
86
86
|
export * from "./chunksserviceupdaterequest.js";
|
|
87
87
|
export * from "./classifyanswer.js";
|
|
88
|
+
export * from "./classifychoiceanswer.js";
|
|
89
|
+
export * from "./classifyinputtokensdetails.js";
|
|
90
|
+
export * from "./classifynoulanswer.js";
|
|
91
|
+
export * from "./classifyrefusalanswer.js";
|
|
88
92
|
export * from "./classifyretryconfig.js";
|
|
93
|
+
export * from "./classifyscoreanswer.js";
|
|
89
94
|
export * from "./classifyusage.js";
|
|
90
95
|
export * from "./codeinterpretertoolinput.js";
|
|
91
96
|
export * from "./codetoolinput.js";
|
|
@@ -125,6 +125,10 @@ export type Model = {
|
|
|
125
125
|
* date is known. `deprecation` carries the date when one is announced.
|
|
126
126
|
*/
|
|
127
127
|
deprecated: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* True when this offering guarantees zero data retention.
|
|
130
|
+
*/
|
|
131
|
+
zdr: boolean;
|
|
128
132
|
};
|
|
129
133
|
|
|
130
134
|
/** @internal */
|
|
@@ -184,6 +188,7 @@ export const Model$inboundSchema: z.ZodType<Model, z.ZodTypeDef, unknown> = z
|
|
|
184
188
|
.optional(),
|
|
185
189
|
features: z.array(z.string()),
|
|
186
190
|
deprecated: z.boolean(),
|
|
191
|
+
zdr: z.boolean(),
|
|
187
192
|
}).transform((v) => {
|
|
188
193
|
return remap$(v, {
|
|
189
194
|
"offering_of": "offeringOf",
|