@orq-ai/node 4.16.0-rc.57 → 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/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/createtool.js +4 -4
- package/models/operations/getalltools.js +4 -4
- 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/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/updatetool.js +4 -4
- package/package.json +3 -3
- 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/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/createtool.ts +4 -4
- package/src/models/operations/getalltools.ts +4 -4
- 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/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/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
|
@@ -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",
|
|
@@ -121,6 +121,7 @@ export type ModelMetadata = {
|
|
|
121
121
|
supportsJsonModeResponseFormat?: boolean | undefined;
|
|
122
122
|
supportsJsonSchemaResponseFormat?: boolean | undefined;
|
|
123
123
|
supportsMaxCompletionTokens?: boolean | undefined;
|
|
124
|
+
supportsNativeClassify?: boolean | undefined;
|
|
124
125
|
supportsOpenaiRealtimeApi?: boolean | undefined;
|
|
125
126
|
supportsOpenaiSDK?: boolean | undefined;
|
|
126
127
|
supportsParallelToolCalls?: boolean | undefined;
|
|
@@ -257,6 +258,7 @@ export const ModelMetadata$inboundSchema: z.ZodType<
|
|
|
257
258
|
supports_json_mode_response_format: z.boolean().optional(),
|
|
258
259
|
supports_json_schema_response_format: z.boolean().optional(),
|
|
259
260
|
supports_max_completion_tokens: z.boolean().optional(),
|
|
261
|
+
supports_native_classify: z.boolean().optional(),
|
|
260
262
|
supports_openai_realtime_api: z.boolean().optional(),
|
|
261
263
|
supports_openai_sdk: z.boolean().optional(),
|
|
262
264
|
supports_parallel_tool_calls: z.boolean().optional(),
|
|
@@ -384,6 +386,7 @@ export const ModelMetadata$inboundSchema: z.ZodType<
|
|
|
384
386
|
"supports_json_mode_response_format": "supportsJsonModeResponseFormat",
|
|
385
387
|
"supports_json_schema_response_format": "supportsJsonSchemaResponseFormat",
|
|
386
388
|
"supports_max_completion_tokens": "supportsMaxCompletionTokens",
|
|
389
|
+
"supports_native_classify": "supportsNativeClassify",
|
|
387
390
|
"supports_openai_realtime_api": "supportsOpenaiRealtimeApi",
|
|
388
391
|
"supports_openai_sdk": "supportsOpenaiSDK",
|
|
389
392
|
"supports_parallel_tool_calls": "supportsParallelToolCalls",
|
|
@@ -517,6 +520,7 @@ export type ModelMetadata$Outbound = {
|
|
|
517
520
|
supports_json_mode_response_format?: boolean | undefined;
|
|
518
521
|
supports_json_schema_response_format?: boolean | undefined;
|
|
519
522
|
supports_max_completion_tokens?: boolean | undefined;
|
|
523
|
+
supports_native_classify?: boolean | undefined;
|
|
520
524
|
supports_openai_realtime_api?: boolean | undefined;
|
|
521
525
|
supports_openai_sdk?: boolean | undefined;
|
|
522
526
|
supports_parallel_tool_calls?: boolean | undefined;
|
|
@@ -653,6 +657,7 @@ export const ModelMetadata$outboundSchema: z.ZodType<
|
|
|
653
657
|
supportsJsonModeResponseFormat: z.boolean().optional(),
|
|
654
658
|
supportsJsonSchemaResponseFormat: z.boolean().optional(),
|
|
655
659
|
supportsMaxCompletionTokens: z.boolean().optional(),
|
|
660
|
+
supportsNativeClassify: z.boolean().optional(),
|
|
656
661
|
supportsOpenaiRealtimeApi: z.boolean().optional(),
|
|
657
662
|
supportsOpenaiSDK: z.boolean().optional(),
|
|
658
663
|
supportsParallelToolCalls: z.boolean().optional(),
|
|
@@ -780,6 +785,7 @@ export const ModelMetadata$outboundSchema: z.ZodType<
|
|
|
780
785
|
supportsJsonModeResponseFormat: "supports_json_mode_response_format",
|
|
781
786
|
supportsJsonSchemaResponseFormat: "supports_json_schema_response_format",
|
|
782
787
|
supportsMaxCompletionTokens: "supports_max_completion_tokens",
|
|
788
|
+
supportsNativeClassify: "supports_native_classify",
|
|
783
789
|
supportsOpenaiRealtimeApi: "supports_openai_realtime_api",
|
|
784
790
|
supportsOpenaiSDK: "supports_openai_sdk",
|
|
785
791
|
supportsParallelToolCalls: "supports_parallel_tool_calls",
|
|
@@ -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_01m4at2ckzmnw0rac1fqcsec9c"),
|
|
44
44
|
metadata: z.record(z.any()).optional(),
|
|
45
45
|
kind: z.literal("reasoning"),
|
|
46
46
|
reasoning: z.string(),
|