@flop-labs/contracts 0.0.0-stage → 0.1.1
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/CHANGELOG.md +41 -0
- package/LICENSE +238 -0
- package/README.md +58 -2
- package/dist/generated/schemas.d.ts +4897 -0
- package/dist/generated/schemas.d.ts.map +1 -0
- package/dist/generated/schemas.js +725 -0
- package/dist/generated/schemas.js.map +1 -0
- package/dist/generated/types.d.ts +250 -0
- package/dist/generated/types.d.ts.map +1 -0
- package/dist/generated/types.js +3 -0
- package/dist/generated/types.js.map +1 -0
- package/dist/generated/validators.d.ts +56 -0
- package/dist/generated/validators.d.ts.map +1 -0
- package/dist/generated/validators.js +4147 -0
- package/dist/generated/validators.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/validation.d.ts +16 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +46 -0
- package/dist/validation.js.map +1 -0
- package/package.json +43 -3
|
@@ -0,0 +1,4147 @@
|
|
|
1
|
+
// Generated from services/rest-gateway/openapi.yaml. Run pnpm --filter @flop-labs/contracts generate.
|
|
2
|
+
"use strict";
|
|
3
|
+
export const validateModel = validate21;
|
|
4
|
+
const schema32 = { "type": "object", "required": ["id", "canonical_slug", "name", "created", "context_length", "architecture", "pricing", "top_provider", "supported_parameters"], "properties": { "id": { "type": "string" }, "canonical_slug": { "type": "string" }, "name": { "type": "string" }, "created": { "type": "integer" }, "description": { "type": "string" }, "context_length": { "type": "integer" }, "architecture": { "type": "object", "required": ["input_modalities", "output_modalities"], "properties": { "input_modalities": { "type": "array", "items": { "type": "string" } }, "output_modalities": { "type": "array", "items": { "type": "string" } }, "tokenizer": { "type": "string" }, "instruct_type": { "type": ["string", "null"] } } }, "pricing": { "type": "object", "required": ["prompt", "completion"], "properties": { "prompt": { "type": "string" }, "completion": { "type": "string" }, "request": { "type": "string" }, "image": { "type": "string" }, "input_cache_read": { "type": "string" }, "internal_reasoning": { "type": "string" } } }, "top_provider": { "type": "object", "required": ["context_length", "max_completion_tokens", "is_moderated"], "properties": { "context_length": { "type": "integer" }, "max_completion_tokens": { "type": "integer" }, "is_moderated": { "type": "boolean" } } }, "supported_parameters": { "type": "array", "items": { "type": "string" } } } };
|
|
5
|
+
function validate21(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
6
|
+
let vErrors = null;
|
|
7
|
+
let errors = 0;
|
|
8
|
+
const evaluated0 = validate21.evaluated;
|
|
9
|
+
if (evaluated0.dynamicProps) {
|
|
10
|
+
evaluated0.props = undefined;
|
|
11
|
+
}
|
|
12
|
+
if (evaluated0.dynamicItems) {
|
|
13
|
+
evaluated0.items = undefined;
|
|
14
|
+
}
|
|
15
|
+
if (errors === 0) {
|
|
16
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
17
|
+
let missing0;
|
|
18
|
+
if ((((((((((data.id === undefined) && (missing0 = "id")) || ((data.canonical_slug === undefined) && (missing0 = "canonical_slug"))) || ((data.name === undefined) && (missing0 = "name"))) || ((data.created === undefined) && (missing0 = "created"))) || ((data.context_length === undefined) && (missing0 = "context_length"))) || ((data.architecture === undefined) && (missing0 = "architecture"))) || ((data.pricing === undefined) && (missing0 = "pricing"))) || ((data.top_provider === undefined) && (missing0 = "top_provider"))) || ((data.supported_parameters === undefined) && (missing0 = "supported_parameters"))) {
|
|
19
|
+
validate21.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
if (data.id !== undefined) {
|
|
24
|
+
const _errs1 = errors;
|
|
25
|
+
if (typeof data.id !== "string") {
|
|
26
|
+
validate21.errors = [{ instancePath: instancePath + "/id", schemaPath: "#/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
var valid0 = _errs1 === errors;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
var valid0 = true;
|
|
33
|
+
}
|
|
34
|
+
if (valid0) {
|
|
35
|
+
if (data.canonical_slug !== undefined) {
|
|
36
|
+
const _errs3 = errors;
|
|
37
|
+
if (typeof data.canonical_slug !== "string") {
|
|
38
|
+
validate21.errors = [{ instancePath: instancePath + "/canonical_slug", schemaPath: "#/properties/canonical_slug/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
var valid0 = _errs3 === errors;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
var valid0 = true;
|
|
45
|
+
}
|
|
46
|
+
if (valid0) {
|
|
47
|
+
if (data.name !== undefined) {
|
|
48
|
+
const _errs5 = errors;
|
|
49
|
+
if (typeof data.name !== "string") {
|
|
50
|
+
validate21.errors = [{ instancePath: instancePath + "/name", schemaPath: "#/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
var valid0 = _errs5 === errors;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
var valid0 = true;
|
|
57
|
+
}
|
|
58
|
+
if (valid0) {
|
|
59
|
+
if (data.created !== undefined) {
|
|
60
|
+
let data3 = data.created;
|
|
61
|
+
const _errs7 = errors;
|
|
62
|
+
if (!(((typeof data3 == "number") && (!(data3 % 1) && !isNaN(data3))) && (isFinite(data3)))) {
|
|
63
|
+
validate21.errors = [{ instancePath: instancePath + "/created", schemaPath: "#/properties/created/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
var valid0 = _errs7 === errors;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
var valid0 = true;
|
|
70
|
+
}
|
|
71
|
+
if (valid0) {
|
|
72
|
+
if (data.description !== undefined) {
|
|
73
|
+
const _errs9 = errors;
|
|
74
|
+
if (typeof data.description !== "string") {
|
|
75
|
+
validate21.errors = [{ instancePath: instancePath + "/description", schemaPath: "#/properties/description/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
var valid0 = _errs9 === errors;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
var valid0 = true;
|
|
82
|
+
}
|
|
83
|
+
if (valid0) {
|
|
84
|
+
if (data.context_length !== undefined) {
|
|
85
|
+
let data5 = data.context_length;
|
|
86
|
+
const _errs11 = errors;
|
|
87
|
+
if (!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))) {
|
|
88
|
+
validate21.errors = [{ instancePath: instancePath + "/context_length", schemaPath: "#/properties/context_length/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
var valid0 = _errs11 === errors;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
var valid0 = true;
|
|
95
|
+
}
|
|
96
|
+
if (valid0) {
|
|
97
|
+
if (data.architecture !== undefined) {
|
|
98
|
+
let data6 = data.architecture;
|
|
99
|
+
const _errs13 = errors;
|
|
100
|
+
if (errors === _errs13) {
|
|
101
|
+
if (data6 && typeof data6 == "object" && !Array.isArray(data6)) {
|
|
102
|
+
let missing1;
|
|
103
|
+
if (((data6.input_modalities === undefined) && (missing1 = "input_modalities")) || ((data6.output_modalities === undefined) && (missing1 = "output_modalities"))) {
|
|
104
|
+
validate21.errors = [{ instancePath: instancePath + "/architecture", schemaPath: "#/properties/architecture/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
if (data6.input_modalities !== undefined) {
|
|
109
|
+
let data7 = data6.input_modalities;
|
|
110
|
+
const _errs15 = errors;
|
|
111
|
+
if (errors === _errs15) {
|
|
112
|
+
if (Array.isArray(data7)) {
|
|
113
|
+
var valid2 = true;
|
|
114
|
+
const len0 = data7.length;
|
|
115
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
116
|
+
const _errs17 = errors;
|
|
117
|
+
if (typeof data7[i0] !== "string") {
|
|
118
|
+
validate21.errors = [{ instancePath: instancePath + "/architecture/input_modalities/" + i0, schemaPath: "#/properties/architecture/properties/input_modalities/items/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
var valid2 = _errs17 === errors;
|
|
122
|
+
if (!valid2) {
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
validate21.errors = [{ instancePath: instancePath + "/architecture/input_modalities", schemaPath: "#/properties/architecture/properties/input_modalities/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
var valid1 = _errs15 === errors;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
var valid1 = true;
|
|
136
|
+
}
|
|
137
|
+
if (valid1) {
|
|
138
|
+
if (data6.output_modalities !== undefined) {
|
|
139
|
+
let data9 = data6.output_modalities;
|
|
140
|
+
const _errs19 = errors;
|
|
141
|
+
if (errors === _errs19) {
|
|
142
|
+
if (Array.isArray(data9)) {
|
|
143
|
+
var valid3 = true;
|
|
144
|
+
const len1 = data9.length;
|
|
145
|
+
for (let i1 = 0; i1 < len1; i1++) {
|
|
146
|
+
const _errs21 = errors;
|
|
147
|
+
if (typeof data9[i1] !== "string") {
|
|
148
|
+
validate21.errors = [{ instancePath: instancePath + "/architecture/output_modalities/" + i1, schemaPath: "#/properties/architecture/properties/output_modalities/items/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
var valid3 = _errs21 === errors;
|
|
152
|
+
if (!valid3) {
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
validate21.errors = [{ instancePath: instancePath + "/architecture/output_modalities", schemaPath: "#/properties/architecture/properties/output_modalities/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
var valid1 = _errs19 === errors;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
var valid1 = true;
|
|
166
|
+
}
|
|
167
|
+
if (valid1) {
|
|
168
|
+
if (data6.tokenizer !== undefined) {
|
|
169
|
+
const _errs23 = errors;
|
|
170
|
+
if (typeof data6.tokenizer !== "string") {
|
|
171
|
+
validate21.errors = [{ instancePath: instancePath + "/architecture/tokenizer", schemaPath: "#/properties/architecture/properties/tokenizer/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
var valid1 = _errs23 === errors;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
var valid1 = true;
|
|
178
|
+
}
|
|
179
|
+
if (valid1) {
|
|
180
|
+
if (data6.instruct_type !== undefined) {
|
|
181
|
+
let data12 = data6.instruct_type;
|
|
182
|
+
const _errs25 = errors;
|
|
183
|
+
if ((typeof data12 !== "string") && (data12 !== null)) {
|
|
184
|
+
validate21.errors = [{ instancePath: instancePath + "/architecture/instruct_type", schemaPath: "#/properties/architecture/properties/instruct_type/type", keyword: "type", params: { type: schema32.properties.architecture.properties.instruct_type.type }, message: "must be string,null" }];
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
var valid1 = _errs25 === errors;
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
var valid1 = true;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
validate21.errors = [{ instancePath: instancePath + "/architecture", schemaPath: "#/properties/architecture/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
var valid0 = _errs13 === errors;
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
var valid0 = true;
|
|
206
|
+
}
|
|
207
|
+
if (valid0) {
|
|
208
|
+
if (data.pricing !== undefined) {
|
|
209
|
+
let data13 = data.pricing;
|
|
210
|
+
const _errs27 = errors;
|
|
211
|
+
if (errors === _errs27) {
|
|
212
|
+
if (data13 && typeof data13 == "object" && !Array.isArray(data13)) {
|
|
213
|
+
let missing2;
|
|
214
|
+
if (((data13.prompt === undefined) && (missing2 = "prompt")) || ((data13.completion === undefined) && (missing2 = "completion"))) {
|
|
215
|
+
validate21.errors = [{ instancePath: instancePath + "/pricing", schemaPath: "#/properties/pricing/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" }];
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
if (data13.prompt !== undefined) {
|
|
220
|
+
const _errs29 = errors;
|
|
221
|
+
if (typeof data13.prompt !== "string") {
|
|
222
|
+
validate21.errors = [{ instancePath: instancePath + "/pricing/prompt", schemaPath: "#/properties/pricing/properties/prompt/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
var valid4 = _errs29 === errors;
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
var valid4 = true;
|
|
229
|
+
}
|
|
230
|
+
if (valid4) {
|
|
231
|
+
if (data13.completion !== undefined) {
|
|
232
|
+
const _errs31 = errors;
|
|
233
|
+
if (typeof data13.completion !== "string") {
|
|
234
|
+
validate21.errors = [{ instancePath: instancePath + "/pricing/completion", schemaPath: "#/properties/pricing/properties/completion/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
var valid4 = _errs31 === errors;
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
var valid4 = true;
|
|
241
|
+
}
|
|
242
|
+
if (valid4) {
|
|
243
|
+
if (data13.request !== undefined) {
|
|
244
|
+
const _errs33 = errors;
|
|
245
|
+
if (typeof data13.request !== "string") {
|
|
246
|
+
validate21.errors = [{ instancePath: instancePath + "/pricing/request", schemaPath: "#/properties/pricing/properties/request/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
var valid4 = _errs33 === errors;
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
var valid4 = true;
|
|
253
|
+
}
|
|
254
|
+
if (valid4) {
|
|
255
|
+
if (data13.image !== undefined) {
|
|
256
|
+
const _errs35 = errors;
|
|
257
|
+
if (typeof data13.image !== "string") {
|
|
258
|
+
validate21.errors = [{ instancePath: instancePath + "/pricing/image", schemaPath: "#/properties/pricing/properties/image/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
var valid4 = _errs35 === errors;
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
var valid4 = true;
|
|
265
|
+
}
|
|
266
|
+
if (valid4) {
|
|
267
|
+
if (data13.input_cache_read !== undefined) {
|
|
268
|
+
const _errs37 = errors;
|
|
269
|
+
if (typeof data13.input_cache_read !== "string") {
|
|
270
|
+
validate21.errors = [{ instancePath: instancePath + "/pricing/input_cache_read", schemaPath: "#/properties/pricing/properties/input_cache_read/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
var valid4 = _errs37 === errors;
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
var valid4 = true;
|
|
277
|
+
}
|
|
278
|
+
if (valid4) {
|
|
279
|
+
if (data13.internal_reasoning !== undefined) {
|
|
280
|
+
const _errs39 = errors;
|
|
281
|
+
if (typeof data13.internal_reasoning !== "string") {
|
|
282
|
+
validate21.errors = [{ instancePath: instancePath + "/pricing/internal_reasoning", schemaPath: "#/properties/pricing/properties/internal_reasoning/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
var valid4 = _errs39 === errors;
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
var valid4 = true;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
validate21.errors = [{ instancePath: instancePath + "/pricing", schemaPath: "#/properties/pricing/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
var valid0 = _errs27 === errors;
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
var valid0 = true;
|
|
306
|
+
}
|
|
307
|
+
if (valid0) {
|
|
308
|
+
if (data.top_provider !== undefined) {
|
|
309
|
+
let data20 = data.top_provider;
|
|
310
|
+
const _errs41 = errors;
|
|
311
|
+
if (errors === _errs41) {
|
|
312
|
+
if (data20 && typeof data20 == "object" && !Array.isArray(data20)) {
|
|
313
|
+
let missing3;
|
|
314
|
+
if ((((data20.context_length === undefined) && (missing3 = "context_length")) || ((data20.max_completion_tokens === undefined) && (missing3 = "max_completion_tokens"))) || ((data20.is_moderated === undefined) && (missing3 = "is_moderated"))) {
|
|
315
|
+
validate21.errors = [{ instancePath: instancePath + "/top_provider", schemaPath: "#/properties/top_provider/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" }];
|
|
316
|
+
return false;
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
if (data20.context_length !== undefined) {
|
|
320
|
+
let data21 = data20.context_length;
|
|
321
|
+
const _errs43 = errors;
|
|
322
|
+
if (!(((typeof data21 == "number") && (!(data21 % 1) && !isNaN(data21))) && (isFinite(data21)))) {
|
|
323
|
+
validate21.errors = [{ instancePath: instancePath + "/top_provider/context_length", schemaPath: "#/properties/top_provider/properties/context_length/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
var valid5 = _errs43 === errors;
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
var valid5 = true;
|
|
330
|
+
}
|
|
331
|
+
if (valid5) {
|
|
332
|
+
if (data20.max_completion_tokens !== undefined) {
|
|
333
|
+
let data22 = data20.max_completion_tokens;
|
|
334
|
+
const _errs45 = errors;
|
|
335
|
+
if (!(((typeof data22 == "number") && (!(data22 % 1) && !isNaN(data22))) && (isFinite(data22)))) {
|
|
336
|
+
validate21.errors = [{ instancePath: instancePath + "/top_provider/max_completion_tokens", schemaPath: "#/properties/top_provider/properties/max_completion_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
var valid5 = _errs45 === errors;
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
var valid5 = true;
|
|
343
|
+
}
|
|
344
|
+
if (valid5) {
|
|
345
|
+
if (data20.is_moderated !== undefined) {
|
|
346
|
+
const _errs47 = errors;
|
|
347
|
+
if (typeof data20.is_moderated !== "boolean") {
|
|
348
|
+
validate21.errors = [{ instancePath: instancePath + "/top_provider/is_moderated", schemaPath: "#/properties/top_provider/properties/is_moderated/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" }];
|
|
349
|
+
return false;
|
|
350
|
+
}
|
|
351
|
+
var valid5 = _errs47 === errors;
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
var valid5 = true;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
validate21.errors = [{ instancePath: instancePath + "/top_provider", schemaPath: "#/properties/top_provider/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
362
|
+
return false;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
var valid0 = _errs41 === errors;
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
var valid0 = true;
|
|
369
|
+
}
|
|
370
|
+
if (valid0) {
|
|
371
|
+
if (data.supported_parameters !== undefined) {
|
|
372
|
+
let data24 = data.supported_parameters;
|
|
373
|
+
const _errs49 = errors;
|
|
374
|
+
if (errors === _errs49) {
|
|
375
|
+
if (Array.isArray(data24)) {
|
|
376
|
+
var valid6 = true;
|
|
377
|
+
const len2 = data24.length;
|
|
378
|
+
for (let i2 = 0; i2 < len2; i2++) {
|
|
379
|
+
const _errs51 = errors;
|
|
380
|
+
if (typeof data24[i2] !== "string") {
|
|
381
|
+
validate21.errors = [{ instancePath: instancePath + "/supported_parameters/" + i2, schemaPath: "#/properties/supported_parameters/items/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
var valid6 = _errs51 === errors;
|
|
385
|
+
if (!valid6) {
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
validate21.errors = [{ instancePath: instancePath + "/supported_parameters", schemaPath: "#/properties/supported_parameters/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
var valid0 = _errs49 === errors;
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
var valid0 = true;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
validate21.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
validate21.errors = vErrors;
|
|
417
|
+
return errors === 0;
|
|
418
|
+
}
|
|
419
|
+
validate21.evaluated = { "props": { "id": true, "canonical_slug": true, "name": true, "created": true, "description": true, "context_length": true, "architecture": true, "pricing": true, "top_provider": true, "supported_parameters": true }, "dynamicProps": false, "dynamicItems": false };
|
|
420
|
+
export const validateModelList = validate22;
|
|
421
|
+
const schema33 = { "type": "object", "required": ["data", "total_count", "links"], "properties": { "data": { "type": "array", "items": { "$ref": "#/$defs/Model" } }, "total_count": { "type": "integer" }, "links": { "type": "object", "required": ["next"], "properties": { "next": { "type": ["string", "null"] } } } } };
|
|
422
|
+
function validate22(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
423
|
+
let vErrors = null;
|
|
424
|
+
let errors = 0;
|
|
425
|
+
const evaluated0 = validate22.evaluated;
|
|
426
|
+
if (evaluated0.dynamicProps) {
|
|
427
|
+
evaluated0.props = undefined;
|
|
428
|
+
}
|
|
429
|
+
if (evaluated0.dynamicItems) {
|
|
430
|
+
evaluated0.items = undefined;
|
|
431
|
+
}
|
|
432
|
+
if (errors === 0) {
|
|
433
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
434
|
+
let missing0;
|
|
435
|
+
if ((((data.data === undefined) && (missing0 = "data")) || ((data.total_count === undefined) && (missing0 = "total_count"))) || ((data.links === undefined) && (missing0 = "links"))) {
|
|
436
|
+
validate22.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
437
|
+
return false;
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
if (data.data !== undefined) {
|
|
441
|
+
let data0 = data.data;
|
|
442
|
+
const _errs1 = errors;
|
|
443
|
+
if (errors === _errs1) {
|
|
444
|
+
if (Array.isArray(data0)) {
|
|
445
|
+
var valid1 = true;
|
|
446
|
+
const len0 = data0.length;
|
|
447
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
448
|
+
let data1 = data0[i0];
|
|
449
|
+
const _errs3 = errors;
|
|
450
|
+
const _errs4 = errors;
|
|
451
|
+
if (errors === _errs4) {
|
|
452
|
+
if (data1 && typeof data1 == "object" && !Array.isArray(data1)) {
|
|
453
|
+
let missing1;
|
|
454
|
+
if ((((((((((data1.id === undefined) && (missing1 = "id")) || ((data1.canonical_slug === undefined) && (missing1 = "canonical_slug"))) || ((data1.name === undefined) && (missing1 = "name"))) || ((data1.created === undefined) && (missing1 = "created"))) || ((data1.context_length === undefined) && (missing1 = "context_length"))) || ((data1.architecture === undefined) && (missing1 = "architecture"))) || ((data1.pricing === undefined) && (missing1 = "pricing"))) || ((data1.top_provider === undefined) && (missing1 = "top_provider"))) || ((data1.supported_parameters === undefined) && (missing1 = "supported_parameters"))) {
|
|
455
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0, schemaPath: "#/$defs/Model/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
|
|
456
|
+
return false;
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
if (data1.id !== undefined) {
|
|
460
|
+
const _errs6 = errors;
|
|
461
|
+
if (typeof data1.id !== "string") {
|
|
462
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/id", schemaPath: "#/$defs/Model/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
465
|
+
var valid3 = _errs6 === errors;
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
var valid3 = true;
|
|
469
|
+
}
|
|
470
|
+
if (valid3) {
|
|
471
|
+
if (data1.canonical_slug !== undefined) {
|
|
472
|
+
const _errs8 = errors;
|
|
473
|
+
if (typeof data1.canonical_slug !== "string") {
|
|
474
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/canonical_slug", schemaPath: "#/$defs/Model/properties/canonical_slug/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
477
|
+
var valid3 = _errs8 === errors;
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
var valid3 = true;
|
|
481
|
+
}
|
|
482
|
+
if (valid3) {
|
|
483
|
+
if (data1.name !== undefined) {
|
|
484
|
+
const _errs10 = errors;
|
|
485
|
+
if (typeof data1.name !== "string") {
|
|
486
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/name", schemaPath: "#/$defs/Model/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
487
|
+
return false;
|
|
488
|
+
}
|
|
489
|
+
var valid3 = _errs10 === errors;
|
|
490
|
+
}
|
|
491
|
+
else {
|
|
492
|
+
var valid3 = true;
|
|
493
|
+
}
|
|
494
|
+
if (valid3) {
|
|
495
|
+
if (data1.created !== undefined) {
|
|
496
|
+
let data5 = data1.created;
|
|
497
|
+
const _errs12 = errors;
|
|
498
|
+
if (!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))) {
|
|
499
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/created", schemaPath: "#/$defs/Model/properties/created/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
500
|
+
return false;
|
|
501
|
+
}
|
|
502
|
+
var valid3 = _errs12 === errors;
|
|
503
|
+
}
|
|
504
|
+
else {
|
|
505
|
+
var valid3 = true;
|
|
506
|
+
}
|
|
507
|
+
if (valid3) {
|
|
508
|
+
if (data1.description !== undefined) {
|
|
509
|
+
const _errs14 = errors;
|
|
510
|
+
if (typeof data1.description !== "string") {
|
|
511
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/description", schemaPath: "#/$defs/Model/properties/description/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
512
|
+
return false;
|
|
513
|
+
}
|
|
514
|
+
var valid3 = _errs14 === errors;
|
|
515
|
+
}
|
|
516
|
+
else {
|
|
517
|
+
var valid3 = true;
|
|
518
|
+
}
|
|
519
|
+
if (valid3) {
|
|
520
|
+
if (data1.context_length !== undefined) {
|
|
521
|
+
let data7 = data1.context_length;
|
|
522
|
+
const _errs16 = errors;
|
|
523
|
+
if (!(((typeof data7 == "number") && (!(data7 % 1) && !isNaN(data7))) && (isFinite(data7)))) {
|
|
524
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/context_length", schemaPath: "#/$defs/Model/properties/context_length/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
525
|
+
return false;
|
|
526
|
+
}
|
|
527
|
+
var valid3 = _errs16 === errors;
|
|
528
|
+
}
|
|
529
|
+
else {
|
|
530
|
+
var valid3 = true;
|
|
531
|
+
}
|
|
532
|
+
if (valid3) {
|
|
533
|
+
if (data1.architecture !== undefined) {
|
|
534
|
+
let data8 = data1.architecture;
|
|
535
|
+
const _errs18 = errors;
|
|
536
|
+
if (errors === _errs18) {
|
|
537
|
+
if (data8 && typeof data8 == "object" && !Array.isArray(data8)) {
|
|
538
|
+
let missing2;
|
|
539
|
+
if (((data8.input_modalities === undefined) && (missing2 = "input_modalities")) || ((data8.output_modalities === undefined) && (missing2 = "output_modalities"))) {
|
|
540
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/architecture", schemaPath: "#/$defs/Model/properties/architecture/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" }];
|
|
541
|
+
return false;
|
|
542
|
+
}
|
|
543
|
+
else {
|
|
544
|
+
if (data8.input_modalities !== undefined) {
|
|
545
|
+
let data9 = data8.input_modalities;
|
|
546
|
+
const _errs20 = errors;
|
|
547
|
+
if (errors === _errs20) {
|
|
548
|
+
if (Array.isArray(data9)) {
|
|
549
|
+
var valid5 = true;
|
|
550
|
+
const len1 = data9.length;
|
|
551
|
+
for (let i1 = 0; i1 < len1; i1++) {
|
|
552
|
+
const _errs22 = errors;
|
|
553
|
+
if (typeof data9[i1] !== "string") {
|
|
554
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/architecture/input_modalities/" + i1, schemaPath: "#/$defs/Model/properties/architecture/properties/input_modalities/items/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
555
|
+
return false;
|
|
556
|
+
}
|
|
557
|
+
var valid5 = _errs22 === errors;
|
|
558
|
+
if (!valid5) {
|
|
559
|
+
break;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
else {
|
|
564
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/architecture/input_modalities", schemaPath: "#/$defs/Model/properties/architecture/properties/input_modalities/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
565
|
+
return false;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
var valid4 = _errs20 === errors;
|
|
569
|
+
}
|
|
570
|
+
else {
|
|
571
|
+
var valid4 = true;
|
|
572
|
+
}
|
|
573
|
+
if (valid4) {
|
|
574
|
+
if (data8.output_modalities !== undefined) {
|
|
575
|
+
let data11 = data8.output_modalities;
|
|
576
|
+
const _errs24 = errors;
|
|
577
|
+
if (errors === _errs24) {
|
|
578
|
+
if (Array.isArray(data11)) {
|
|
579
|
+
var valid6 = true;
|
|
580
|
+
const len2 = data11.length;
|
|
581
|
+
for (let i2 = 0; i2 < len2; i2++) {
|
|
582
|
+
const _errs26 = errors;
|
|
583
|
+
if (typeof data11[i2] !== "string") {
|
|
584
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/architecture/output_modalities/" + i2, schemaPath: "#/$defs/Model/properties/architecture/properties/output_modalities/items/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
585
|
+
return false;
|
|
586
|
+
}
|
|
587
|
+
var valid6 = _errs26 === errors;
|
|
588
|
+
if (!valid6) {
|
|
589
|
+
break;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
else {
|
|
594
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/architecture/output_modalities", schemaPath: "#/$defs/Model/properties/architecture/properties/output_modalities/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
595
|
+
return false;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
var valid4 = _errs24 === errors;
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
var valid4 = true;
|
|
602
|
+
}
|
|
603
|
+
if (valid4) {
|
|
604
|
+
if (data8.tokenizer !== undefined) {
|
|
605
|
+
const _errs28 = errors;
|
|
606
|
+
if (typeof data8.tokenizer !== "string") {
|
|
607
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/architecture/tokenizer", schemaPath: "#/$defs/Model/properties/architecture/properties/tokenizer/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
608
|
+
return false;
|
|
609
|
+
}
|
|
610
|
+
var valid4 = _errs28 === errors;
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
var valid4 = true;
|
|
614
|
+
}
|
|
615
|
+
if (valid4) {
|
|
616
|
+
if (data8.instruct_type !== undefined) {
|
|
617
|
+
let data14 = data8.instruct_type;
|
|
618
|
+
const _errs30 = errors;
|
|
619
|
+
if ((typeof data14 !== "string") && (data14 !== null)) {
|
|
620
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/architecture/instruct_type", schemaPath: "#/$defs/Model/properties/architecture/properties/instruct_type/type", keyword: "type", params: { type: schema32.properties.architecture.properties.instruct_type.type }, message: "must be string,null" }];
|
|
621
|
+
return false;
|
|
622
|
+
}
|
|
623
|
+
var valid4 = _errs30 === errors;
|
|
624
|
+
}
|
|
625
|
+
else {
|
|
626
|
+
var valid4 = true;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
else {
|
|
634
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/architecture", schemaPath: "#/$defs/Model/properties/architecture/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
635
|
+
return false;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
var valid3 = _errs18 === errors;
|
|
639
|
+
}
|
|
640
|
+
else {
|
|
641
|
+
var valid3 = true;
|
|
642
|
+
}
|
|
643
|
+
if (valid3) {
|
|
644
|
+
if (data1.pricing !== undefined) {
|
|
645
|
+
let data15 = data1.pricing;
|
|
646
|
+
const _errs32 = errors;
|
|
647
|
+
if (errors === _errs32) {
|
|
648
|
+
if (data15 && typeof data15 == "object" && !Array.isArray(data15)) {
|
|
649
|
+
let missing3;
|
|
650
|
+
if (((data15.prompt === undefined) && (missing3 = "prompt")) || ((data15.completion === undefined) && (missing3 = "completion"))) {
|
|
651
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/pricing", schemaPath: "#/$defs/Model/properties/pricing/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" }];
|
|
652
|
+
return false;
|
|
653
|
+
}
|
|
654
|
+
else {
|
|
655
|
+
if (data15.prompt !== undefined) {
|
|
656
|
+
const _errs34 = errors;
|
|
657
|
+
if (typeof data15.prompt !== "string") {
|
|
658
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/pricing/prompt", schemaPath: "#/$defs/Model/properties/pricing/properties/prompt/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
659
|
+
return false;
|
|
660
|
+
}
|
|
661
|
+
var valid7 = _errs34 === errors;
|
|
662
|
+
}
|
|
663
|
+
else {
|
|
664
|
+
var valid7 = true;
|
|
665
|
+
}
|
|
666
|
+
if (valid7) {
|
|
667
|
+
if (data15.completion !== undefined) {
|
|
668
|
+
const _errs36 = errors;
|
|
669
|
+
if (typeof data15.completion !== "string") {
|
|
670
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/pricing/completion", schemaPath: "#/$defs/Model/properties/pricing/properties/completion/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
671
|
+
return false;
|
|
672
|
+
}
|
|
673
|
+
var valid7 = _errs36 === errors;
|
|
674
|
+
}
|
|
675
|
+
else {
|
|
676
|
+
var valid7 = true;
|
|
677
|
+
}
|
|
678
|
+
if (valid7) {
|
|
679
|
+
if (data15.request !== undefined) {
|
|
680
|
+
const _errs38 = errors;
|
|
681
|
+
if (typeof data15.request !== "string") {
|
|
682
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/pricing/request", schemaPath: "#/$defs/Model/properties/pricing/properties/request/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
683
|
+
return false;
|
|
684
|
+
}
|
|
685
|
+
var valid7 = _errs38 === errors;
|
|
686
|
+
}
|
|
687
|
+
else {
|
|
688
|
+
var valid7 = true;
|
|
689
|
+
}
|
|
690
|
+
if (valid7) {
|
|
691
|
+
if (data15.image !== undefined) {
|
|
692
|
+
const _errs40 = errors;
|
|
693
|
+
if (typeof data15.image !== "string") {
|
|
694
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/pricing/image", schemaPath: "#/$defs/Model/properties/pricing/properties/image/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
695
|
+
return false;
|
|
696
|
+
}
|
|
697
|
+
var valid7 = _errs40 === errors;
|
|
698
|
+
}
|
|
699
|
+
else {
|
|
700
|
+
var valid7 = true;
|
|
701
|
+
}
|
|
702
|
+
if (valid7) {
|
|
703
|
+
if (data15.input_cache_read !== undefined) {
|
|
704
|
+
const _errs42 = errors;
|
|
705
|
+
if (typeof data15.input_cache_read !== "string") {
|
|
706
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/pricing/input_cache_read", schemaPath: "#/$defs/Model/properties/pricing/properties/input_cache_read/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
707
|
+
return false;
|
|
708
|
+
}
|
|
709
|
+
var valid7 = _errs42 === errors;
|
|
710
|
+
}
|
|
711
|
+
else {
|
|
712
|
+
var valid7 = true;
|
|
713
|
+
}
|
|
714
|
+
if (valid7) {
|
|
715
|
+
if (data15.internal_reasoning !== undefined) {
|
|
716
|
+
const _errs44 = errors;
|
|
717
|
+
if (typeof data15.internal_reasoning !== "string") {
|
|
718
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/pricing/internal_reasoning", schemaPath: "#/$defs/Model/properties/pricing/properties/internal_reasoning/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
719
|
+
return false;
|
|
720
|
+
}
|
|
721
|
+
var valid7 = _errs44 === errors;
|
|
722
|
+
}
|
|
723
|
+
else {
|
|
724
|
+
var valid7 = true;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
else {
|
|
734
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/pricing", schemaPath: "#/$defs/Model/properties/pricing/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
735
|
+
return false;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
var valid3 = _errs32 === errors;
|
|
739
|
+
}
|
|
740
|
+
else {
|
|
741
|
+
var valid3 = true;
|
|
742
|
+
}
|
|
743
|
+
if (valid3) {
|
|
744
|
+
if (data1.top_provider !== undefined) {
|
|
745
|
+
let data22 = data1.top_provider;
|
|
746
|
+
const _errs46 = errors;
|
|
747
|
+
if (errors === _errs46) {
|
|
748
|
+
if (data22 && typeof data22 == "object" && !Array.isArray(data22)) {
|
|
749
|
+
let missing4;
|
|
750
|
+
if ((((data22.context_length === undefined) && (missing4 = "context_length")) || ((data22.max_completion_tokens === undefined) && (missing4 = "max_completion_tokens"))) || ((data22.is_moderated === undefined) && (missing4 = "is_moderated"))) {
|
|
751
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/top_provider", schemaPath: "#/$defs/Model/properties/top_provider/required", keyword: "required", params: { missingProperty: missing4 }, message: "must have required property '" + missing4 + "'" }];
|
|
752
|
+
return false;
|
|
753
|
+
}
|
|
754
|
+
else {
|
|
755
|
+
if (data22.context_length !== undefined) {
|
|
756
|
+
let data23 = data22.context_length;
|
|
757
|
+
const _errs48 = errors;
|
|
758
|
+
if (!(((typeof data23 == "number") && (!(data23 % 1) && !isNaN(data23))) && (isFinite(data23)))) {
|
|
759
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/top_provider/context_length", schemaPath: "#/$defs/Model/properties/top_provider/properties/context_length/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
760
|
+
return false;
|
|
761
|
+
}
|
|
762
|
+
var valid8 = _errs48 === errors;
|
|
763
|
+
}
|
|
764
|
+
else {
|
|
765
|
+
var valid8 = true;
|
|
766
|
+
}
|
|
767
|
+
if (valid8) {
|
|
768
|
+
if (data22.max_completion_tokens !== undefined) {
|
|
769
|
+
let data24 = data22.max_completion_tokens;
|
|
770
|
+
const _errs50 = errors;
|
|
771
|
+
if (!(((typeof data24 == "number") && (!(data24 % 1) && !isNaN(data24))) && (isFinite(data24)))) {
|
|
772
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/top_provider/max_completion_tokens", schemaPath: "#/$defs/Model/properties/top_provider/properties/max_completion_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
773
|
+
return false;
|
|
774
|
+
}
|
|
775
|
+
var valid8 = _errs50 === errors;
|
|
776
|
+
}
|
|
777
|
+
else {
|
|
778
|
+
var valid8 = true;
|
|
779
|
+
}
|
|
780
|
+
if (valid8) {
|
|
781
|
+
if (data22.is_moderated !== undefined) {
|
|
782
|
+
const _errs52 = errors;
|
|
783
|
+
if (typeof data22.is_moderated !== "boolean") {
|
|
784
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/top_provider/is_moderated", schemaPath: "#/$defs/Model/properties/top_provider/properties/is_moderated/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" }];
|
|
785
|
+
return false;
|
|
786
|
+
}
|
|
787
|
+
var valid8 = _errs52 === errors;
|
|
788
|
+
}
|
|
789
|
+
else {
|
|
790
|
+
var valid8 = true;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
else {
|
|
797
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/top_provider", schemaPath: "#/$defs/Model/properties/top_provider/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
798
|
+
return false;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
var valid3 = _errs46 === errors;
|
|
802
|
+
}
|
|
803
|
+
else {
|
|
804
|
+
var valid3 = true;
|
|
805
|
+
}
|
|
806
|
+
if (valid3) {
|
|
807
|
+
if (data1.supported_parameters !== undefined) {
|
|
808
|
+
let data26 = data1.supported_parameters;
|
|
809
|
+
const _errs54 = errors;
|
|
810
|
+
if (errors === _errs54) {
|
|
811
|
+
if (Array.isArray(data26)) {
|
|
812
|
+
var valid9 = true;
|
|
813
|
+
const len3 = data26.length;
|
|
814
|
+
for (let i3 = 0; i3 < len3; i3++) {
|
|
815
|
+
const _errs56 = errors;
|
|
816
|
+
if (typeof data26[i3] !== "string") {
|
|
817
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/supported_parameters/" + i3, schemaPath: "#/$defs/Model/properties/supported_parameters/items/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
818
|
+
return false;
|
|
819
|
+
}
|
|
820
|
+
var valid9 = _errs56 === errors;
|
|
821
|
+
if (!valid9) {
|
|
822
|
+
break;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
else {
|
|
827
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0 + "/supported_parameters", schemaPath: "#/$defs/Model/properties/supported_parameters/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
828
|
+
return false;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
var valid3 = _errs54 === errors;
|
|
832
|
+
}
|
|
833
|
+
else {
|
|
834
|
+
var valid3 = true;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
else {
|
|
848
|
+
validate22.errors = [{ instancePath: instancePath + "/data/" + i0, schemaPath: "#/$defs/Model/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
849
|
+
return false;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
var valid1 = _errs3 === errors;
|
|
853
|
+
if (!valid1) {
|
|
854
|
+
break;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
else {
|
|
859
|
+
validate22.errors = [{ instancePath: instancePath + "/data", schemaPath: "#/properties/data/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
860
|
+
return false;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
var valid0 = _errs1 === errors;
|
|
864
|
+
}
|
|
865
|
+
else {
|
|
866
|
+
var valid0 = true;
|
|
867
|
+
}
|
|
868
|
+
if (valid0) {
|
|
869
|
+
if (data.total_count !== undefined) {
|
|
870
|
+
let data28 = data.total_count;
|
|
871
|
+
const _errs58 = errors;
|
|
872
|
+
if (!(((typeof data28 == "number") && (!(data28 % 1) && !isNaN(data28))) && (isFinite(data28)))) {
|
|
873
|
+
validate22.errors = [{ instancePath: instancePath + "/total_count", schemaPath: "#/properties/total_count/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
874
|
+
return false;
|
|
875
|
+
}
|
|
876
|
+
var valid0 = _errs58 === errors;
|
|
877
|
+
}
|
|
878
|
+
else {
|
|
879
|
+
var valid0 = true;
|
|
880
|
+
}
|
|
881
|
+
if (valid0) {
|
|
882
|
+
if (data.links !== undefined) {
|
|
883
|
+
let data29 = data.links;
|
|
884
|
+
const _errs60 = errors;
|
|
885
|
+
if (errors === _errs60) {
|
|
886
|
+
if (data29 && typeof data29 == "object" && !Array.isArray(data29)) {
|
|
887
|
+
let missing5;
|
|
888
|
+
if ((data29.next === undefined) && (missing5 = "next")) {
|
|
889
|
+
validate22.errors = [{ instancePath: instancePath + "/links", schemaPath: "#/properties/links/required", keyword: "required", params: { missingProperty: missing5 }, message: "must have required property '" + missing5 + "'" }];
|
|
890
|
+
return false;
|
|
891
|
+
}
|
|
892
|
+
else {
|
|
893
|
+
if (data29.next !== undefined) {
|
|
894
|
+
let data30 = data29.next;
|
|
895
|
+
if ((typeof data30 !== "string") && (data30 !== null)) {
|
|
896
|
+
validate22.errors = [{ instancePath: instancePath + "/links/next", schemaPath: "#/properties/links/properties/next/type", keyword: "type", params: { type: schema33.properties.links.properties.next.type }, message: "must be string,null" }];
|
|
897
|
+
return false;
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
else {
|
|
903
|
+
validate22.errors = [{ instancePath: instancePath + "/links", schemaPath: "#/properties/links/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
904
|
+
return false;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
var valid0 = _errs60 === errors;
|
|
908
|
+
}
|
|
909
|
+
else {
|
|
910
|
+
var valid0 = true;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
else {
|
|
917
|
+
validate22.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
918
|
+
return false;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
validate22.errors = vErrors;
|
|
922
|
+
return errors === 0;
|
|
923
|
+
}
|
|
924
|
+
validate22.evaluated = { "props": { "data": true, "total_count": true, "links": true }, "dynamicProps": false, "dynamicItems": false };
|
|
925
|
+
export const validateModelResponse = validate23;
|
|
926
|
+
const schema35 = { "type": "object", "required": ["data"], "properties": { "data": { "$ref": "#/$defs/Model" } } };
|
|
927
|
+
function validate23(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
928
|
+
let vErrors = null;
|
|
929
|
+
let errors = 0;
|
|
930
|
+
const evaluated0 = validate23.evaluated;
|
|
931
|
+
if (evaluated0.dynamicProps) {
|
|
932
|
+
evaluated0.props = undefined;
|
|
933
|
+
}
|
|
934
|
+
if (evaluated0.dynamicItems) {
|
|
935
|
+
evaluated0.items = undefined;
|
|
936
|
+
}
|
|
937
|
+
if (errors === 0) {
|
|
938
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
939
|
+
let missing0;
|
|
940
|
+
if ((data.data === undefined) && (missing0 = "data")) {
|
|
941
|
+
validate23.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
942
|
+
return false;
|
|
943
|
+
}
|
|
944
|
+
else {
|
|
945
|
+
if (data.data !== undefined) {
|
|
946
|
+
let data0 = data.data;
|
|
947
|
+
const _errs2 = errors;
|
|
948
|
+
if (errors === _errs2) {
|
|
949
|
+
if (data0 && typeof data0 == "object" && !Array.isArray(data0)) {
|
|
950
|
+
let missing1;
|
|
951
|
+
if ((((((((((data0.id === undefined) && (missing1 = "id")) || ((data0.canonical_slug === undefined) && (missing1 = "canonical_slug"))) || ((data0.name === undefined) && (missing1 = "name"))) || ((data0.created === undefined) && (missing1 = "created"))) || ((data0.context_length === undefined) && (missing1 = "context_length"))) || ((data0.architecture === undefined) && (missing1 = "architecture"))) || ((data0.pricing === undefined) && (missing1 = "pricing"))) || ((data0.top_provider === undefined) && (missing1 = "top_provider"))) || ((data0.supported_parameters === undefined) && (missing1 = "supported_parameters"))) {
|
|
952
|
+
validate23.errors = [{ instancePath: instancePath + "/data", schemaPath: "#/$defs/Model/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
|
|
953
|
+
return false;
|
|
954
|
+
}
|
|
955
|
+
else {
|
|
956
|
+
if (data0.id !== undefined) {
|
|
957
|
+
const _errs4 = errors;
|
|
958
|
+
if (typeof data0.id !== "string") {
|
|
959
|
+
validate23.errors = [{ instancePath: instancePath + "/data/id", schemaPath: "#/$defs/Model/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
960
|
+
return false;
|
|
961
|
+
}
|
|
962
|
+
var valid2 = _errs4 === errors;
|
|
963
|
+
}
|
|
964
|
+
else {
|
|
965
|
+
var valid2 = true;
|
|
966
|
+
}
|
|
967
|
+
if (valid2) {
|
|
968
|
+
if (data0.canonical_slug !== undefined) {
|
|
969
|
+
const _errs6 = errors;
|
|
970
|
+
if (typeof data0.canonical_slug !== "string") {
|
|
971
|
+
validate23.errors = [{ instancePath: instancePath + "/data/canonical_slug", schemaPath: "#/$defs/Model/properties/canonical_slug/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
972
|
+
return false;
|
|
973
|
+
}
|
|
974
|
+
var valid2 = _errs6 === errors;
|
|
975
|
+
}
|
|
976
|
+
else {
|
|
977
|
+
var valid2 = true;
|
|
978
|
+
}
|
|
979
|
+
if (valid2) {
|
|
980
|
+
if (data0.name !== undefined) {
|
|
981
|
+
const _errs8 = errors;
|
|
982
|
+
if (typeof data0.name !== "string") {
|
|
983
|
+
validate23.errors = [{ instancePath: instancePath + "/data/name", schemaPath: "#/$defs/Model/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
984
|
+
return false;
|
|
985
|
+
}
|
|
986
|
+
var valid2 = _errs8 === errors;
|
|
987
|
+
}
|
|
988
|
+
else {
|
|
989
|
+
var valid2 = true;
|
|
990
|
+
}
|
|
991
|
+
if (valid2) {
|
|
992
|
+
if (data0.created !== undefined) {
|
|
993
|
+
let data4 = data0.created;
|
|
994
|
+
const _errs10 = errors;
|
|
995
|
+
if (!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))) {
|
|
996
|
+
validate23.errors = [{ instancePath: instancePath + "/data/created", schemaPath: "#/$defs/Model/properties/created/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
997
|
+
return false;
|
|
998
|
+
}
|
|
999
|
+
var valid2 = _errs10 === errors;
|
|
1000
|
+
}
|
|
1001
|
+
else {
|
|
1002
|
+
var valid2 = true;
|
|
1003
|
+
}
|
|
1004
|
+
if (valid2) {
|
|
1005
|
+
if (data0.description !== undefined) {
|
|
1006
|
+
const _errs12 = errors;
|
|
1007
|
+
if (typeof data0.description !== "string") {
|
|
1008
|
+
validate23.errors = [{ instancePath: instancePath + "/data/description", schemaPath: "#/$defs/Model/properties/description/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1009
|
+
return false;
|
|
1010
|
+
}
|
|
1011
|
+
var valid2 = _errs12 === errors;
|
|
1012
|
+
}
|
|
1013
|
+
else {
|
|
1014
|
+
var valid2 = true;
|
|
1015
|
+
}
|
|
1016
|
+
if (valid2) {
|
|
1017
|
+
if (data0.context_length !== undefined) {
|
|
1018
|
+
let data6 = data0.context_length;
|
|
1019
|
+
const _errs14 = errors;
|
|
1020
|
+
if (!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))) {
|
|
1021
|
+
validate23.errors = [{ instancePath: instancePath + "/data/context_length", schemaPath: "#/$defs/Model/properties/context_length/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
1022
|
+
return false;
|
|
1023
|
+
}
|
|
1024
|
+
var valid2 = _errs14 === errors;
|
|
1025
|
+
}
|
|
1026
|
+
else {
|
|
1027
|
+
var valid2 = true;
|
|
1028
|
+
}
|
|
1029
|
+
if (valid2) {
|
|
1030
|
+
if (data0.architecture !== undefined) {
|
|
1031
|
+
let data7 = data0.architecture;
|
|
1032
|
+
const _errs16 = errors;
|
|
1033
|
+
if (errors === _errs16) {
|
|
1034
|
+
if (data7 && typeof data7 == "object" && !Array.isArray(data7)) {
|
|
1035
|
+
let missing2;
|
|
1036
|
+
if (((data7.input_modalities === undefined) && (missing2 = "input_modalities")) || ((data7.output_modalities === undefined) && (missing2 = "output_modalities"))) {
|
|
1037
|
+
validate23.errors = [{ instancePath: instancePath + "/data/architecture", schemaPath: "#/$defs/Model/properties/architecture/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" }];
|
|
1038
|
+
return false;
|
|
1039
|
+
}
|
|
1040
|
+
else {
|
|
1041
|
+
if (data7.input_modalities !== undefined) {
|
|
1042
|
+
let data8 = data7.input_modalities;
|
|
1043
|
+
const _errs18 = errors;
|
|
1044
|
+
if (errors === _errs18) {
|
|
1045
|
+
if (Array.isArray(data8)) {
|
|
1046
|
+
var valid4 = true;
|
|
1047
|
+
const len0 = data8.length;
|
|
1048
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
1049
|
+
const _errs20 = errors;
|
|
1050
|
+
if (typeof data8[i0] !== "string") {
|
|
1051
|
+
validate23.errors = [{ instancePath: instancePath + "/data/architecture/input_modalities/" + i0, schemaPath: "#/$defs/Model/properties/architecture/properties/input_modalities/items/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1052
|
+
return false;
|
|
1053
|
+
}
|
|
1054
|
+
var valid4 = _errs20 === errors;
|
|
1055
|
+
if (!valid4) {
|
|
1056
|
+
break;
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
else {
|
|
1061
|
+
validate23.errors = [{ instancePath: instancePath + "/data/architecture/input_modalities", schemaPath: "#/$defs/Model/properties/architecture/properties/input_modalities/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
1062
|
+
return false;
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
var valid3 = _errs18 === errors;
|
|
1066
|
+
}
|
|
1067
|
+
else {
|
|
1068
|
+
var valid3 = true;
|
|
1069
|
+
}
|
|
1070
|
+
if (valid3) {
|
|
1071
|
+
if (data7.output_modalities !== undefined) {
|
|
1072
|
+
let data10 = data7.output_modalities;
|
|
1073
|
+
const _errs22 = errors;
|
|
1074
|
+
if (errors === _errs22) {
|
|
1075
|
+
if (Array.isArray(data10)) {
|
|
1076
|
+
var valid5 = true;
|
|
1077
|
+
const len1 = data10.length;
|
|
1078
|
+
for (let i1 = 0; i1 < len1; i1++) {
|
|
1079
|
+
const _errs24 = errors;
|
|
1080
|
+
if (typeof data10[i1] !== "string") {
|
|
1081
|
+
validate23.errors = [{ instancePath: instancePath + "/data/architecture/output_modalities/" + i1, schemaPath: "#/$defs/Model/properties/architecture/properties/output_modalities/items/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1082
|
+
return false;
|
|
1083
|
+
}
|
|
1084
|
+
var valid5 = _errs24 === errors;
|
|
1085
|
+
if (!valid5) {
|
|
1086
|
+
break;
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
else {
|
|
1091
|
+
validate23.errors = [{ instancePath: instancePath + "/data/architecture/output_modalities", schemaPath: "#/$defs/Model/properties/architecture/properties/output_modalities/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
1092
|
+
return false;
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
var valid3 = _errs22 === errors;
|
|
1096
|
+
}
|
|
1097
|
+
else {
|
|
1098
|
+
var valid3 = true;
|
|
1099
|
+
}
|
|
1100
|
+
if (valid3) {
|
|
1101
|
+
if (data7.tokenizer !== undefined) {
|
|
1102
|
+
const _errs26 = errors;
|
|
1103
|
+
if (typeof data7.tokenizer !== "string") {
|
|
1104
|
+
validate23.errors = [{ instancePath: instancePath + "/data/architecture/tokenizer", schemaPath: "#/$defs/Model/properties/architecture/properties/tokenizer/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1105
|
+
return false;
|
|
1106
|
+
}
|
|
1107
|
+
var valid3 = _errs26 === errors;
|
|
1108
|
+
}
|
|
1109
|
+
else {
|
|
1110
|
+
var valid3 = true;
|
|
1111
|
+
}
|
|
1112
|
+
if (valid3) {
|
|
1113
|
+
if (data7.instruct_type !== undefined) {
|
|
1114
|
+
let data13 = data7.instruct_type;
|
|
1115
|
+
const _errs28 = errors;
|
|
1116
|
+
if ((typeof data13 !== "string") && (data13 !== null)) {
|
|
1117
|
+
validate23.errors = [{ instancePath: instancePath + "/data/architecture/instruct_type", schemaPath: "#/$defs/Model/properties/architecture/properties/instruct_type/type", keyword: "type", params: { type: schema32.properties.architecture.properties.instruct_type.type }, message: "must be string,null" }];
|
|
1118
|
+
return false;
|
|
1119
|
+
}
|
|
1120
|
+
var valid3 = _errs28 === errors;
|
|
1121
|
+
}
|
|
1122
|
+
else {
|
|
1123
|
+
var valid3 = true;
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
else {
|
|
1131
|
+
validate23.errors = [{ instancePath: instancePath + "/data/architecture", schemaPath: "#/$defs/Model/properties/architecture/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
1132
|
+
return false;
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
var valid2 = _errs16 === errors;
|
|
1136
|
+
}
|
|
1137
|
+
else {
|
|
1138
|
+
var valid2 = true;
|
|
1139
|
+
}
|
|
1140
|
+
if (valid2) {
|
|
1141
|
+
if (data0.pricing !== undefined) {
|
|
1142
|
+
let data14 = data0.pricing;
|
|
1143
|
+
const _errs30 = errors;
|
|
1144
|
+
if (errors === _errs30) {
|
|
1145
|
+
if (data14 && typeof data14 == "object" && !Array.isArray(data14)) {
|
|
1146
|
+
let missing3;
|
|
1147
|
+
if (((data14.prompt === undefined) && (missing3 = "prompt")) || ((data14.completion === undefined) && (missing3 = "completion"))) {
|
|
1148
|
+
validate23.errors = [{ instancePath: instancePath + "/data/pricing", schemaPath: "#/$defs/Model/properties/pricing/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" }];
|
|
1149
|
+
return false;
|
|
1150
|
+
}
|
|
1151
|
+
else {
|
|
1152
|
+
if (data14.prompt !== undefined) {
|
|
1153
|
+
const _errs32 = errors;
|
|
1154
|
+
if (typeof data14.prompt !== "string") {
|
|
1155
|
+
validate23.errors = [{ instancePath: instancePath + "/data/pricing/prompt", schemaPath: "#/$defs/Model/properties/pricing/properties/prompt/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1156
|
+
return false;
|
|
1157
|
+
}
|
|
1158
|
+
var valid6 = _errs32 === errors;
|
|
1159
|
+
}
|
|
1160
|
+
else {
|
|
1161
|
+
var valid6 = true;
|
|
1162
|
+
}
|
|
1163
|
+
if (valid6) {
|
|
1164
|
+
if (data14.completion !== undefined) {
|
|
1165
|
+
const _errs34 = errors;
|
|
1166
|
+
if (typeof data14.completion !== "string") {
|
|
1167
|
+
validate23.errors = [{ instancePath: instancePath + "/data/pricing/completion", schemaPath: "#/$defs/Model/properties/pricing/properties/completion/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1168
|
+
return false;
|
|
1169
|
+
}
|
|
1170
|
+
var valid6 = _errs34 === errors;
|
|
1171
|
+
}
|
|
1172
|
+
else {
|
|
1173
|
+
var valid6 = true;
|
|
1174
|
+
}
|
|
1175
|
+
if (valid6) {
|
|
1176
|
+
if (data14.request !== undefined) {
|
|
1177
|
+
const _errs36 = errors;
|
|
1178
|
+
if (typeof data14.request !== "string") {
|
|
1179
|
+
validate23.errors = [{ instancePath: instancePath + "/data/pricing/request", schemaPath: "#/$defs/Model/properties/pricing/properties/request/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1180
|
+
return false;
|
|
1181
|
+
}
|
|
1182
|
+
var valid6 = _errs36 === errors;
|
|
1183
|
+
}
|
|
1184
|
+
else {
|
|
1185
|
+
var valid6 = true;
|
|
1186
|
+
}
|
|
1187
|
+
if (valid6) {
|
|
1188
|
+
if (data14.image !== undefined) {
|
|
1189
|
+
const _errs38 = errors;
|
|
1190
|
+
if (typeof data14.image !== "string") {
|
|
1191
|
+
validate23.errors = [{ instancePath: instancePath + "/data/pricing/image", schemaPath: "#/$defs/Model/properties/pricing/properties/image/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1192
|
+
return false;
|
|
1193
|
+
}
|
|
1194
|
+
var valid6 = _errs38 === errors;
|
|
1195
|
+
}
|
|
1196
|
+
else {
|
|
1197
|
+
var valid6 = true;
|
|
1198
|
+
}
|
|
1199
|
+
if (valid6) {
|
|
1200
|
+
if (data14.input_cache_read !== undefined) {
|
|
1201
|
+
const _errs40 = errors;
|
|
1202
|
+
if (typeof data14.input_cache_read !== "string") {
|
|
1203
|
+
validate23.errors = [{ instancePath: instancePath + "/data/pricing/input_cache_read", schemaPath: "#/$defs/Model/properties/pricing/properties/input_cache_read/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1204
|
+
return false;
|
|
1205
|
+
}
|
|
1206
|
+
var valid6 = _errs40 === errors;
|
|
1207
|
+
}
|
|
1208
|
+
else {
|
|
1209
|
+
var valid6 = true;
|
|
1210
|
+
}
|
|
1211
|
+
if (valid6) {
|
|
1212
|
+
if (data14.internal_reasoning !== undefined) {
|
|
1213
|
+
const _errs42 = errors;
|
|
1214
|
+
if (typeof data14.internal_reasoning !== "string") {
|
|
1215
|
+
validate23.errors = [{ instancePath: instancePath + "/data/pricing/internal_reasoning", schemaPath: "#/$defs/Model/properties/pricing/properties/internal_reasoning/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1216
|
+
return false;
|
|
1217
|
+
}
|
|
1218
|
+
var valid6 = _errs42 === errors;
|
|
1219
|
+
}
|
|
1220
|
+
else {
|
|
1221
|
+
var valid6 = true;
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
else {
|
|
1231
|
+
validate23.errors = [{ instancePath: instancePath + "/data/pricing", schemaPath: "#/$defs/Model/properties/pricing/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
1232
|
+
return false;
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
var valid2 = _errs30 === errors;
|
|
1236
|
+
}
|
|
1237
|
+
else {
|
|
1238
|
+
var valid2 = true;
|
|
1239
|
+
}
|
|
1240
|
+
if (valid2) {
|
|
1241
|
+
if (data0.top_provider !== undefined) {
|
|
1242
|
+
let data21 = data0.top_provider;
|
|
1243
|
+
const _errs44 = errors;
|
|
1244
|
+
if (errors === _errs44) {
|
|
1245
|
+
if (data21 && typeof data21 == "object" && !Array.isArray(data21)) {
|
|
1246
|
+
let missing4;
|
|
1247
|
+
if ((((data21.context_length === undefined) && (missing4 = "context_length")) || ((data21.max_completion_tokens === undefined) && (missing4 = "max_completion_tokens"))) || ((data21.is_moderated === undefined) && (missing4 = "is_moderated"))) {
|
|
1248
|
+
validate23.errors = [{ instancePath: instancePath + "/data/top_provider", schemaPath: "#/$defs/Model/properties/top_provider/required", keyword: "required", params: { missingProperty: missing4 }, message: "must have required property '" + missing4 + "'" }];
|
|
1249
|
+
return false;
|
|
1250
|
+
}
|
|
1251
|
+
else {
|
|
1252
|
+
if (data21.context_length !== undefined) {
|
|
1253
|
+
let data22 = data21.context_length;
|
|
1254
|
+
const _errs46 = errors;
|
|
1255
|
+
if (!(((typeof data22 == "number") && (!(data22 % 1) && !isNaN(data22))) && (isFinite(data22)))) {
|
|
1256
|
+
validate23.errors = [{ instancePath: instancePath + "/data/top_provider/context_length", schemaPath: "#/$defs/Model/properties/top_provider/properties/context_length/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
1257
|
+
return false;
|
|
1258
|
+
}
|
|
1259
|
+
var valid7 = _errs46 === errors;
|
|
1260
|
+
}
|
|
1261
|
+
else {
|
|
1262
|
+
var valid7 = true;
|
|
1263
|
+
}
|
|
1264
|
+
if (valid7) {
|
|
1265
|
+
if (data21.max_completion_tokens !== undefined) {
|
|
1266
|
+
let data23 = data21.max_completion_tokens;
|
|
1267
|
+
const _errs48 = errors;
|
|
1268
|
+
if (!(((typeof data23 == "number") && (!(data23 % 1) && !isNaN(data23))) && (isFinite(data23)))) {
|
|
1269
|
+
validate23.errors = [{ instancePath: instancePath + "/data/top_provider/max_completion_tokens", schemaPath: "#/$defs/Model/properties/top_provider/properties/max_completion_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
1270
|
+
return false;
|
|
1271
|
+
}
|
|
1272
|
+
var valid7 = _errs48 === errors;
|
|
1273
|
+
}
|
|
1274
|
+
else {
|
|
1275
|
+
var valid7 = true;
|
|
1276
|
+
}
|
|
1277
|
+
if (valid7) {
|
|
1278
|
+
if (data21.is_moderated !== undefined) {
|
|
1279
|
+
const _errs50 = errors;
|
|
1280
|
+
if (typeof data21.is_moderated !== "boolean") {
|
|
1281
|
+
validate23.errors = [{ instancePath: instancePath + "/data/top_provider/is_moderated", schemaPath: "#/$defs/Model/properties/top_provider/properties/is_moderated/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" }];
|
|
1282
|
+
return false;
|
|
1283
|
+
}
|
|
1284
|
+
var valid7 = _errs50 === errors;
|
|
1285
|
+
}
|
|
1286
|
+
else {
|
|
1287
|
+
var valid7 = true;
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
else {
|
|
1294
|
+
validate23.errors = [{ instancePath: instancePath + "/data/top_provider", schemaPath: "#/$defs/Model/properties/top_provider/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
1295
|
+
return false;
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
var valid2 = _errs44 === errors;
|
|
1299
|
+
}
|
|
1300
|
+
else {
|
|
1301
|
+
var valid2 = true;
|
|
1302
|
+
}
|
|
1303
|
+
if (valid2) {
|
|
1304
|
+
if (data0.supported_parameters !== undefined) {
|
|
1305
|
+
let data25 = data0.supported_parameters;
|
|
1306
|
+
const _errs52 = errors;
|
|
1307
|
+
if (errors === _errs52) {
|
|
1308
|
+
if (Array.isArray(data25)) {
|
|
1309
|
+
var valid8 = true;
|
|
1310
|
+
const len2 = data25.length;
|
|
1311
|
+
for (let i2 = 0; i2 < len2; i2++) {
|
|
1312
|
+
const _errs54 = errors;
|
|
1313
|
+
if (typeof data25[i2] !== "string") {
|
|
1314
|
+
validate23.errors = [{ instancePath: instancePath + "/data/supported_parameters/" + i2, schemaPath: "#/$defs/Model/properties/supported_parameters/items/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1315
|
+
return false;
|
|
1316
|
+
}
|
|
1317
|
+
var valid8 = _errs54 === errors;
|
|
1318
|
+
if (!valid8) {
|
|
1319
|
+
break;
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
else {
|
|
1324
|
+
validate23.errors = [{ instancePath: instancePath + "/data/supported_parameters", schemaPath: "#/$defs/Model/properties/supported_parameters/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
1325
|
+
return false;
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
var valid2 = _errs52 === errors;
|
|
1329
|
+
}
|
|
1330
|
+
else {
|
|
1331
|
+
var valid2 = true;
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
else {
|
|
1345
|
+
validate23.errors = [{ instancePath: instancePath + "/data", schemaPath: "#/$defs/Model/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
1346
|
+
return false;
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
else {
|
|
1353
|
+
validate23.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
1354
|
+
return false;
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
validate23.errors = vErrors;
|
|
1358
|
+
return errors === 0;
|
|
1359
|
+
}
|
|
1360
|
+
validate23.evaluated = { "props": { "data": true }, "dynamicProps": false, "dynamicItems": false };
|
|
1361
|
+
export const validateChatCompletionRequest = validate24;
|
|
1362
|
+
const schema37 = { "type": "object", "dependentRequired": { "max_wait_ms": ["max_cost_flop"] }, "required": ["model", "messages"], "additionalProperties": false, "properties": { "model": { "type": "string" }, "messages": { "type": "array", "minItems": 1, "items": { "type": "object", "required": ["role", "content"], "properties": { "role": { "type": "string", "enum": ["developer", "system", "user", "assistant", "tool"] }, "content": { "oneOf": [{ "type": "string" }, { "type": "null" }, { "type": "array", "items": { "type": "object" } }], "description": "Structured parts are preserved; modalities are capability-gated." } } } }, "max_tokens": { "type": "integer", "default": 256 }, "temperature": { "type": "number", "default": 0.7 }, "top_p": { "type": "number" }, "seed": { "type": "integer" }, "stop": { "oneOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] }, "presence_penalty": { "type": "number" }, "frequency_penalty": { "type": "number" }, "logit_bias": { "type": "object", "additionalProperties": { "type": "number" } }, "tools": { "type": "array", "items": { "type": "object" } }, "tool_choice": {}, "parallel_tool_calls": { "type": "boolean" }, "response_format": { "type": "object" }, "stream": { "type": "boolean", "default": false }, "stream_options": { "type": "object", "properties": { "include_usage": { "const": true } }, "required": ["include_usage"], "additionalProperties": false }, "max_cost_flop": { "type": "number", "exclusiveMinimum": 0 }, "max_wait_ms": { "type": "integer", "minimum": 1, "maximum": 3600000, "description": "Opt-in total wait and execution deadline in milliseconds for public completions. Requires max_cost_flop; no ready worker probe is required." } } };
|
|
1363
|
+
const func1 = Object.prototype.hasOwnProperty;
|
|
1364
|
+
function validate24(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
1365
|
+
let vErrors = null;
|
|
1366
|
+
let errors = 0;
|
|
1367
|
+
const evaluated0 = validate24.evaluated;
|
|
1368
|
+
if (evaluated0.dynamicProps) {
|
|
1369
|
+
evaluated0.props = undefined;
|
|
1370
|
+
}
|
|
1371
|
+
if (evaluated0.dynamicItems) {
|
|
1372
|
+
evaluated0.items = undefined;
|
|
1373
|
+
}
|
|
1374
|
+
if (errors === 0) {
|
|
1375
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1376
|
+
let missing0;
|
|
1377
|
+
if (((data.model === undefined) && (missing0 = "model")) || ((data.messages === undefined) && (missing0 = "messages"))) {
|
|
1378
|
+
validate24.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
1379
|
+
return false;
|
|
1380
|
+
}
|
|
1381
|
+
else {
|
|
1382
|
+
const _errs1 = errors;
|
|
1383
|
+
for (const key0 in data) {
|
|
1384
|
+
if (!(func1.call(schema37.properties, key0))) {
|
|
1385
|
+
validate24.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
|
|
1386
|
+
return false;
|
|
1387
|
+
break;
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
if (_errs1 === errors) {
|
|
1391
|
+
if (data.model !== undefined) {
|
|
1392
|
+
const _errs2 = errors;
|
|
1393
|
+
if (typeof data.model !== "string") {
|
|
1394
|
+
validate24.errors = [{ instancePath: instancePath + "/model", schemaPath: "#/properties/model/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1395
|
+
return false;
|
|
1396
|
+
}
|
|
1397
|
+
var valid0 = _errs2 === errors;
|
|
1398
|
+
}
|
|
1399
|
+
else {
|
|
1400
|
+
var valid0 = true;
|
|
1401
|
+
}
|
|
1402
|
+
if (valid0) {
|
|
1403
|
+
if (data.messages !== undefined) {
|
|
1404
|
+
let data1 = data.messages;
|
|
1405
|
+
const _errs4 = errors;
|
|
1406
|
+
if (errors === _errs4) {
|
|
1407
|
+
if (Array.isArray(data1)) {
|
|
1408
|
+
if (data1.length < 1) {
|
|
1409
|
+
validate24.errors = [{ instancePath: instancePath + "/messages", schemaPath: "#/properties/messages/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" }];
|
|
1410
|
+
return false;
|
|
1411
|
+
}
|
|
1412
|
+
else {
|
|
1413
|
+
var valid1 = true;
|
|
1414
|
+
const len0 = data1.length;
|
|
1415
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
1416
|
+
let data2 = data1[i0];
|
|
1417
|
+
const _errs6 = errors;
|
|
1418
|
+
if (errors === _errs6) {
|
|
1419
|
+
if (data2 && typeof data2 == "object" && !Array.isArray(data2)) {
|
|
1420
|
+
let missing1;
|
|
1421
|
+
if (((data2.role === undefined) && (missing1 = "role")) || ((data2.content === undefined) && (missing1 = "content"))) {
|
|
1422
|
+
validate24.errors = [{ instancePath: instancePath + "/messages/" + i0, schemaPath: "#/properties/messages/items/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
|
|
1423
|
+
return false;
|
|
1424
|
+
}
|
|
1425
|
+
else {
|
|
1426
|
+
if (data2.role !== undefined) {
|
|
1427
|
+
let data3 = data2.role;
|
|
1428
|
+
const _errs8 = errors;
|
|
1429
|
+
if (typeof data3 !== "string") {
|
|
1430
|
+
validate24.errors = [{ instancePath: instancePath + "/messages/" + i0 + "/role", schemaPath: "#/properties/messages/items/properties/role/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
1431
|
+
return false;
|
|
1432
|
+
}
|
|
1433
|
+
if (!(((((data3 === "developer") || (data3 === "system")) || (data3 === "user")) || (data3 === "assistant")) || (data3 === "tool"))) {
|
|
1434
|
+
validate24.errors = [{ instancePath: instancePath + "/messages/" + i0 + "/role", schemaPath: "#/properties/messages/items/properties/role/enum", keyword: "enum", params: { allowedValues: schema37.properties.messages.items.properties.role.enum }, message: "must be equal to one of the allowed values" }];
|
|
1435
|
+
return false;
|
|
1436
|
+
}
|
|
1437
|
+
var valid2 = _errs8 === errors;
|
|
1438
|
+
}
|
|
1439
|
+
else {
|
|
1440
|
+
var valid2 = true;
|
|
1441
|
+
}
|
|
1442
|
+
if (valid2) {
|
|
1443
|
+
if (data2.content !== undefined) {
|
|
1444
|
+
let data4 = data2.content;
|
|
1445
|
+
const _errs10 = errors;
|
|
1446
|
+
const _errs11 = errors;
|
|
1447
|
+
let valid3 = false;
|
|
1448
|
+
let passing0 = null;
|
|
1449
|
+
const _errs12 = errors;
|
|
1450
|
+
if (typeof data4 !== "string") {
|
|
1451
|
+
const err0 = { instancePath: instancePath + "/messages/" + i0 + "/content", schemaPath: "#/properties/messages/items/properties/content/oneOf/0/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
1452
|
+
if (vErrors === null) {
|
|
1453
|
+
vErrors = [err0];
|
|
1454
|
+
}
|
|
1455
|
+
else {
|
|
1456
|
+
vErrors.push(err0);
|
|
1457
|
+
}
|
|
1458
|
+
errors++;
|
|
1459
|
+
}
|
|
1460
|
+
var _valid0 = _errs12 === errors;
|
|
1461
|
+
if (_valid0) {
|
|
1462
|
+
valid3 = true;
|
|
1463
|
+
passing0 = 0;
|
|
1464
|
+
}
|
|
1465
|
+
const _errs14 = errors;
|
|
1466
|
+
if (data4 !== null) {
|
|
1467
|
+
const err1 = { instancePath: instancePath + "/messages/" + i0 + "/content", schemaPath: "#/properties/messages/items/properties/content/oneOf/1/type", keyword: "type", params: { type: "null" }, message: "must be null" };
|
|
1468
|
+
if (vErrors === null) {
|
|
1469
|
+
vErrors = [err1];
|
|
1470
|
+
}
|
|
1471
|
+
else {
|
|
1472
|
+
vErrors.push(err1);
|
|
1473
|
+
}
|
|
1474
|
+
errors++;
|
|
1475
|
+
}
|
|
1476
|
+
var _valid0 = _errs14 === errors;
|
|
1477
|
+
if (_valid0 && valid3) {
|
|
1478
|
+
valid3 = false;
|
|
1479
|
+
passing0 = [passing0, 1];
|
|
1480
|
+
}
|
|
1481
|
+
else {
|
|
1482
|
+
if (_valid0) {
|
|
1483
|
+
valid3 = true;
|
|
1484
|
+
passing0 = 1;
|
|
1485
|
+
}
|
|
1486
|
+
const _errs16 = errors;
|
|
1487
|
+
if (errors === _errs16) {
|
|
1488
|
+
if (Array.isArray(data4)) {
|
|
1489
|
+
var valid4 = true;
|
|
1490
|
+
const len1 = data4.length;
|
|
1491
|
+
for (let i1 = 0; i1 < len1; i1++) {
|
|
1492
|
+
let data5 = data4[i1];
|
|
1493
|
+
const _errs18 = errors;
|
|
1494
|
+
if (!(data5 && typeof data5 == "object" && !Array.isArray(data5))) {
|
|
1495
|
+
const err2 = { instancePath: instancePath + "/messages/" + i0 + "/content/" + i1, schemaPath: "#/properties/messages/items/properties/content/oneOf/2/items/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
1496
|
+
if (vErrors === null) {
|
|
1497
|
+
vErrors = [err2];
|
|
1498
|
+
}
|
|
1499
|
+
else {
|
|
1500
|
+
vErrors.push(err2);
|
|
1501
|
+
}
|
|
1502
|
+
errors++;
|
|
1503
|
+
}
|
|
1504
|
+
var valid4 = _errs18 === errors;
|
|
1505
|
+
if (!valid4) {
|
|
1506
|
+
break;
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
else {
|
|
1511
|
+
const err3 = { instancePath: instancePath + "/messages/" + i0 + "/content", schemaPath: "#/properties/messages/items/properties/content/oneOf/2/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
1512
|
+
if (vErrors === null) {
|
|
1513
|
+
vErrors = [err3];
|
|
1514
|
+
}
|
|
1515
|
+
else {
|
|
1516
|
+
vErrors.push(err3);
|
|
1517
|
+
}
|
|
1518
|
+
errors++;
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
var _valid0 = _errs16 === errors;
|
|
1522
|
+
if (_valid0 && valid3) {
|
|
1523
|
+
valid3 = false;
|
|
1524
|
+
passing0 = [passing0, 2];
|
|
1525
|
+
}
|
|
1526
|
+
else {
|
|
1527
|
+
if (_valid0) {
|
|
1528
|
+
valid3 = true;
|
|
1529
|
+
passing0 = 2;
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
if (!valid3) {
|
|
1534
|
+
const err4 = { instancePath: instancePath + "/messages/" + i0 + "/content", schemaPath: "#/properties/messages/items/properties/content/oneOf", keyword: "oneOf", params: { passingSchemas: passing0 }, message: "must match exactly one schema in oneOf" };
|
|
1535
|
+
if (vErrors === null) {
|
|
1536
|
+
vErrors = [err4];
|
|
1537
|
+
}
|
|
1538
|
+
else {
|
|
1539
|
+
vErrors.push(err4);
|
|
1540
|
+
}
|
|
1541
|
+
errors++;
|
|
1542
|
+
validate24.errors = vErrors;
|
|
1543
|
+
return false;
|
|
1544
|
+
}
|
|
1545
|
+
else {
|
|
1546
|
+
errors = _errs11;
|
|
1547
|
+
if (vErrors !== null) {
|
|
1548
|
+
if (_errs11) {
|
|
1549
|
+
vErrors.length = _errs11;
|
|
1550
|
+
}
|
|
1551
|
+
else {
|
|
1552
|
+
vErrors = null;
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
var valid2 = _errs10 === errors;
|
|
1557
|
+
}
|
|
1558
|
+
else {
|
|
1559
|
+
var valid2 = true;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
else {
|
|
1565
|
+
validate24.errors = [{ instancePath: instancePath + "/messages/" + i0, schemaPath: "#/properties/messages/items/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
1566
|
+
return false;
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
var valid1 = _errs6 === errors;
|
|
1570
|
+
if (!valid1) {
|
|
1571
|
+
break;
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
else {
|
|
1577
|
+
validate24.errors = [{ instancePath: instancePath + "/messages", schemaPath: "#/properties/messages/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
1578
|
+
return false;
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
var valid0 = _errs4 === errors;
|
|
1582
|
+
}
|
|
1583
|
+
else {
|
|
1584
|
+
var valid0 = true;
|
|
1585
|
+
}
|
|
1586
|
+
if (valid0) {
|
|
1587
|
+
if (data.max_tokens !== undefined) {
|
|
1588
|
+
let data6 = data.max_tokens;
|
|
1589
|
+
const _errs20 = errors;
|
|
1590
|
+
if (!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))) {
|
|
1591
|
+
validate24.errors = [{ instancePath: instancePath + "/max_tokens", schemaPath: "#/properties/max_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
1592
|
+
return false;
|
|
1593
|
+
}
|
|
1594
|
+
var valid0 = _errs20 === errors;
|
|
1595
|
+
}
|
|
1596
|
+
else {
|
|
1597
|
+
var valid0 = true;
|
|
1598
|
+
}
|
|
1599
|
+
if (valid0) {
|
|
1600
|
+
if (data.temperature !== undefined) {
|
|
1601
|
+
let data7 = data.temperature;
|
|
1602
|
+
const _errs22 = errors;
|
|
1603
|
+
if (!((typeof data7 == "number") && (isFinite(data7)))) {
|
|
1604
|
+
validate24.errors = [{ instancePath: instancePath + "/temperature", schemaPath: "#/properties/temperature/type", keyword: "type", params: { type: "number" }, message: "must be number" }];
|
|
1605
|
+
return false;
|
|
1606
|
+
}
|
|
1607
|
+
var valid0 = _errs22 === errors;
|
|
1608
|
+
}
|
|
1609
|
+
else {
|
|
1610
|
+
var valid0 = true;
|
|
1611
|
+
}
|
|
1612
|
+
if (valid0) {
|
|
1613
|
+
if (data.top_p !== undefined) {
|
|
1614
|
+
let data8 = data.top_p;
|
|
1615
|
+
const _errs24 = errors;
|
|
1616
|
+
if (!((typeof data8 == "number") && (isFinite(data8)))) {
|
|
1617
|
+
validate24.errors = [{ instancePath: instancePath + "/top_p", schemaPath: "#/properties/top_p/type", keyword: "type", params: { type: "number" }, message: "must be number" }];
|
|
1618
|
+
return false;
|
|
1619
|
+
}
|
|
1620
|
+
var valid0 = _errs24 === errors;
|
|
1621
|
+
}
|
|
1622
|
+
else {
|
|
1623
|
+
var valid0 = true;
|
|
1624
|
+
}
|
|
1625
|
+
if (valid0) {
|
|
1626
|
+
if (data.seed !== undefined) {
|
|
1627
|
+
let data9 = data.seed;
|
|
1628
|
+
const _errs26 = errors;
|
|
1629
|
+
if (!(((typeof data9 == "number") && (!(data9 % 1) && !isNaN(data9))) && (isFinite(data9)))) {
|
|
1630
|
+
validate24.errors = [{ instancePath: instancePath + "/seed", schemaPath: "#/properties/seed/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
1631
|
+
return false;
|
|
1632
|
+
}
|
|
1633
|
+
var valid0 = _errs26 === errors;
|
|
1634
|
+
}
|
|
1635
|
+
else {
|
|
1636
|
+
var valid0 = true;
|
|
1637
|
+
}
|
|
1638
|
+
if (valid0) {
|
|
1639
|
+
if (data.stop !== undefined) {
|
|
1640
|
+
let data10 = data.stop;
|
|
1641
|
+
const _errs28 = errors;
|
|
1642
|
+
const _errs29 = errors;
|
|
1643
|
+
let valid5 = false;
|
|
1644
|
+
let passing1 = null;
|
|
1645
|
+
const _errs30 = errors;
|
|
1646
|
+
if (typeof data10 !== "string") {
|
|
1647
|
+
const err5 = { instancePath: instancePath + "/stop", schemaPath: "#/properties/stop/oneOf/0/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
1648
|
+
if (vErrors === null) {
|
|
1649
|
+
vErrors = [err5];
|
|
1650
|
+
}
|
|
1651
|
+
else {
|
|
1652
|
+
vErrors.push(err5);
|
|
1653
|
+
}
|
|
1654
|
+
errors++;
|
|
1655
|
+
}
|
|
1656
|
+
var _valid1 = _errs30 === errors;
|
|
1657
|
+
if (_valid1) {
|
|
1658
|
+
valid5 = true;
|
|
1659
|
+
passing1 = 0;
|
|
1660
|
+
}
|
|
1661
|
+
const _errs32 = errors;
|
|
1662
|
+
if (errors === _errs32) {
|
|
1663
|
+
if (Array.isArray(data10)) {
|
|
1664
|
+
var valid6 = true;
|
|
1665
|
+
const len2 = data10.length;
|
|
1666
|
+
for (let i2 = 0; i2 < len2; i2++) {
|
|
1667
|
+
const _errs34 = errors;
|
|
1668
|
+
if (typeof data10[i2] !== "string") {
|
|
1669
|
+
const err6 = { instancePath: instancePath + "/stop/" + i2, schemaPath: "#/properties/stop/oneOf/1/items/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
1670
|
+
if (vErrors === null) {
|
|
1671
|
+
vErrors = [err6];
|
|
1672
|
+
}
|
|
1673
|
+
else {
|
|
1674
|
+
vErrors.push(err6);
|
|
1675
|
+
}
|
|
1676
|
+
errors++;
|
|
1677
|
+
}
|
|
1678
|
+
var valid6 = _errs34 === errors;
|
|
1679
|
+
if (!valid6) {
|
|
1680
|
+
break;
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
else {
|
|
1685
|
+
const err7 = { instancePath: instancePath + "/stop", schemaPath: "#/properties/stop/oneOf/1/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
1686
|
+
if (vErrors === null) {
|
|
1687
|
+
vErrors = [err7];
|
|
1688
|
+
}
|
|
1689
|
+
else {
|
|
1690
|
+
vErrors.push(err7);
|
|
1691
|
+
}
|
|
1692
|
+
errors++;
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
var _valid1 = _errs32 === errors;
|
|
1696
|
+
if (_valid1 && valid5) {
|
|
1697
|
+
valid5 = false;
|
|
1698
|
+
passing1 = [passing1, 1];
|
|
1699
|
+
}
|
|
1700
|
+
else {
|
|
1701
|
+
if (_valid1) {
|
|
1702
|
+
valid5 = true;
|
|
1703
|
+
passing1 = 1;
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
if (!valid5) {
|
|
1707
|
+
const err8 = { instancePath: instancePath + "/stop", schemaPath: "#/properties/stop/oneOf", keyword: "oneOf", params: { passingSchemas: passing1 }, message: "must match exactly one schema in oneOf" };
|
|
1708
|
+
if (vErrors === null) {
|
|
1709
|
+
vErrors = [err8];
|
|
1710
|
+
}
|
|
1711
|
+
else {
|
|
1712
|
+
vErrors.push(err8);
|
|
1713
|
+
}
|
|
1714
|
+
errors++;
|
|
1715
|
+
validate24.errors = vErrors;
|
|
1716
|
+
return false;
|
|
1717
|
+
}
|
|
1718
|
+
else {
|
|
1719
|
+
errors = _errs29;
|
|
1720
|
+
if (vErrors !== null) {
|
|
1721
|
+
if (_errs29) {
|
|
1722
|
+
vErrors.length = _errs29;
|
|
1723
|
+
}
|
|
1724
|
+
else {
|
|
1725
|
+
vErrors = null;
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
var valid0 = _errs28 === errors;
|
|
1730
|
+
}
|
|
1731
|
+
else {
|
|
1732
|
+
var valid0 = true;
|
|
1733
|
+
}
|
|
1734
|
+
if (valid0) {
|
|
1735
|
+
if (data.presence_penalty !== undefined) {
|
|
1736
|
+
let data12 = data.presence_penalty;
|
|
1737
|
+
const _errs36 = errors;
|
|
1738
|
+
if (!((typeof data12 == "number") && (isFinite(data12)))) {
|
|
1739
|
+
validate24.errors = [{ instancePath: instancePath + "/presence_penalty", schemaPath: "#/properties/presence_penalty/type", keyword: "type", params: { type: "number" }, message: "must be number" }];
|
|
1740
|
+
return false;
|
|
1741
|
+
}
|
|
1742
|
+
var valid0 = _errs36 === errors;
|
|
1743
|
+
}
|
|
1744
|
+
else {
|
|
1745
|
+
var valid0 = true;
|
|
1746
|
+
}
|
|
1747
|
+
if (valid0) {
|
|
1748
|
+
if (data.frequency_penalty !== undefined) {
|
|
1749
|
+
let data13 = data.frequency_penalty;
|
|
1750
|
+
const _errs38 = errors;
|
|
1751
|
+
if (!((typeof data13 == "number") && (isFinite(data13)))) {
|
|
1752
|
+
validate24.errors = [{ instancePath: instancePath + "/frequency_penalty", schemaPath: "#/properties/frequency_penalty/type", keyword: "type", params: { type: "number" }, message: "must be number" }];
|
|
1753
|
+
return false;
|
|
1754
|
+
}
|
|
1755
|
+
var valid0 = _errs38 === errors;
|
|
1756
|
+
}
|
|
1757
|
+
else {
|
|
1758
|
+
var valid0 = true;
|
|
1759
|
+
}
|
|
1760
|
+
if (valid0) {
|
|
1761
|
+
if (data.logit_bias !== undefined) {
|
|
1762
|
+
let data14 = data.logit_bias;
|
|
1763
|
+
const _errs40 = errors;
|
|
1764
|
+
if (errors === _errs40) {
|
|
1765
|
+
if (data14 && typeof data14 == "object" && !Array.isArray(data14)) {
|
|
1766
|
+
for (const key1 in data14) {
|
|
1767
|
+
let data15 = data14[key1];
|
|
1768
|
+
const _errs43 = errors;
|
|
1769
|
+
if (!((typeof data15 == "number") && (isFinite(data15)))) {
|
|
1770
|
+
validate24.errors = [{ instancePath: instancePath + "/logit_bias/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/properties/logit_bias/additionalProperties/type", keyword: "type", params: { type: "number" }, message: "must be number" }];
|
|
1771
|
+
return false;
|
|
1772
|
+
}
|
|
1773
|
+
var valid7 = _errs43 === errors;
|
|
1774
|
+
if (!valid7) {
|
|
1775
|
+
break;
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
else {
|
|
1780
|
+
validate24.errors = [{ instancePath: instancePath + "/logit_bias", schemaPath: "#/properties/logit_bias/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
1781
|
+
return false;
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
var valid0 = _errs40 === errors;
|
|
1785
|
+
}
|
|
1786
|
+
else {
|
|
1787
|
+
var valid0 = true;
|
|
1788
|
+
}
|
|
1789
|
+
if (valid0) {
|
|
1790
|
+
if (data.tools !== undefined) {
|
|
1791
|
+
let data16 = data.tools;
|
|
1792
|
+
const _errs45 = errors;
|
|
1793
|
+
if (errors === _errs45) {
|
|
1794
|
+
if (Array.isArray(data16)) {
|
|
1795
|
+
var valid8 = true;
|
|
1796
|
+
const len3 = data16.length;
|
|
1797
|
+
for (let i3 = 0; i3 < len3; i3++) {
|
|
1798
|
+
let data17 = data16[i3];
|
|
1799
|
+
const _errs47 = errors;
|
|
1800
|
+
if (!(data17 && typeof data17 == "object" && !Array.isArray(data17))) {
|
|
1801
|
+
validate24.errors = [{ instancePath: instancePath + "/tools/" + i3, schemaPath: "#/properties/tools/items/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
1802
|
+
return false;
|
|
1803
|
+
}
|
|
1804
|
+
var valid8 = _errs47 === errors;
|
|
1805
|
+
if (!valid8) {
|
|
1806
|
+
break;
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
else {
|
|
1811
|
+
validate24.errors = [{ instancePath: instancePath + "/tools", schemaPath: "#/properties/tools/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
1812
|
+
return false;
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
var valid0 = _errs45 === errors;
|
|
1816
|
+
}
|
|
1817
|
+
else {
|
|
1818
|
+
var valid0 = true;
|
|
1819
|
+
}
|
|
1820
|
+
if (valid0) {
|
|
1821
|
+
if (data.parallel_tool_calls !== undefined) {
|
|
1822
|
+
const _errs49 = errors;
|
|
1823
|
+
if (typeof data.parallel_tool_calls !== "boolean") {
|
|
1824
|
+
validate24.errors = [{ instancePath: instancePath + "/parallel_tool_calls", schemaPath: "#/properties/parallel_tool_calls/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" }];
|
|
1825
|
+
return false;
|
|
1826
|
+
}
|
|
1827
|
+
var valid0 = _errs49 === errors;
|
|
1828
|
+
}
|
|
1829
|
+
else {
|
|
1830
|
+
var valid0 = true;
|
|
1831
|
+
}
|
|
1832
|
+
if (valid0) {
|
|
1833
|
+
if (data.response_format !== undefined) {
|
|
1834
|
+
let data19 = data.response_format;
|
|
1835
|
+
const _errs51 = errors;
|
|
1836
|
+
if (!(data19 && typeof data19 == "object" && !Array.isArray(data19))) {
|
|
1837
|
+
validate24.errors = [{ instancePath: instancePath + "/response_format", schemaPath: "#/properties/response_format/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
1838
|
+
return false;
|
|
1839
|
+
}
|
|
1840
|
+
var valid0 = _errs51 === errors;
|
|
1841
|
+
}
|
|
1842
|
+
else {
|
|
1843
|
+
var valid0 = true;
|
|
1844
|
+
}
|
|
1845
|
+
if (valid0) {
|
|
1846
|
+
if (data.stream !== undefined) {
|
|
1847
|
+
const _errs53 = errors;
|
|
1848
|
+
if (typeof data.stream !== "boolean") {
|
|
1849
|
+
validate24.errors = [{ instancePath: instancePath + "/stream", schemaPath: "#/properties/stream/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" }];
|
|
1850
|
+
return false;
|
|
1851
|
+
}
|
|
1852
|
+
var valid0 = _errs53 === errors;
|
|
1853
|
+
}
|
|
1854
|
+
else {
|
|
1855
|
+
var valid0 = true;
|
|
1856
|
+
}
|
|
1857
|
+
if (valid0) {
|
|
1858
|
+
if (data.stream_options !== undefined) {
|
|
1859
|
+
let data21 = data.stream_options;
|
|
1860
|
+
const _errs55 = errors;
|
|
1861
|
+
if (errors === _errs55) {
|
|
1862
|
+
if (data21 && typeof data21 == "object" && !Array.isArray(data21)) {
|
|
1863
|
+
let missing2;
|
|
1864
|
+
if ((data21.include_usage === undefined) && (missing2 = "include_usage")) {
|
|
1865
|
+
validate24.errors = [{ instancePath: instancePath + "/stream_options", schemaPath: "#/properties/stream_options/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" }];
|
|
1866
|
+
return false;
|
|
1867
|
+
}
|
|
1868
|
+
else {
|
|
1869
|
+
const _errs57 = errors;
|
|
1870
|
+
for (const key2 in data21) {
|
|
1871
|
+
if (!(key2 === "include_usage")) {
|
|
1872
|
+
validate24.errors = [{ instancePath: instancePath + "/stream_options", schemaPath: "#/properties/stream_options/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key2 }, message: "must NOT have additional properties" }];
|
|
1873
|
+
return false;
|
|
1874
|
+
break;
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
if (_errs57 === errors) {
|
|
1878
|
+
if (data21.include_usage !== undefined) {
|
|
1879
|
+
if (true !== data21.include_usage) {
|
|
1880
|
+
validate24.errors = [{ instancePath: instancePath + "/stream_options/include_usage", schemaPath: "#/properties/stream_options/properties/include_usage/const", keyword: "const", params: { allowedValue: true }, message: "must be equal to constant" }];
|
|
1881
|
+
return false;
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
else {
|
|
1888
|
+
validate24.errors = [{ instancePath: instancePath + "/stream_options", schemaPath: "#/properties/stream_options/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
1889
|
+
return false;
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
var valid0 = _errs55 === errors;
|
|
1893
|
+
}
|
|
1894
|
+
else {
|
|
1895
|
+
var valid0 = true;
|
|
1896
|
+
}
|
|
1897
|
+
if (valid0) {
|
|
1898
|
+
if (data.max_cost_flop !== undefined) {
|
|
1899
|
+
let data23 = data.max_cost_flop;
|
|
1900
|
+
const _errs59 = errors;
|
|
1901
|
+
if (errors === _errs59) {
|
|
1902
|
+
if ((typeof data23 == "number") && (isFinite(data23))) {
|
|
1903
|
+
if (data23 <= 0 || isNaN(data23)) {
|
|
1904
|
+
validate24.errors = [{ instancePath: instancePath + "/max_cost_flop", schemaPath: "#/properties/max_cost_flop/exclusiveMinimum", keyword: "exclusiveMinimum", params: { comparison: ">", limit: 0 }, message: "must be > 0" }];
|
|
1905
|
+
return false;
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
else {
|
|
1909
|
+
validate24.errors = [{ instancePath: instancePath + "/max_cost_flop", schemaPath: "#/properties/max_cost_flop/type", keyword: "type", params: { type: "number" }, message: "must be number" }];
|
|
1910
|
+
return false;
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
var valid0 = _errs59 === errors;
|
|
1914
|
+
}
|
|
1915
|
+
else {
|
|
1916
|
+
var valid0 = true;
|
|
1917
|
+
}
|
|
1918
|
+
if (valid0) {
|
|
1919
|
+
if (data.max_wait_ms !== undefined) {
|
|
1920
|
+
let data24 = data.max_wait_ms;
|
|
1921
|
+
const _errs61 = errors;
|
|
1922
|
+
if (!(((typeof data24 == "number") && (!(data24 % 1) && !isNaN(data24))) && (isFinite(data24)))) {
|
|
1923
|
+
validate24.errors = [{ instancePath: instancePath + "/max_wait_ms", schemaPath: "#/properties/max_wait_ms/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
1924
|
+
return false;
|
|
1925
|
+
}
|
|
1926
|
+
if (errors === _errs61) {
|
|
1927
|
+
if ((typeof data24 == "number") && (isFinite(data24))) {
|
|
1928
|
+
if (data24 > 3600000 || isNaN(data24)) {
|
|
1929
|
+
validate24.errors = [{ instancePath: instancePath + "/max_wait_ms", schemaPath: "#/properties/max_wait_ms/maximum", keyword: "maximum", params: { comparison: "<=", limit: 3600000 }, message: "must be <= 3600000" }];
|
|
1930
|
+
return false;
|
|
1931
|
+
}
|
|
1932
|
+
else {
|
|
1933
|
+
if (data24 < 1 || isNaN(data24)) {
|
|
1934
|
+
validate24.errors = [{ instancePath: instancePath + "/max_wait_ms", schemaPath: "#/properties/max_wait_ms/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" }];
|
|
1935
|
+
return false;
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
var valid0 = _errs61 === errors;
|
|
1941
|
+
}
|
|
1942
|
+
else {
|
|
1943
|
+
var valid0 = true;
|
|
1944
|
+
}
|
|
1945
|
+
if (valid0) {
|
|
1946
|
+
let missing3;
|
|
1947
|
+
if (data.max_wait_ms !== undefined && ((data.max_cost_flop === undefined) && (missing3 = "max_cost_flop"))) {
|
|
1948
|
+
validate24.errors = [{ instancePath, schemaPath: "#/dependentRequired", keyword: "dependentRequired", params: { property: "max_wait_ms",
|
|
1949
|
+
missingProperty: missing3,
|
|
1950
|
+
depsCount: 1,
|
|
1951
|
+
deps: "max_cost_flop" }, message: "must have property max_cost_flop when property max_wait_ms is present" }];
|
|
1952
|
+
return false;
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
else {
|
|
1975
|
+
validate24.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
1976
|
+
return false;
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
validate24.errors = vErrors;
|
|
1980
|
+
return errors === 0;
|
|
1981
|
+
}
|
|
1982
|
+
validate24.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
|
|
1983
|
+
export const validateChatCompletionResponse = validate25;
|
|
1984
|
+
const schema38 = { "type": "object", "required": ["id", "object", "created", "model", "choices", "usage"], "properties": { "id": { "type": "string" }, "object": { "type": "string", "const": "chat.completion" }, "created": { "type": "integer" }, "model": { "type": "string" }, "system_fingerprint": { "type": ["string", "null"] }, "choices": { "type": "array", "items": { "type": "object", "required": ["index", "message", "finish_reason"], "properties": { "index": { "type": "integer" }, "message": { "type": "object", "required": ["role", "content"], "properties": { "role": { "type": "string", "const": "assistant" }, "content": { "type": ["string", "null"] } } }, "finish_reason": { "type": "string" } } } }, "usage": { "type": "object", "required": ["prompt_tokens", "completion_tokens", "total_tokens"], "properties": { "prompt_tokens": { "type": "integer" }, "completion_tokens": { "type": "integer" }, "total_tokens": { "type": "integer" }, "gflops_used": { "type": "number" }, "cost_flop": { "type": "number" } } } } };
|
|
1985
|
+
function validate25(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
1986
|
+
let vErrors = null;
|
|
1987
|
+
let errors = 0;
|
|
1988
|
+
const evaluated0 = validate25.evaluated;
|
|
1989
|
+
if (evaluated0.dynamicProps) {
|
|
1990
|
+
evaluated0.props = undefined;
|
|
1991
|
+
}
|
|
1992
|
+
if (evaluated0.dynamicItems) {
|
|
1993
|
+
evaluated0.items = undefined;
|
|
1994
|
+
}
|
|
1995
|
+
if (errors === 0) {
|
|
1996
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1997
|
+
let missing0;
|
|
1998
|
+
if (((((((data.id === undefined) && (missing0 = "id")) || ((data.object === undefined) && (missing0 = "object"))) || ((data.created === undefined) && (missing0 = "created"))) || ((data.model === undefined) && (missing0 = "model"))) || ((data.choices === undefined) && (missing0 = "choices"))) || ((data.usage === undefined) && (missing0 = "usage"))) {
|
|
1999
|
+
validate25.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
2000
|
+
return false;
|
|
2001
|
+
}
|
|
2002
|
+
else {
|
|
2003
|
+
if (data.id !== undefined) {
|
|
2004
|
+
const _errs1 = errors;
|
|
2005
|
+
if (typeof data.id !== "string") {
|
|
2006
|
+
validate25.errors = [{ instancePath: instancePath + "/id", schemaPath: "#/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
2007
|
+
return false;
|
|
2008
|
+
}
|
|
2009
|
+
var valid0 = _errs1 === errors;
|
|
2010
|
+
}
|
|
2011
|
+
else {
|
|
2012
|
+
var valid0 = true;
|
|
2013
|
+
}
|
|
2014
|
+
if (valid0) {
|
|
2015
|
+
if (data.object !== undefined) {
|
|
2016
|
+
let data1 = data.object;
|
|
2017
|
+
const _errs3 = errors;
|
|
2018
|
+
if (typeof data1 !== "string") {
|
|
2019
|
+
validate25.errors = [{ instancePath: instancePath + "/object", schemaPath: "#/properties/object/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
2020
|
+
return false;
|
|
2021
|
+
}
|
|
2022
|
+
if ("chat.completion" !== data1) {
|
|
2023
|
+
validate25.errors = [{ instancePath: instancePath + "/object", schemaPath: "#/properties/object/const", keyword: "const", params: { allowedValue: "chat.completion" }, message: "must be equal to constant" }];
|
|
2024
|
+
return false;
|
|
2025
|
+
}
|
|
2026
|
+
var valid0 = _errs3 === errors;
|
|
2027
|
+
}
|
|
2028
|
+
else {
|
|
2029
|
+
var valid0 = true;
|
|
2030
|
+
}
|
|
2031
|
+
if (valid0) {
|
|
2032
|
+
if (data.created !== undefined) {
|
|
2033
|
+
let data2 = data.created;
|
|
2034
|
+
const _errs5 = errors;
|
|
2035
|
+
if (!(((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2))) && (isFinite(data2)))) {
|
|
2036
|
+
validate25.errors = [{ instancePath: instancePath + "/created", schemaPath: "#/properties/created/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
2037
|
+
return false;
|
|
2038
|
+
}
|
|
2039
|
+
var valid0 = _errs5 === errors;
|
|
2040
|
+
}
|
|
2041
|
+
else {
|
|
2042
|
+
var valid0 = true;
|
|
2043
|
+
}
|
|
2044
|
+
if (valid0) {
|
|
2045
|
+
if (data.model !== undefined) {
|
|
2046
|
+
const _errs7 = errors;
|
|
2047
|
+
if (typeof data.model !== "string") {
|
|
2048
|
+
validate25.errors = [{ instancePath: instancePath + "/model", schemaPath: "#/properties/model/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
2049
|
+
return false;
|
|
2050
|
+
}
|
|
2051
|
+
var valid0 = _errs7 === errors;
|
|
2052
|
+
}
|
|
2053
|
+
else {
|
|
2054
|
+
var valid0 = true;
|
|
2055
|
+
}
|
|
2056
|
+
if (valid0) {
|
|
2057
|
+
if (data.system_fingerprint !== undefined) {
|
|
2058
|
+
let data4 = data.system_fingerprint;
|
|
2059
|
+
const _errs9 = errors;
|
|
2060
|
+
if ((typeof data4 !== "string") && (data4 !== null)) {
|
|
2061
|
+
validate25.errors = [{ instancePath: instancePath + "/system_fingerprint", schemaPath: "#/properties/system_fingerprint/type", keyword: "type", params: { type: schema38.properties.system_fingerprint.type }, message: "must be string,null" }];
|
|
2062
|
+
return false;
|
|
2063
|
+
}
|
|
2064
|
+
var valid0 = _errs9 === errors;
|
|
2065
|
+
}
|
|
2066
|
+
else {
|
|
2067
|
+
var valid0 = true;
|
|
2068
|
+
}
|
|
2069
|
+
if (valid0) {
|
|
2070
|
+
if (data.choices !== undefined) {
|
|
2071
|
+
let data5 = data.choices;
|
|
2072
|
+
const _errs11 = errors;
|
|
2073
|
+
if (errors === _errs11) {
|
|
2074
|
+
if (Array.isArray(data5)) {
|
|
2075
|
+
var valid1 = true;
|
|
2076
|
+
const len0 = data5.length;
|
|
2077
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
2078
|
+
let data6 = data5[i0];
|
|
2079
|
+
const _errs13 = errors;
|
|
2080
|
+
if (errors === _errs13) {
|
|
2081
|
+
if (data6 && typeof data6 == "object" && !Array.isArray(data6)) {
|
|
2082
|
+
let missing1;
|
|
2083
|
+
if ((((data6.index === undefined) && (missing1 = "index")) || ((data6.message === undefined) && (missing1 = "message"))) || ((data6.finish_reason === undefined) && (missing1 = "finish_reason"))) {
|
|
2084
|
+
validate25.errors = [{ instancePath: instancePath + "/choices/" + i0, schemaPath: "#/properties/choices/items/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
|
|
2085
|
+
return false;
|
|
2086
|
+
}
|
|
2087
|
+
else {
|
|
2088
|
+
if (data6.index !== undefined) {
|
|
2089
|
+
let data7 = data6.index;
|
|
2090
|
+
const _errs15 = errors;
|
|
2091
|
+
if (!(((typeof data7 == "number") && (!(data7 % 1) && !isNaN(data7))) && (isFinite(data7)))) {
|
|
2092
|
+
validate25.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/index", schemaPath: "#/properties/choices/items/properties/index/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
2093
|
+
return false;
|
|
2094
|
+
}
|
|
2095
|
+
var valid2 = _errs15 === errors;
|
|
2096
|
+
}
|
|
2097
|
+
else {
|
|
2098
|
+
var valid2 = true;
|
|
2099
|
+
}
|
|
2100
|
+
if (valid2) {
|
|
2101
|
+
if (data6.message !== undefined) {
|
|
2102
|
+
let data8 = data6.message;
|
|
2103
|
+
const _errs17 = errors;
|
|
2104
|
+
if (errors === _errs17) {
|
|
2105
|
+
if (data8 && typeof data8 == "object" && !Array.isArray(data8)) {
|
|
2106
|
+
let missing2;
|
|
2107
|
+
if (((data8.role === undefined) && (missing2 = "role")) || ((data8.content === undefined) && (missing2 = "content"))) {
|
|
2108
|
+
validate25.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/message", schemaPath: "#/properties/choices/items/properties/message/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" }];
|
|
2109
|
+
return false;
|
|
2110
|
+
}
|
|
2111
|
+
else {
|
|
2112
|
+
if (data8.role !== undefined) {
|
|
2113
|
+
let data9 = data8.role;
|
|
2114
|
+
const _errs19 = errors;
|
|
2115
|
+
if (typeof data9 !== "string") {
|
|
2116
|
+
validate25.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/message/role", schemaPath: "#/properties/choices/items/properties/message/properties/role/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
2117
|
+
return false;
|
|
2118
|
+
}
|
|
2119
|
+
if ("assistant" !== data9) {
|
|
2120
|
+
validate25.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/message/role", schemaPath: "#/properties/choices/items/properties/message/properties/role/const", keyword: "const", params: { allowedValue: "assistant" }, message: "must be equal to constant" }];
|
|
2121
|
+
return false;
|
|
2122
|
+
}
|
|
2123
|
+
var valid3 = _errs19 === errors;
|
|
2124
|
+
}
|
|
2125
|
+
else {
|
|
2126
|
+
var valid3 = true;
|
|
2127
|
+
}
|
|
2128
|
+
if (valid3) {
|
|
2129
|
+
if (data8.content !== undefined) {
|
|
2130
|
+
let data10 = data8.content;
|
|
2131
|
+
const _errs21 = errors;
|
|
2132
|
+
if ((typeof data10 !== "string") && (data10 !== null)) {
|
|
2133
|
+
validate25.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/message/content", schemaPath: "#/properties/choices/items/properties/message/properties/content/type", keyword: "type", params: { type: schema38.properties.choices.items.properties.message.properties.content.type }, message: "must be string,null" }];
|
|
2134
|
+
return false;
|
|
2135
|
+
}
|
|
2136
|
+
var valid3 = _errs21 === errors;
|
|
2137
|
+
}
|
|
2138
|
+
else {
|
|
2139
|
+
var valid3 = true;
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
else {
|
|
2145
|
+
validate25.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/message", schemaPath: "#/properties/choices/items/properties/message/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
2146
|
+
return false;
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
var valid2 = _errs17 === errors;
|
|
2150
|
+
}
|
|
2151
|
+
else {
|
|
2152
|
+
var valid2 = true;
|
|
2153
|
+
}
|
|
2154
|
+
if (valid2) {
|
|
2155
|
+
if (data6.finish_reason !== undefined) {
|
|
2156
|
+
const _errs23 = errors;
|
|
2157
|
+
if (typeof data6.finish_reason !== "string") {
|
|
2158
|
+
validate25.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/finish_reason", schemaPath: "#/properties/choices/items/properties/finish_reason/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
2159
|
+
return false;
|
|
2160
|
+
}
|
|
2161
|
+
var valid2 = _errs23 === errors;
|
|
2162
|
+
}
|
|
2163
|
+
else {
|
|
2164
|
+
var valid2 = true;
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
else {
|
|
2171
|
+
validate25.errors = [{ instancePath: instancePath + "/choices/" + i0, schemaPath: "#/properties/choices/items/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
2172
|
+
return false;
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
var valid1 = _errs13 === errors;
|
|
2176
|
+
if (!valid1) {
|
|
2177
|
+
break;
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
}
|
|
2181
|
+
else {
|
|
2182
|
+
validate25.errors = [{ instancePath: instancePath + "/choices", schemaPath: "#/properties/choices/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
2183
|
+
return false;
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
var valid0 = _errs11 === errors;
|
|
2187
|
+
}
|
|
2188
|
+
else {
|
|
2189
|
+
var valid0 = true;
|
|
2190
|
+
}
|
|
2191
|
+
if (valid0) {
|
|
2192
|
+
if (data.usage !== undefined) {
|
|
2193
|
+
let data12 = data.usage;
|
|
2194
|
+
const _errs25 = errors;
|
|
2195
|
+
if (errors === _errs25) {
|
|
2196
|
+
if (data12 && typeof data12 == "object" && !Array.isArray(data12)) {
|
|
2197
|
+
let missing3;
|
|
2198
|
+
if ((((data12.prompt_tokens === undefined) && (missing3 = "prompt_tokens")) || ((data12.completion_tokens === undefined) && (missing3 = "completion_tokens"))) || ((data12.total_tokens === undefined) && (missing3 = "total_tokens"))) {
|
|
2199
|
+
validate25.errors = [{ instancePath: instancePath + "/usage", schemaPath: "#/properties/usage/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" }];
|
|
2200
|
+
return false;
|
|
2201
|
+
}
|
|
2202
|
+
else {
|
|
2203
|
+
if (data12.prompt_tokens !== undefined) {
|
|
2204
|
+
let data13 = data12.prompt_tokens;
|
|
2205
|
+
const _errs27 = errors;
|
|
2206
|
+
if (!(((typeof data13 == "number") && (!(data13 % 1) && !isNaN(data13))) && (isFinite(data13)))) {
|
|
2207
|
+
validate25.errors = [{ instancePath: instancePath + "/usage/prompt_tokens", schemaPath: "#/properties/usage/properties/prompt_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
2208
|
+
return false;
|
|
2209
|
+
}
|
|
2210
|
+
var valid4 = _errs27 === errors;
|
|
2211
|
+
}
|
|
2212
|
+
else {
|
|
2213
|
+
var valid4 = true;
|
|
2214
|
+
}
|
|
2215
|
+
if (valid4) {
|
|
2216
|
+
if (data12.completion_tokens !== undefined) {
|
|
2217
|
+
let data14 = data12.completion_tokens;
|
|
2218
|
+
const _errs29 = errors;
|
|
2219
|
+
if (!(((typeof data14 == "number") && (!(data14 % 1) && !isNaN(data14))) && (isFinite(data14)))) {
|
|
2220
|
+
validate25.errors = [{ instancePath: instancePath + "/usage/completion_tokens", schemaPath: "#/properties/usage/properties/completion_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
2221
|
+
return false;
|
|
2222
|
+
}
|
|
2223
|
+
var valid4 = _errs29 === errors;
|
|
2224
|
+
}
|
|
2225
|
+
else {
|
|
2226
|
+
var valid4 = true;
|
|
2227
|
+
}
|
|
2228
|
+
if (valid4) {
|
|
2229
|
+
if (data12.total_tokens !== undefined) {
|
|
2230
|
+
let data15 = data12.total_tokens;
|
|
2231
|
+
const _errs31 = errors;
|
|
2232
|
+
if (!(((typeof data15 == "number") && (!(data15 % 1) && !isNaN(data15))) && (isFinite(data15)))) {
|
|
2233
|
+
validate25.errors = [{ instancePath: instancePath + "/usage/total_tokens", schemaPath: "#/properties/usage/properties/total_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
2234
|
+
return false;
|
|
2235
|
+
}
|
|
2236
|
+
var valid4 = _errs31 === errors;
|
|
2237
|
+
}
|
|
2238
|
+
else {
|
|
2239
|
+
var valid4 = true;
|
|
2240
|
+
}
|
|
2241
|
+
if (valid4) {
|
|
2242
|
+
if (data12.gflops_used !== undefined) {
|
|
2243
|
+
let data16 = data12.gflops_used;
|
|
2244
|
+
const _errs33 = errors;
|
|
2245
|
+
if (!((typeof data16 == "number") && (isFinite(data16)))) {
|
|
2246
|
+
validate25.errors = [{ instancePath: instancePath + "/usage/gflops_used", schemaPath: "#/properties/usage/properties/gflops_used/type", keyword: "type", params: { type: "number" }, message: "must be number" }];
|
|
2247
|
+
return false;
|
|
2248
|
+
}
|
|
2249
|
+
var valid4 = _errs33 === errors;
|
|
2250
|
+
}
|
|
2251
|
+
else {
|
|
2252
|
+
var valid4 = true;
|
|
2253
|
+
}
|
|
2254
|
+
if (valid4) {
|
|
2255
|
+
if (data12.cost_flop !== undefined) {
|
|
2256
|
+
let data17 = data12.cost_flop;
|
|
2257
|
+
const _errs35 = errors;
|
|
2258
|
+
if (!((typeof data17 == "number") && (isFinite(data17)))) {
|
|
2259
|
+
validate25.errors = [{ instancePath: instancePath + "/usage/cost_flop", schemaPath: "#/properties/usage/properties/cost_flop/type", keyword: "type", params: { type: "number" }, message: "must be number" }];
|
|
2260
|
+
return false;
|
|
2261
|
+
}
|
|
2262
|
+
var valid4 = _errs35 === errors;
|
|
2263
|
+
}
|
|
2264
|
+
else {
|
|
2265
|
+
var valid4 = true;
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
else {
|
|
2274
|
+
validate25.errors = [{ instancePath: instancePath + "/usage", schemaPath: "#/properties/usage/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
2275
|
+
return false;
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
var valid0 = _errs25 === errors;
|
|
2279
|
+
}
|
|
2280
|
+
else {
|
|
2281
|
+
var valid0 = true;
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
else {
|
|
2292
|
+
validate25.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
2293
|
+
return false;
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
validate25.errors = vErrors;
|
|
2297
|
+
return errors === 0;
|
|
2298
|
+
}
|
|
2299
|
+
validate25.evaluated = { "props": { "id": true, "object": true, "created": true, "model": true, "system_fingerprint": true, "choices": true, "usage": true }, "dynamicProps": false, "dynamicItems": false };
|
|
2300
|
+
export const validateChatCompletionChunk = validate26;
|
|
2301
|
+
const schema39 = { "type": "object", "required": ["id", "object", "created", "model", "choices"], "description": "One decoded SSE JSON payload. All chunks share id, model and created.\nThe first delta is role assistant with empty content. Content precedes\ntool calls; the gateway currently emits all calls in one delta after\nsettlement. A finish delta is empty with a non-null finish_reason.\nSuccess always includes one final choices-empty usage/receipt chunk,\nregardless of stream_options, followed by the literal [DONE].\nA finish_reason of error instead requires a stream error then [DONE].\n", "properties": { "id": { "type": "string", "pattern": "[\\s\\S]" }, "object": { "type": "string", "const": "chat.completion.chunk" }, "created": { "type": "integer" }, "model": { "type": "string", "pattern": "[\\s\\S]" }, "choices": { "type": "array", "maxItems": 1, "items": { "type": "object", "required": ["index", "delta", "finish_reason"], "properties": { "index": { "type": "integer", "const": 0 }, "delta": { "type": "object", "additionalProperties": false, "properties": { "role": { "type": "string", "const": "assistant" }, "content": { "type": "string" }, "tool_calls": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/ChatCompletionToolCallFragment" } } } }, "finish_reason": { "type": ["string", "null"], "pattern": "[\\s\\S]" } } } }, "usage": { "$ref": "#/$defs/ChatCompletionStreamUsage" }, "x_flop_receipt": { "type": "object", "description": "Gateway-reported receipt data, without independent verification." } }, "oneOf": [{ "properties": { "choices": { "type": "array", "minItems": 1 }, "usage": false, "x_flop_receipt": false } }, { "required": ["usage", "x_flop_receipt"], "properties": { "choices": { "type": "array", "maxItems": 0 }, "usage": { "$ref": "#/$defs/ChatCompletionStreamUsage" }, "x_flop_receipt": { "type": "object" } } }] };
|
|
2302
|
+
const schema40 = { "type": "object", "required": ["prompt_tokens", "completion_tokens", "total_tokens"], "properties": { "prompt_tokens": { "type": "integer", "minimum": 0 }, "completion_tokens": { "type": "integer", "minimum": 0 }, "total_tokens": { "type": "integer", "minimum": 0 } } };
|
|
2303
|
+
const schema41 = { "type": "object", "required": ["index"], "description": "Index selects a call. Its first fragment supplies id and type function;\nsubsequent id/type values must agree. Concatenate function.name and\nfunction.arguments fragments in arrival order for that index. Completed\ncalls require a nonempty name and an arguments string. The gateway today\nsends complete calls in one frame; clients may also assemble fragments.\n", "properties": { "index": { "type": "integer", "minimum": 0 }, "id": { "type": "string", "pattern": "[\\s\\S]" }, "type": { "type": "string", "const": "function" }, "function": { "type": "object", "additionalProperties": false, "properties": { "name": { "type": "string" }, "arguments": { "type": "string" } }, "anyOf": [{ "required": ["name"], "properties": { "name": {} } }, { "required": ["arguments"], "properties": { "arguments": {} } }] } }, "anyOf": [{ "required": ["id"], "properties": { "id": {} } }, { "required": ["type"], "properties": { "type": {} } }, { "required": ["function"], "properties": { "function": {} } }] };
|
|
2304
|
+
const pattern4 = new RegExp("[\\s\\S]", "u");
|
|
2305
|
+
function validate26(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
2306
|
+
let vErrors = null;
|
|
2307
|
+
let errors = 0;
|
|
2308
|
+
const evaluated0 = validate26.evaluated;
|
|
2309
|
+
if (evaluated0.dynamicProps) {
|
|
2310
|
+
evaluated0.props = undefined;
|
|
2311
|
+
}
|
|
2312
|
+
if (evaluated0.dynamicItems) {
|
|
2313
|
+
evaluated0.items = undefined;
|
|
2314
|
+
}
|
|
2315
|
+
const _errs1 = errors;
|
|
2316
|
+
let valid0 = false;
|
|
2317
|
+
let passing0 = null;
|
|
2318
|
+
const _errs2 = errors;
|
|
2319
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2320
|
+
if (data.choices !== undefined) {
|
|
2321
|
+
let data0 = data.choices;
|
|
2322
|
+
const _errs3 = errors;
|
|
2323
|
+
if (errors === _errs3) {
|
|
2324
|
+
if (Array.isArray(data0)) {
|
|
2325
|
+
if (data0.length < 1) {
|
|
2326
|
+
const err0 = { instancePath: instancePath + "/choices", schemaPath: "#/oneOf/0/properties/choices/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
2327
|
+
if (vErrors === null) {
|
|
2328
|
+
vErrors = [err0];
|
|
2329
|
+
}
|
|
2330
|
+
else {
|
|
2331
|
+
vErrors.push(err0);
|
|
2332
|
+
}
|
|
2333
|
+
errors++;
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
else {
|
|
2337
|
+
const err1 = { instancePath: instancePath + "/choices", schemaPath: "#/oneOf/0/properties/choices/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
2338
|
+
if (vErrors === null) {
|
|
2339
|
+
vErrors = [err1];
|
|
2340
|
+
}
|
|
2341
|
+
else {
|
|
2342
|
+
vErrors.push(err1);
|
|
2343
|
+
}
|
|
2344
|
+
errors++;
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
var valid1 = _errs3 === errors;
|
|
2348
|
+
}
|
|
2349
|
+
else {
|
|
2350
|
+
var valid1 = true;
|
|
2351
|
+
}
|
|
2352
|
+
if (valid1) {
|
|
2353
|
+
if (data.usage !== undefined) {
|
|
2354
|
+
var valid1 = false;
|
|
2355
|
+
const err2 = { instancePath: instancePath + "/usage", schemaPath: "#/oneOf/0/properties/usage/false schema", keyword: "false schema", params: {}, message: "boolean schema is false" };
|
|
2356
|
+
if (vErrors === null) {
|
|
2357
|
+
vErrors = [err2];
|
|
2358
|
+
}
|
|
2359
|
+
else {
|
|
2360
|
+
vErrors.push(err2);
|
|
2361
|
+
}
|
|
2362
|
+
errors++;
|
|
2363
|
+
}
|
|
2364
|
+
else {
|
|
2365
|
+
var valid1 = true;
|
|
2366
|
+
}
|
|
2367
|
+
if (valid1) {
|
|
2368
|
+
if (data.x_flop_receipt !== undefined) {
|
|
2369
|
+
var valid1 = false;
|
|
2370
|
+
const err3 = { instancePath: instancePath + "/x_flop_receipt", schemaPath: "#/oneOf/0/properties/x_flop_receipt/false schema", keyword: "false schema", params: {}, message: "boolean schema is false" };
|
|
2371
|
+
if (vErrors === null) {
|
|
2372
|
+
vErrors = [err3];
|
|
2373
|
+
}
|
|
2374
|
+
else {
|
|
2375
|
+
vErrors.push(err3);
|
|
2376
|
+
}
|
|
2377
|
+
errors++;
|
|
2378
|
+
}
|
|
2379
|
+
else {
|
|
2380
|
+
var valid1 = true;
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
var _valid0 = _errs2 === errors;
|
|
2386
|
+
if (_valid0) {
|
|
2387
|
+
valid0 = true;
|
|
2388
|
+
passing0 = 0;
|
|
2389
|
+
var props0 = {};
|
|
2390
|
+
props0.choices = true;
|
|
2391
|
+
props0.usage = true;
|
|
2392
|
+
props0.x_flop_receipt = true;
|
|
2393
|
+
}
|
|
2394
|
+
const _errs5 = errors;
|
|
2395
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2396
|
+
let missing0;
|
|
2397
|
+
if (((data.usage === undefined) && (missing0 = "usage")) || ((data.x_flop_receipt === undefined) && (missing0 = "x_flop_receipt"))) {
|
|
2398
|
+
const err4 = { instancePath, schemaPath: "#/oneOf/1/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" };
|
|
2399
|
+
if (vErrors === null) {
|
|
2400
|
+
vErrors = [err4];
|
|
2401
|
+
}
|
|
2402
|
+
else {
|
|
2403
|
+
vErrors.push(err4);
|
|
2404
|
+
}
|
|
2405
|
+
errors++;
|
|
2406
|
+
}
|
|
2407
|
+
else {
|
|
2408
|
+
if (data.choices !== undefined) {
|
|
2409
|
+
let data3 = data.choices;
|
|
2410
|
+
const _errs6 = errors;
|
|
2411
|
+
if (errors === _errs6) {
|
|
2412
|
+
if (Array.isArray(data3)) {
|
|
2413
|
+
if (data3.length > 0) {
|
|
2414
|
+
const err5 = { instancePath: instancePath + "/choices", schemaPath: "#/oneOf/1/properties/choices/maxItems", keyword: "maxItems", params: { limit: 0 }, message: "must NOT have more than 0 items" };
|
|
2415
|
+
if (vErrors === null) {
|
|
2416
|
+
vErrors = [err5];
|
|
2417
|
+
}
|
|
2418
|
+
else {
|
|
2419
|
+
vErrors.push(err5);
|
|
2420
|
+
}
|
|
2421
|
+
errors++;
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
else {
|
|
2425
|
+
const err6 = { instancePath: instancePath + "/choices", schemaPath: "#/oneOf/1/properties/choices/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
2426
|
+
if (vErrors === null) {
|
|
2427
|
+
vErrors = [err6];
|
|
2428
|
+
}
|
|
2429
|
+
else {
|
|
2430
|
+
vErrors.push(err6);
|
|
2431
|
+
}
|
|
2432
|
+
errors++;
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
var valid2 = _errs6 === errors;
|
|
2436
|
+
}
|
|
2437
|
+
else {
|
|
2438
|
+
var valid2 = true;
|
|
2439
|
+
}
|
|
2440
|
+
if (valid2) {
|
|
2441
|
+
if (data.usage !== undefined) {
|
|
2442
|
+
let data4 = data.usage;
|
|
2443
|
+
const _errs8 = errors;
|
|
2444
|
+
const _errs9 = errors;
|
|
2445
|
+
if (errors === _errs9) {
|
|
2446
|
+
if (data4 && typeof data4 == "object" && !Array.isArray(data4)) {
|
|
2447
|
+
let missing1;
|
|
2448
|
+
if ((((data4.prompt_tokens === undefined) && (missing1 = "prompt_tokens")) || ((data4.completion_tokens === undefined) && (missing1 = "completion_tokens"))) || ((data4.total_tokens === undefined) && (missing1 = "total_tokens"))) {
|
|
2449
|
+
const err7 = { instancePath: instancePath + "/usage", schemaPath: "#/$defs/ChatCompletionStreamUsage/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" };
|
|
2450
|
+
if (vErrors === null) {
|
|
2451
|
+
vErrors = [err7];
|
|
2452
|
+
}
|
|
2453
|
+
else {
|
|
2454
|
+
vErrors.push(err7);
|
|
2455
|
+
}
|
|
2456
|
+
errors++;
|
|
2457
|
+
}
|
|
2458
|
+
else {
|
|
2459
|
+
if (data4.prompt_tokens !== undefined) {
|
|
2460
|
+
let data5 = data4.prompt_tokens;
|
|
2461
|
+
const _errs11 = errors;
|
|
2462
|
+
if (!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))) {
|
|
2463
|
+
const err8 = { instancePath: instancePath + "/usage/prompt_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/prompt_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
|
|
2464
|
+
if (vErrors === null) {
|
|
2465
|
+
vErrors = [err8];
|
|
2466
|
+
}
|
|
2467
|
+
else {
|
|
2468
|
+
vErrors.push(err8);
|
|
2469
|
+
}
|
|
2470
|
+
errors++;
|
|
2471
|
+
}
|
|
2472
|
+
if (errors === _errs11) {
|
|
2473
|
+
if ((typeof data5 == "number") && (isFinite(data5))) {
|
|
2474
|
+
if (data5 < 0 || isNaN(data5)) {
|
|
2475
|
+
const err9 = { instancePath: instancePath + "/usage/prompt_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/prompt_tokens/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
|
|
2476
|
+
if (vErrors === null) {
|
|
2477
|
+
vErrors = [err9];
|
|
2478
|
+
}
|
|
2479
|
+
else {
|
|
2480
|
+
vErrors.push(err9);
|
|
2481
|
+
}
|
|
2482
|
+
errors++;
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
var valid4 = _errs11 === errors;
|
|
2487
|
+
}
|
|
2488
|
+
else {
|
|
2489
|
+
var valid4 = true;
|
|
2490
|
+
}
|
|
2491
|
+
if (valid4) {
|
|
2492
|
+
if (data4.completion_tokens !== undefined) {
|
|
2493
|
+
let data6 = data4.completion_tokens;
|
|
2494
|
+
const _errs13 = errors;
|
|
2495
|
+
if (!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))) {
|
|
2496
|
+
const err10 = { instancePath: instancePath + "/usage/completion_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/completion_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
|
|
2497
|
+
if (vErrors === null) {
|
|
2498
|
+
vErrors = [err10];
|
|
2499
|
+
}
|
|
2500
|
+
else {
|
|
2501
|
+
vErrors.push(err10);
|
|
2502
|
+
}
|
|
2503
|
+
errors++;
|
|
2504
|
+
}
|
|
2505
|
+
if (errors === _errs13) {
|
|
2506
|
+
if ((typeof data6 == "number") && (isFinite(data6))) {
|
|
2507
|
+
if (data6 < 0 || isNaN(data6)) {
|
|
2508
|
+
const err11 = { instancePath: instancePath + "/usage/completion_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/completion_tokens/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
|
|
2509
|
+
if (vErrors === null) {
|
|
2510
|
+
vErrors = [err11];
|
|
2511
|
+
}
|
|
2512
|
+
else {
|
|
2513
|
+
vErrors.push(err11);
|
|
2514
|
+
}
|
|
2515
|
+
errors++;
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
var valid4 = _errs13 === errors;
|
|
2520
|
+
}
|
|
2521
|
+
else {
|
|
2522
|
+
var valid4 = true;
|
|
2523
|
+
}
|
|
2524
|
+
if (valid4) {
|
|
2525
|
+
if (data4.total_tokens !== undefined) {
|
|
2526
|
+
let data7 = data4.total_tokens;
|
|
2527
|
+
const _errs15 = errors;
|
|
2528
|
+
if (!(((typeof data7 == "number") && (!(data7 % 1) && !isNaN(data7))) && (isFinite(data7)))) {
|
|
2529
|
+
const err12 = { instancePath: instancePath + "/usage/total_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/total_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
|
|
2530
|
+
if (vErrors === null) {
|
|
2531
|
+
vErrors = [err12];
|
|
2532
|
+
}
|
|
2533
|
+
else {
|
|
2534
|
+
vErrors.push(err12);
|
|
2535
|
+
}
|
|
2536
|
+
errors++;
|
|
2537
|
+
}
|
|
2538
|
+
if (errors === _errs15) {
|
|
2539
|
+
if ((typeof data7 == "number") && (isFinite(data7))) {
|
|
2540
|
+
if (data7 < 0 || isNaN(data7)) {
|
|
2541
|
+
const err13 = { instancePath: instancePath + "/usage/total_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/total_tokens/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
|
|
2542
|
+
if (vErrors === null) {
|
|
2543
|
+
vErrors = [err13];
|
|
2544
|
+
}
|
|
2545
|
+
else {
|
|
2546
|
+
vErrors.push(err13);
|
|
2547
|
+
}
|
|
2548
|
+
errors++;
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
var valid4 = _errs15 === errors;
|
|
2553
|
+
}
|
|
2554
|
+
else {
|
|
2555
|
+
var valid4 = true;
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
else {
|
|
2562
|
+
const err14 = { instancePath: instancePath + "/usage", schemaPath: "#/$defs/ChatCompletionStreamUsage/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
2563
|
+
if (vErrors === null) {
|
|
2564
|
+
vErrors = [err14];
|
|
2565
|
+
}
|
|
2566
|
+
else {
|
|
2567
|
+
vErrors.push(err14);
|
|
2568
|
+
}
|
|
2569
|
+
errors++;
|
|
2570
|
+
}
|
|
2571
|
+
}
|
|
2572
|
+
var valid2 = _errs8 === errors;
|
|
2573
|
+
}
|
|
2574
|
+
else {
|
|
2575
|
+
var valid2 = true;
|
|
2576
|
+
}
|
|
2577
|
+
if (valid2) {
|
|
2578
|
+
if (data.x_flop_receipt !== undefined) {
|
|
2579
|
+
let data8 = data.x_flop_receipt;
|
|
2580
|
+
const _errs17 = errors;
|
|
2581
|
+
if (!(data8 && typeof data8 == "object" && !Array.isArray(data8))) {
|
|
2582
|
+
const err15 = { instancePath: instancePath + "/x_flop_receipt", schemaPath: "#/oneOf/1/properties/x_flop_receipt/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
2583
|
+
if (vErrors === null) {
|
|
2584
|
+
vErrors = [err15];
|
|
2585
|
+
}
|
|
2586
|
+
else {
|
|
2587
|
+
vErrors.push(err15);
|
|
2588
|
+
}
|
|
2589
|
+
errors++;
|
|
2590
|
+
}
|
|
2591
|
+
var valid2 = _errs17 === errors;
|
|
2592
|
+
}
|
|
2593
|
+
else {
|
|
2594
|
+
var valid2 = true;
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2600
|
+
var _valid0 = _errs5 === errors;
|
|
2601
|
+
if (_valid0 && valid0) {
|
|
2602
|
+
valid0 = false;
|
|
2603
|
+
passing0 = [passing0, 1];
|
|
2604
|
+
}
|
|
2605
|
+
else {
|
|
2606
|
+
if (_valid0) {
|
|
2607
|
+
valid0 = true;
|
|
2608
|
+
passing0 = 1;
|
|
2609
|
+
if (props0 !== true) {
|
|
2610
|
+
props0 = props0 || {};
|
|
2611
|
+
props0.choices = true;
|
|
2612
|
+
props0.usage = true;
|
|
2613
|
+
props0.x_flop_receipt = true;
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
if (!valid0) {
|
|
2618
|
+
const err16 = { instancePath, schemaPath: "#/oneOf", keyword: "oneOf", params: { passingSchemas: passing0 }, message: "must match exactly one schema in oneOf" };
|
|
2619
|
+
if (vErrors === null) {
|
|
2620
|
+
vErrors = [err16];
|
|
2621
|
+
}
|
|
2622
|
+
else {
|
|
2623
|
+
vErrors.push(err16);
|
|
2624
|
+
}
|
|
2625
|
+
errors++;
|
|
2626
|
+
validate26.errors = vErrors;
|
|
2627
|
+
return false;
|
|
2628
|
+
}
|
|
2629
|
+
else {
|
|
2630
|
+
errors = _errs1;
|
|
2631
|
+
if (vErrors !== null) {
|
|
2632
|
+
if (_errs1) {
|
|
2633
|
+
vErrors.length = _errs1;
|
|
2634
|
+
}
|
|
2635
|
+
else {
|
|
2636
|
+
vErrors = null;
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
if (errors === 0) {
|
|
2641
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2642
|
+
let missing2;
|
|
2643
|
+
if ((((((data.id === undefined) && (missing2 = "id")) || ((data.object === undefined) && (missing2 = "object"))) || ((data.created === undefined) && (missing2 = "created"))) || ((data.model === undefined) && (missing2 = "model"))) || ((data.choices === undefined) && (missing2 = "choices"))) {
|
|
2644
|
+
validate26.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" }];
|
|
2645
|
+
return false;
|
|
2646
|
+
}
|
|
2647
|
+
else {
|
|
2648
|
+
if (props0 !== true) {
|
|
2649
|
+
props0 = props0 || {};
|
|
2650
|
+
props0.id = true;
|
|
2651
|
+
props0.object = true;
|
|
2652
|
+
props0.created = true;
|
|
2653
|
+
props0.model = true;
|
|
2654
|
+
props0.choices = true;
|
|
2655
|
+
props0.usage = true;
|
|
2656
|
+
props0.x_flop_receipt = true;
|
|
2657
|
+
}
|
|
2658
|
+
if (data.id !== undefined) {
|
|
2659
|
+
let data9 = data.id;
|
|
2660
|
+
const _errs19 = errors;
|
|
2661
|
+
if (errors === _errs19) {
|
|
2662
|
+
if (typeof data9 === "string") {
|
|
2663
|
+
if (!pattern4.test(data9)) {
|
|
2664
|
+
validate26.errors = [{ instancePath: instancePath + "/id", schemaPath: "#/properties/id/pattern", keyword: "pattern", params: { pattern: "[\\s\\S]" }, message: "must match pattern \"" + "[\\s\\S]" + "\"" }];
|
|
2665
|
+
return false;
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
else {
|
|
2669
|
+
validate26.errors = [{ instancePath: instancePath + "/id", schemaPath: "#/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
2670
|
+
return false;
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
var valid5 = _errs19 === errors;
|
|
2674
|
+
}
|
|
2675
|
+
else {
|
|
2676
|
+
var valid5 = true;
|
|
2677
|
+
}
|
|
2678
|
+
if (valid5) {
|
|
2679
|
+
if (data.object !== undefined) {
|
|
2680
|
+
let data10 = data.object;
|
|
2681
|
+
const _errs21 = errors;
|
|
2682
|
+
if (typeof data10 !== "string") {
|
|
2683
|
+
validate26.errors = [{ instancePath: instancePath + "/object", schemaPath: "#/properties/object/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
2684
|
+
return false;
|
|
2685
|
+
}
|
|
2686
|
+
if ("chat.completion.chunk" !== data10) {
|
|
2687
|
+
validate26.errors = [{ instancePath: instancePath + "/object", schemaPath: "#/properties/object/const", keyword: "const", params: { allowedValue: "chat.completion.chunk" }, message: "must be equal to constant" }];
|
|
2688
|
+
return false;
|
|
2689
|
+
}
|
|
2690
|
+
var valid5 = _errs21 === errors;
|
|
2691
|
+
}
|
|
2692
|
+
else {
|
|
2693
|
+
var valid5 = true;
|
|
2694
|
+
}
|
|
2695
|
+
if (valid5) {
|
|
2696
|
+
if (data.created !== undefined) {
|
|
2697
|
+
let data11 = data.created;
|
|
2698
|
+
const _errs23 = errors;
|
|
2699
|
+
if (!(((typeof data11 == "number") && (!(data11 % 1) && !isNaN(data11))) && (isFinite(data11)))) {
|
|
2700
|
+
validate26.errors = [{ instancePath: instancePath + "/created", schemaPath: "#/properties/created/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
2701
|
+
return false;
|
|
2702
|
+
}
|
|
2703
|
+
var valid5 = _errs23 === errors;
|
|
2704
|
+
}
|
|
2705
|
+
else {
|
|
2706
|
+
var valid5 = true;
|
|
2707
|
+
}
|
|
2708
|
+
if (valid5) {
|
|
2709
|
+
if (data.model !== undefined) {
|
|
2710
|
+
let data12 = data.model;
|
|
2711
|
+
const _errs25 = errors;
|
|
2712
|
+
if (errors === _errs25) {
|
|
2713
|
+
if (typeof data12 === "string") {
|
|
2714
|
+
if (!pattern4.test(data12)) {
|
|
2715
|
+
validate26.errors = [{ instancePath: instancePath + "/model", schemaPath: "#/properties/model/pattern", keyword: "pattern", params: { pattern: "[\\s\\S]" }, message: "must match pattern \"" + "[\\s\\S]" + "\"" }];
|
|
2716
|
+
return false;
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
else {
|
|
2720
|
+
validate26.errors = [{ instancePath: instancePath + "/model", schemaPath: "#/properties/model/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
2721
|
+
return false;
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
var valid5 = _errs25 === errors;
|
|
2725
|
+
}
|
|
2726
|
+
else {
|
|
2727
|
+
var valid5 = true;
|
|
2728
|
+
}
|
|
2729
|
+
if (valid5) {
|
|
2730
|
+
if (data.choices !== undefined) {
|
|
2731
|
+
let data13 = data.choices;
|
|
2732
|
+
const _errs27 = errors;
|
|
2733
|
+
if (errors === _errs27) {
|
|
2734
|
+
if (Array.isArray(data13)) {
|
|
2735
|
+
if (data13.length > 1) {
|
|
2736
|
+
validate26.errors = [{ instancePath: instancePath + "/choices", schemaPath: "#/properties/choices/maxItems", keyword: "maxItems", params: { limit: 1 }, message: "must NOT have more than 1 items" }];
|
|
2737
|
+
return false;
|
|
2738
|
+
}
|
|
2739
|
+
else {
|
|
2740
|
+
var valid6 = true;
|
|
2741
|
+
const len0 = data13.length;
|
|
2742
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
2743
|
+
let data14 = data13[i0];
|
|
2744
|
+
const _errs29 = errors;
|
|
2745
|
+
if (errors === _errs29) {
|
|
2746
|
+
if (data14 && typeof data14 == "object" && !Array.isArray(data14)) {
|
|
2747
|
+
let missing3;
|
|
2748
|
+
if ((((data14.index === undefined) && (missing3 = "index")) || ((data14.delta === undefined) && (missing3 = "delta"))) || ((data14.finish_reason === undefined) && (missing3 = "finish_reason"))) {
|
|
2749
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0, schemaPath: "#/properties/choices/items/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" }];
|
|
2750
|
+
return false;
|
|
2751
|
+
}
|
|
2752
|
+
else {
|
|
2753
|
+
if (data14.index !== undefined) {
|
|
2754
|
+
let data15 = data14.index;
|
|
2755
|
+
const _errs31 = errors;
|
|
2756
|
+
if (!(((typeof data15 == "number") && (!(data15 % 1) && !isNaN(data15))) && (isFinite(data15)))) {
|
|
2757
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/index", schemaPath: "#/properties/choices/items/properties/index/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
2758
|
+
return false;
|
|
2759
|
+
}
|
|
2760
|
+
if (0 !== data15) {
|
|
2761
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/index", schemaPath: "#/properties/choices/items/properties/index/const", keyword: "const", params: { allowedValue: 0 }, message: "must be equal to constant" }];
|
|
2762
|
+
return false;
|
|
2763
|
+
}
|
|
2764
|
+
var valid7 = _errs31 === errors;
|
|
2765
|
+
}
|
|
2766
|
+
else {
|
|
2767
|
+
var valid7 = true;
|
|
2768
|
+
}
|
|
2769
|
+
if (valid7) {
|
|
2770
|
+
if (data14.delta !== undefined) {
|
|
2771
|
+
let data16 = data14.delta;
|
|
2772
|
+
const _errs33 = errors;
|
|
2773
|
+
if (errors === _errs33) {
|
|
2774
|
+
if (data16 && typeof data16 == "object" && !Array.isArray(data16)) {
|
|
2775
|
+
const _errs35 = errors;
|
|
2776
|
+
for (const key0 in data16) {
|
|
2777
|
+
if (!(((key0 === "role") || (key0 === "content")) || (key0 === "tool_calls"))) {
|
|
2778
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta", schemaPath: "#/properties/choices/items/properties/delta/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
|
|
2779
|
+
return false;
|
|
2780
|
+
break;
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
if (_errs35 === errors) {
|
|
2784
|
+
if (data16.role !== undefined) {
|
|
2785
|
+
let data17 = data16.role;
|
|
2786
|
+
const _errs36 = errors;
|
|
2787
|
+
if (typeof data17 !== "string") {
|
|
2788
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta/role", schemaPath: "#/properties/choices/items/properties/delta/properties/role/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
2789
|
+
return false;
|
|
2790
|
+
}
|
|
2791
|
+
if ("assistant" !== data17) {
|
|
2792
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta/role", schemaPath: "#/properties/choices/items/properties/delta/properties/role/const", keyword: "const", params: { allowedValue: "assistant" }, message: "must be equal to constant" }];
|
|
2793
|
+
return false;
|
|
2794
|
+
}
|
|
2795
|
+
var valid8 = _errs36 === errors;
|
|
2796
|
+
}
|
|
2797
|
+
else {
|
|
2798
|
+
var valid8 = true;
|
|
2799
|
+
}
|
|
2800
|
+
if (valid8) {
|
|
2801
|
+
if (data16.content !== undefined) {
|
|
2802
|
+
const _errs38 = errors;
|
|
2803
|
+
if (typeof data16.content !== "string") {
|
|
2804
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta/content", schemaPath: "#/properties/choices/items/properties/delta/properties/content/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
2805
|
+
return false;
|
|
2806
|
+
}
|
|
2807
|
+
var valid8 = _errs38 === errors;
|
|
2808
|
+
}
|
|
2809
|
+
else {
|
|
2810
|
+
var valid8 = true;
|
|
2811
|
+
}
|
|
2812
|
+
if (valid8) {
|
|
2813
|
+
if (data16.tool_calls !== undefined) {
|
|
2814
|
+
let data19 = data16.tool_calls;
|
|
2815
|
+
const _errs40 = errors;
|
|
2816
|
+
if (errors === _errs40) {
|
|
2817
|
+
if (Array.isArray(data19)) {
|
|
2818
|
+
if (data19.length < 1) {
|
|
2819
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls", schemaPath: "#/properties/choices/items/properties/delta/properties/tool_calls/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" }];
|
|
2820
|
+
return false;
|
|
2821
|
+
}
|
|
2822
|
+
else {
|
|
2823
|
+
var valid9 = true;
|
|
2824
|
+
const len1 = data19.length;
|
|
2825
|
+
for (let i1 = 0; i1 < len1; i1++) {
|
|
2826
|
+
let data20 = data19[i1];
|
|
2827
|
+
const _errs42 = errors;
|
|
2828
|
+
const _errs43 = errors;
|
|
2829
|
+
const _errs45 = errors;
|
|
2830
|
+
let valid11 = false;
|
|
2831
|
+
const _errs46 = errors;
|
|
2832
|
+
if (data20 && typeof data20 == "object" && !Array.isArray(data20)) {
|
|
2833
|
+
let missing4;
|
|
2834
|
+
if ((data20.id === undefined) && (missing4 = "id")) {
|
|
2835
|
+
const err17 = { instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1, schemaPath: "#/$defs/ChatCompletionToolCallFragment/anyOf/0/required", keyword: "required", params: { missingProperty: missing4 }, message: "must have required property '" + missing4 + "'" };
|
|
2836
|
+
if (vErrors === null) {
|
|
2837
|
+
vErrors = [err17];
|
|
2838
|
+
}
|
|
2839
|
+
else {
|
|
2840
|
+
vErrors.push(err17);
|
|
2841
|
+
}
|
|
2842
|
+
errors++;
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
var _valid1 = _errs46 === errors;
|
|
2846
|
+
valid11 = valid11 || _valid1;
|
|
2847
|
+
if (_valid1) {
|
|
2848
|
+
var props1 = {};
|
|
2849
|
+
props1.id = true;
|
|
2850
|
+
}
|
|
2851
|
+
const _errs47 = errors;
|
|
2852
|
+
if (data20 && typeof data20 == "object" && !Array.isArray(data20)) {
|
|
2853
|
+
let missing5;
|
|
2854
|
+
if ((data20.type === undefined) && (missing5 = "type")) {
|
|
2855
|
+
const err18 = { instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1, schemaPath: "#/$defs/ChatCompletionToolCallFragment/anyOf/1/required", keyword: "required", params: { missingProperty: missing5 }, message: "must have required property '" + missing5 + "'" };
|
|
2856
|
+
if (vErrors === null) {
|
|
2857
|
+
vErrors = [err18];
|
|
2858
|
+
}
|
|
2859
|
+
else {
|
|
2860
|
+
vErrors.push(err18);
|
|
2861
|
+
}
|
|
2862
|
+
errors++;
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
var _valid1 = _errs47 === errors;
|
|
2866
|
+
valid11 = valid11 || _valid1;
|
|
2867
|
+
if (_valid1) {
|
|
2868
|
+
if (props1 !== true) {
|
|
2869
|
+
props1 = props1 || {};
|
|
2870
|
+
props1.type = true;
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
const _errs48 = errors;
|
|
2874
|
+
if (data20 && typeof data20 == "object" && !Array.isArray(data20)) {
|
|
2875
|
+
let missing6;
|
|
2876
|
+
if ((data20.function === undefined) && (missing6 = "function")) {
|
|
2877
|
+
const err19 = { instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1, schemaPath: "#/$defs/ChatCompletionToolCallFragment/anyOf/2/required", keyword: "required", params: { missingProperty: missing6 }, message: "must have required property '" + missing6 + "'" };
|
|
2878
|
+
if (vErrors === null) {
|
|
2879
|
+
vErrors = [err19];
|
|
2880
|
+
}
|
|
2881
|
+
else {
|
|
2882
|
+
vErrors.push(err19);
|
|
2883
|
+
}
|
|
2884
|
+
errors++;
|
|
2885
|
+
}
|
|
2886
|
+
}
|
|
2887
|
+
var _valid1 = _errs48 === errors;
|
|
2888
|
+
valid11 = valid11 || _valid1;
|
|
2889
|
+
if (_valid1) {
|
|
2890
|
+
if (props1 !== true) {
|
|
2891
|
+
props1 = props1 || {};
|
|
2892
|
+
props1.function = true;
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
if (!valid11) {
|
|
2896
|
+
const err20 = { instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1, schemaPath: "#/$defs/ChatCompletionToolCallFragment/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
|
|
2897
|
+
if (vErrors === null) {
|
|
2898
|
+
vErrors = [err20];
|
|
2899
|
+
}
|
|
2900
|
+
else {
|
|
2901
|
+
vErrors.push(err20);
|
|
2902
|
+
}
|
|
2903
|
+
errors++;
|
|
2904
|
+
validate26.errors = vErrors;
|
|
2905
|
+
return false;
|
|
2906
|
+
}
|
|
2907
|
+
else {
|
|
2908
|
+
errors = _errs45;
|
|
2909
|
+
if (vErrors !== null) {
|
|
2910
|
+
if (_errs45) {
|
|
2911
|
+
vErrors.length = _errs45;
|
|
2912
|
+
}
|
|
2913
|
+
else {
|
|
2914
|
+
vErrors = null;
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
if (errors === _errs43) {
|
|
2919
|
+
if (data20 && typeof data20 == "object" && !Array.isArray(data20)) {
|
|
2920
|
+
let missing7;
|
|
2921
|
+
if ((data20.index === undefined) && (missing7 = "index")) {
|
|
2922
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1, schemaPath: "#/$defs/ChatCompletionToolCallFragment/required", keyword: "required", params: { missingProperty: missing7 }, message: "must have required property '" + missing7 + "'" }];
|
|
2923
|
+
return false;
|
|
2924
|
+
}
|
|
2925
|
+
else {
|
|
2926
|
+
if (props1 !== true) {
|
|
2927
|
+
props1 = props1 || {};
|
|
2928
|
+
props1.index = true;
|
|
2929
|
+
props1.id = true;
|
|
2930
|
+
props1.type = true;
|
|
2931
|
+
props1.function = true;
|
|
2932
|
+
}
|
|
2933
|
+
if (data20.index !== undefined) {
|
|
2934
|
+
let data21 = data20.index;
|
|
2935
|
+
const _errs49 = errors;
|
|
2936
|
+
if (!(((typeof data21 == "number") && (!(data21 % 1) && !isNaN(data21))) && (isFinite(data21)))) {
|
|
2937
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1 + "/index", schemaPath: "#/$defs/ChatCompletionToolCallFragment/properties/index/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
2938
|
+
return false;
|
|
2939
|
+
}
|
|
2940
|
+
if (errors === _errs49) {
|
|
2941
|
+
if ((typeof data21 == "number") && (isFinite(data21))) {
|
|
2942
|
+
if (data21 < 0 || isNaN(data21)) {
|
|
2943
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1 + "/index", schemaPath: "#/$defs/ChatCompletionToolCallFragment/properties/index/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
|
|
2944
|
+
return false;
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
var valid12 = _errs49 === errors;
|
|
2949
|
+
}
|
|
2950
|
+
else {
|
|
2951
|
+
var valid12 = true;
|
|
2952
|
+
}
|
|
2953
|
+
if (valid12) {
|
|
2954
|
+
if (data20.id !== undefined) {
|
|
2955
|
+
let data22 = data20.id;
|
|
2956
|
+
const _errs51 = errors;
|
|
2957
|
+
if (errors === _errs51) {
|
|
2958
|
+
if (typeof data22 === "string") {
|
|
2959
|
+
if (!pattern4.test(data22)) {
|
|
2960
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1 + "/id", schemaPath: "#/$defs/ChatCompletionToolCallFragment/properties/id/pattern", keyword: "pattern", params: { pattern: "[\\s\\S]" }, message: "must match pattern \"" + "[\\s\\S]" + "\"" }];
|
|
2961
|
+
return false;
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2964
|
+
else {
|
|
2965
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1 + "/id", schemaPath: "#/$defs/ChatCompletionToolCallFragment/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
2966
|
+
return false;
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
var valid12 = _errs51 === errors;
|
|
2970
|
+
}
|
|
2971
|
+
else {
|
|
2972
|
+
var valid12 = true;
|
|
2973
|
+
}
|
|
2974
|
+
if (valid12) {
|
|
2975
|
+
if (data20.type !== undefined) {
|
|
2976
|
+
let data23 = data20.type;
|
|
2977
|
+
const _errs53 = errors;
|
|
2978
|
+
if (typeof data23 !== "string") {
|
|
2979
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1 + "/type", schemaPath: "#/$defs/ChatCompletionToolCallFragment/properties/type/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
2980
|
+
return false;
|
|
2981
|
+
}
|
|
2982
|
+
if ("function" !== data23) {
|
|
2983
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1 + "/type", schemaPath: "#/$defs/ChatCompletionToolCallFragment/properties/type/const", keyword: "const", params: { allowedValue: "function" }, message: "must be equal to constant" }];
|
|
2984
|
+
return false;
|
|
2985
|
+
}
|
|
2986
|
+
var valid12 = _errs53 === errors;
|
|
2987
|
+
}
|
|
2988
|
+
else {
|
|
2989
|
+
var valid12 = true;
|
|
2990
|
+
}
|
|
2991
|
+
if (valid12) {
|
|
2992
|
+
if (data20.function !== undefined) {
|
|
2993
|
+
let data24 = data20.function;
|
|
2994
|
+
const _errs55 = errors;
|
|
2995
|
+
const _errs57 = errors;
|
|
2996
|
+
let valid13 = false;
|
|
2997
|
+
const _errs58 = errors;
|
|
2998
|
+
if (data24 && typeof data24 == "object" && !Array.isArray(data24)) {
|
|
2999
|
+
let missing8;
|
|
3000
|
+
if ((data24.name === undefined) && (missing8 = "name")) {
|
|
3001
|
+
const err21 = { instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1 + "/function", schemaPath: "#/$defs/ChatCompletionToolCallFragment/properties/function/anyOf/0/required", keyword: "required", params: { missingProperty: missing8 }, message: "must have required property '" + missing8 + "'" };
|
|
3002
|
+
if (vErrors === null) {
|
|
3003
|
+
vErrors = [err21];
|
|
3004
|
+
}
|
|
3005
|
+
else {
|
|
3006
|
+
vErrors.push(err21);
|
|
3007
|
+
}
|
|
3008
|
+
errors++;
|
|
3009
|
+
}
|
|
3010
|
+
}
|
|
3011
|
+
var _valid2 = _errs58 === errors;
|
|
3012
|
+
valid13 = valid13 || _valid2;
|
|
3013
|
+
if (_valid2) {
|
|
3014
|
+
var props2 = {};
|
|
3015
|
+
props2.name = true;
|
|
3016
|
+
}
|
|
3017
|
+
const _errs59 = errors;
|
|
3018
|
+
if (data24 && typeof data24 == "object" && !Array.isArray(data24)) {
|
|
3019
|
+
let missing9;
|
|
3020
|
+
if ((data24.arguments === undefined) && (missing9 = "arguments")) {
|
|
3021
|
+
const err22 = { instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1 + "/function", schemaPath: "#/$defs/ChatCompletionToolCallFragment/properties/function/anyOf/1/required", keyword: "required", params: { missingProperty: missing9 }, message: "must have required property '" + missing9 + "'" };
|
|
3022
|
+
if (vErrors === null) {
|
|
3023
|
+
vErrors = [err22];
|
|
3024
|
+
}
|
|
3025
|
+
else {
|
|
3026
|
+
vErrors.push(err22);
|
|
3027
|
+
}
|
|
3028
|
+
errors++;
|
|
3029
|
+
}
|
|
3030
|
+
}
|
|
3031
|
+
var _valid2 = _errs59 === errors;
|
|
3032
|
+
valid13 = valid13 || _valid2;
|
|
3033
|
+
if (_valid2) {
|
|
3034
|
+
if (props2 !== true) {
|
|
3035
|
+
props2 = props2 || {};
|
|
3036
|
+
props2.arguments = true;
|
|
3037
|
+
}
|
|
3038
|
+
}
|
|
3039
|
+
if (!valid13) {
|
|
3040
|
+
const err23 = { instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1 + "/function", schemaPath: "#/$defs/ChatCompletionToolCallFragment/properties/function/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
|
|
3041
|
+
if (vErrors === null) {
|
|
3042
|
+
vErrors = [err23];
|
|
3043
|
+
}
|
|
3044
|
+
else {
|
|
3045
|
+
vErrors.push(err23);
|
|
3046
|
+
}
|
|
3047
|
+
errors++;
|
|
3048
|
+
validate26.errors = vErrors;
|
|
3049
|
+
return false;
|
|
3050
|
+
}
|
|
3051
|
+
else {
|
|
3052
|
+
errors = _errs57;
|
|
3053
|
+
if (vErrors !== null) {
|
|
3054
|
+
if (_errs57) {
|
|
3055
|
+
vErrors.length = _errs57;
|
|
3056
|
+
}
|
|
3057
|
+
else {
|
|
3058
|
+
vErrors = null;
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
}
|
|
3062
|
+
if (errors === _errs55) {
|
|
3063
|
+
if (data24 && typeof data24 == "object" && !Array.isArray(data24)) {
|
|
3064
|
+
const _errs60 = errors;
|
|
3065
|
+
for (const key1 in data24) {
|
|
3066
|
+
if (!((key1 === "name") || (key1 === "arguments"))) {
|
|
3067
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1 + "/function", schemaPath: "#/$defs/ChatCompletionToolCallFragment/properties/function/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" }];
|
|
3068
|
+
return false;
|
|
3069
|
+
break;
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
if (_errs60 === errors) {
|
|
3073
|
+
if (data24.name !== undefined) {
|
|
3074
|
+
const _errs61 = errors;
|
|
3075
|
+
if (typeof data24.name !== "string") {
|
|
3076
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1 + "/function/name", schemaPath: "#/$defs/ChatCompletionToolCallFragment/properties/function/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
3077
|
+
return false;
|
|
3078
|
+
}
|
|
3079
|
+
var valid14 = _errs61 === errors;
|
|
3080
|
+
}
|
|
3081
|
+
else {
|
|
3082
|
+
var valid14 = true;
|
|
3083
|
+
}
|
|
3084
|
+
if (valid14) {
|
|
3085
|
+
if (data24.arguments !== undefined) {
|
|
3086
|
+
const _errs63 = errors;
|
|
3087
|
+
if (typeof data24.arguments !== "string") {
|
|
3088
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1 + "/function/arguments", schemaPath: "#/$defs/ChatCompletionToolCallFragment/properties/function/properties/arguments/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
3089
|
+
return false;
|
|
3090
|
+
}
|
|
3091
|
+
var valid14 = _errs63 === errors;
|
|
3092
|
+
}
|
|
3093
|
+
else {
|
|
3094
|
+
var valid14 = true;
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3098
|
+
}
|
|
3099
|
+
else {
|
|
3100
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1 + "/function", schemaPath: "#/$defs/ChatCompletionToolCallFragment/properties/function/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
3101
|
+
return false;
|
|
3102
|
+
}
|
|
3103
|
+
}
|
|
3104
|
+
var valid12 = _errs55 === errors;
|
|
3105
|
+
}
|
|
3106
|
+
else {
|
|
3107
|
+
var valid12 = true;
|
|
3108
|
+
}
|
|
3109
|
+
}
|
|
3110
|
+
}
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3113
|
+
}
|
|
3114
|
+
else {
|
|
3115
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls/" + i1, schemaPath: "#/$defs/ChatCompletionToolCallFragment/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
3116
|
+
return false;
|
|
3117
|
+
}
|
|
3118
|
+
}
|
|
3119
|
+
var valid9 = _errs42 === errors;
|
|
3120
|
+
if (!valid9) {
|
|
3121
|
+
break;
|
|
3122
|
+
}
|
|
3123
|
+
}
|
|
3124
|
+
}
|
|
3125
|
+
}
|
|
3126
|
+
else {
|
|
3127
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta/tool_calls", schemaPath: "#/properties/choices/items/properties/delta/properties/tool_calls/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
3128
|
+
return false;
|
|
3129
|
+
}
|
|
3130
|
+
}
|
|
3131
|
+
var valid8 = _errs40 === errors;
|
|
3132
|
+
}
|
|
3133
|
+
else {
|
|
3134
|
+
var valid8 = true;
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3139
|
+
}
|
|
3140
|
+
else {
|
|
3141
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/delta", schemaPath: "#/properties/choices/items/properties/delta/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
3142
|
+
return false;
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
var valid7 = _errs33 === errors;
|
|
3146
|
+
}
|
|
3147
|
+
else {
|
|
3148
|
+
var valid7 = true;
|
|
3149
|
+
}
|
|
3150
|
+
if (valid7) {
|
|
3151
|
+
if (data14.finish_reason !== undefined) {
|
|
3152
|
+
let data27 = data14.finish_reason;
|
|
3153
|
+
const _errs65 = errors;
|
|
3154
|
+
if ((typeof data27 !== "string") && (data27 !== null)) {
|
|
3155
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/finish_reason", schemaPath: "#/properties/choices/items/properties/finish_reason/type", keyword: "type", params: { type: schema39.properties.choices.items.properties.finish_reason.type }, message: "must be string,null" }];
|
|
3156
|
+
return false;
|
|
3157
|
+
}
|
|
3158
|
+
if (errors === _errs65) {
|
|
3159
|
+
if (typeof data27 === "string") {
|
|
3160
|
+
if (!pattern4.test(data27)) {
|
|
3161
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0 + "/finish_reason", schemaPath: "#/properties/choices/items/properties/finish_reason/pattern", keyword: "pattern", params: { pattern: "[\\s\\S]" }, message: "must match pattern \"" + "[\\s\\S]" + "\"" }];
|
|
3162
|
+
return false;
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
var valid7 = _errs65 === errors;
|
|
3167
|
+
}
|
|
3168
|
+
else {
|
|
3169
|
+
var valid7 = true;
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
}
|
|
3174
|
+
}
|
|
3175
|
+
else {
|
|
3176
|
+
validate26.errors = [{ instancePath: instancePath + "/choices/" + i0, schemaPath: "#/properties/choices/items/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
3177
|
+
return false;
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
var valid6 = _errs29 === errors;
|
|
3181
|
+
if (!valid6) {
|
|
3182
|
+
break;
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
}
|
|
3187
|
+
else {
|
|
3188
|
+
validate26.errors = [{ instancePath: instancePath + "/choices", schemaPath: "#/properties/choices/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
3189
|
+
return false;
|
|
3190
|
+
}
|
|
3191
|
+
}
|
|
3192
|
+
var valid5 = _errs27 === errors;
|
|
3193
|
+
}
|
|
3194
|
+
else {
|
|
3195
|
+
var valid5 = true;
|
|
3196
|
+
}
|
|
3197
|
+
if (valid5) {
|
|
3198
|
+
if (data.usage !== undefined) {
|
|
3199
|
+
let data28 = data.usage;
|
|
3200
|
+
const _errs67 = errors;
|
|
3201
|
+
const _errs68 = errors;
|
|
3202
|
+
if (errors === _errs68) {
|
|
3203
|
+
if (data28 && typeof data28 == "object" && !Array.isArray(data28)) {
|
|
3204
|
+
let missing10;
|
|
3205
|
+
if ((((data28.prompt_tokens === undefined) && (missing10 = "prompt_tokens")) || ((data28.completion_tokens === undefined) && (missing10 = "completion_tokens"))) || ((data28.total_tokens === undefined) && (missing10 = "total_tokens"))) {
|
|
3206
|
+
validate26.errors = [{ instancePath: instancePath + "/usage", schemaPath: "#/$defs/ChatCompletionStreamUsage/required", keyword: "required", params: { missingProperty: missing10 }, message: "must have required property '" + missing10 + "'" }];
|
|
3207
|
+
return false;
|
|
3208
|
+
}
|
|
3209
|
+
else {
|
|
3210
|
+
if (data28.prompt_tokens !== undefined) {
|
|
3211
|
+
let data29 = data28.prompt_tokens;
|
|
3212
|
+
const _errs70 = errors;
|
|
3213
|
+
if (!(((typeof data29 == "number") && (!(data29 % 1) && !isNaN(data29))) && (isFinite(data29)))) {
|
|
3214
|
+
validate26.errors = [{ instancePath: instancePath + "/usage/prompt_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/prompt_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
3215
|
+
return false;
|
|
3216
|
+
}
|
|
3217
|
+
if (errors === _errs70) {
|
|
3218
|
+
if ((typeof data29 == "number") && (isFinite(data29))) {
|
|
3219
|
+
if (data29 < 0 || isNaN(data29)) {
|
|
3220
|
+
validate26.errors = [{ instancePath: instancePath + "/usage/prompt_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/prompt_tokens/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
|
|
3221
|
+
return false;
|
|
3222
|
+
}
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
var valid16 = _errs70 === errors;
|
|
3226
|
+
}
|
|
3227
|
+
else {
|
|
3228
|
+
var valid16 = true;
|
|
3229
|
+
}
|
|
3230
|
+
if (valid16) {
|
|
3231
|
+
if (data28.completion_tokens !== undefined) {
|
|
3232
|
+
let data30 = data28.completion_tokens;
|
|
3233
|
+
const _errs72 = errors;
|
|
3234
|
+
if (!(((typeof data30 == "number") && (!(data30 % 1) && !isNaN(data30))) && (isFinite(data30)))) {
|
|
3235
|
+
validate26.errors = [{ instancePath: instancePath + "/usage/completion_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/completion_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
3236
|
+
return false;
|
|
3237
|
+
}
|
|
3238
|
+
if (errors === _errs72) {
|
|
3239
|
+
if ((typeof data30 == "number") && (isFinite(data30))) {
|
|
3240
|
+
if (data30 < 0 || isNaN(data30)) {
|
|
3241
|
+
validate26.errors = [{ instancePath: instancePath + "/usage/completion_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/completion_tokens/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
|
|
3242
|
+
return false;
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3246
|
+
var valid16 = _errs72 === errors;
|
|
3247
|
+
}
|
|
3248
|
+
else {
|
|
3249
|
+
var valid16 = true;
|
|
3250
|
+
}
|
|
3251
|
+
if (valid16) {
|
|
3252
|
+
if (data28.total_tokens !== undefined) {
|
|
3253
|
+
let data31 = data28.total_tokens;
|
|
3254
|
+
const _errs74 = errors;
|
|
3255
|
+
if (!(((typeof data31 == "number") && (!(data31 % 1) && !isNaN(data31))) && (isFinite(data31)))) {
|
|
3256
|
+
validate26.errors = [{ instancePath: instancePath + "/usage/total_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/total_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
3257
|
+
return false;
|
|
3258
|
+
}
|
|
3259
|
+
if (errors === _errs74) {
|
|
3260
|
+
if ((typeof data31 == "number") && (isFinite(data31))) {
|
|
3261
|
+
if (data31 < 0 || isNaN(data31)) {
|
|
3262
|
+
validate26.errors = [{ instancePath: instancePath + "/usage/total_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/total_tokens/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
|
|
3263
|
+
return false;
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
var valid16 = _errs74 === errors;
|
|
3268
|
+
}
|
|
3269
|
+
else {
|
|
3270
|
+
var valid16 = true;
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
3275
|
+
}
|
|
3276
|
+
else {
|
|
3277
|
+
validate26.errors = [{ instancePath: instancePath + "/usage", schemaPath: "#/$defs/ChatCompletionStreamUsage/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
3278
|
+
return false;
|
|
3279
|
+
}
|
|
3280
|
+
}
|
|
3281
|
+
var valid5 = _errs67 === errors;
|
|
3282
|
+
}
|
|
3283
|
+
else {
|
|
3284
|
+
var valid5 = true;
|
|
3285
|
+
}
|
|
3286
|
+
if (valid5) {
|
|
3287
|
+
if (data.x_flop_receipt !== undefined) {
|
|
3288
|
+
let data32 = data.x_flop_receipt;
|
|
3289
|
+
const _errs76 = errors;
|
|
3290
|
+
if (!(data32 && typeof data32 == "object" && !Array.isArray(data32))) {
|
|
3291
|
+
validate26.errors = [{ instancePath: instancePath + "/x_flop_receipt", schemaPath: "#/properties/x_flop_receipt/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
3292
|
+
return false;
|
|
3293
|
+
}
|
|
3294
|
+
var valid5 = _errs76 === errors;
|
|
3295
|
+
}
|
|
3296
|
+
else {
|
|
3297
|
+
var valid5 = true;
|
|
3298
|
+
}
|
|
3299
|
+
}
|
|
3300
|
+
}
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3307
|
+
else {
|
|
3308
|
+
validate26.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
3309
|
+
return false;
|
|
3310
|
+
}
|
|
3311
|
+
}
|
|
3312
|
+
validate26.errors = vErrors;
|
|
3313
|
+
evaluated0.props = props0;
|
|
3314
|
+
return errors === 0;
|
|
3315
|
+
}
|
|
3316
|
+
validate26.evaluated = { "dynamicProps": true, "dynamicItems": false };
|
|
3317
|
+
export const validateChatCompletionStreamError = validate27;
|
|
3318
|
+
const schema43 = { "type": "object", "required": ["error"], "description": "In-band failure following an empty delta with finish_reason error.\nBroker failures carry estimated usage and x_flop_usage_source estimated,\noptionally retry_after (seconds). Expiry/reconciliation at settlement\nmay omit usage. No error frame is a successful usage/receipt outcome.\n", "properties": { "error": { "oneOf": [{ "type": "object", "required": ["code", "message", "type"], "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "type": { "type": "string" } } }, { "type": "string", "const": "ephemeral_session_expired" }] }, "message": { "type": "string" }, "request_id": { "type": "string" }, "retry_after": { "type": "integer", "minimum": 0 }, "usage": { "$ref": "#/$defs/ChatCompletionStreamUsage" }, "x_flop_usage_source": { "type": "string", "const": "estimated" } }, "dependentRequired": { "usage": ["x_flop_usage_source"], "x_flop_usage_source": ["usage"] }, "if": { "properties": { "error": { "type": "string" } } }, "then": { "required": ["message"], "properties": { "message": {} } } };
|
|
3319
|
+
function validate27(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
3320
|
+
let vErrors = null;
|
|
3321
|
+
let errors = 0;
|
|
3322
|
+
const evaluated0 = validate27.evaluated;
|
|
3323
|
+
if (evaluated0.dynamicProps) {
|
|
3324
|
+
evaluated0.props = undefined;
|
|
3325
|
+
}
|
|
3326
|
+
if (evaluated0.dynamicItems) {
|
|
3327
|
+
evaluated0.items = undefined;
|
|
3328
|
+
}
|
|
3329
|
+
const _errs1 = errors;
|
|
3330
|
+
let valid0 = true;
|
|
3331
|
+
const _errs2 = errors;
|
|
3332
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3333
|
+
if (data.error !== undefined) {
|
|
3334
|
+
if (typeof data.error !== "string") {
|
|
3335
|
+
const err0 = {};
|
|
3336
|
+
if (vErrors === null) {
|
|
3337
|
+
vErrors = [err0];
|
|
3338
|
+
}
|
|
3339
|
+
else {
|
|
3340
|
+
vErrors.push(err0);
|
|
3341
|
+
}
|
|
3342
|
+
errors++;
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3346
|
+
var _valid0 = _errs2 === errors;
|
|
3347
|
+
errors = _errs1;
|
|
3348
|
+
if (vErrors !== null) {
|
|
3349
|
+
if (_errs1) {
|
|
3350
|
+
vErrors.length = _errs1;
|
|
3351
|
+
}
|
|
3352
|
+
else {
|
|
3353
|
+
vErrors = null;
|
|
3354
|
+
}
|
|
3355
|
+
}
|
|
3356
|
+
if (_valid0) {
|
|
3357
|
+
const _errs5 = errors;
|
|
3358
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3359
|
+
let missing0;
|
|
3360
|
+
if ((data.message === undefined) && (missing0 = "message")) {
|
|
3361
|
+
validate27.errors = [{ instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
3362
|
+
return false;
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
var _valid0 = _errs5 === errors;
|
|
3366
|
+
valid0 = _valid0;
|
|
3367
|
+
if (valid0) {
|
|
3368
|
+
var props0 = {};
|
|
3369
|
+
props0.message = true;
|
|
3370
|
+
props0.error = true;
|
|
3371
|
+
}
|
|
3372
|
+
}
|
|
3373
|
+
if (!valid0) {
|
|
3374
|
+
const err1 = { instancePath, schemaPath: "#/if", keyword: "if", params: { failingKeyword: "then" }, message: "must match \"then\" schema" };
|
|
3375
|
+
if (vErrors === null) {
|
|
3376
|
+
vErrors = [err1];
|
|
3377
|
+
}
|
|
3378
|
+
else {
|
|
3379
|
+
vErrors.push(err1);
|
|
3380
|
+
}
|
|
3381
|
+
errors++;
|
|
3382
|
+
validate27.errors = vErrors;
|
|
3383
|
+
return false;
|
|
3384
|
+
}
|
|
3385
|
+
if (errors === 0) {
|
|
3386
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3387
|
+
let missing1;
|
|
3388
|
+
if ((data.error === undefined) && (missing1 = "error")) {
|
|
3389
|
+
validate27.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
|
|
3390
|
+
return false;
|
|
3391
|
+
}
|
|
3392
|
+
else {
|
|
3393
|
+
if (props0 !== true) {
|
|
3394
|
+
props0 = props0 || {};
|
|
3395
|
+
props0.error = true;
|
|
3396
|
+
props0.message = true;
|
|
3397
|
+
props0.request_id = true;
|
|
3398
|
+
props0.retry_after = true;
|
|
3399
|
+
props0.usage = true;
|
|
3400
|
+
props0.x_flop_usage_source = true;
|
|
3401
|
+
}
|
|
3402
|
+
if (data.error !== undefined) {
|
|
3403
|
+
let data1 = data.error;
|
|
3404
|
+
const _errs6 = errors;
|
|
3405
|
+
const _errs7 = errors;
|
|
3406
|
+
let valid3 = false;
|
|
3407
|
+
let passing0 = null;
|
|
3408
|
+
const _errs8 = errors;
|
|
3409
|
+
if (errors === _errs8) {
|
|
3410
|
+
if (data1 && typeof data1 == "object" && !Array.isArray(data1)) {
|
|
3411
|
+
let missing2;
|
|
3412
|
+
if ((((data1.code === undefined) && (missing2 = "code")) || ((data1.message === undefined) && (missing2 = "message"))) || ((data1.type === undefined) && (missing2 = "type"))) {
|
|
3413
|
+
const err2 = { instancePath: instancePath + "/error", schemaPath: "#/properties/error/oneOf/0/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" };
|
|
3414
|
+
if (vErrors === null) {
|
|
3415
|
+
vErrors = [err2];
|
|
3416
|
+
}
|
|
3417
|
+
else {
|
|
3418
|
+
vErrors.push(err2);
|
|
3419
|
+
}
|
|
3420
|
+
errors++;
|
|
3421
|
+
}
|
|
3422
|
+
else {
|
|
3423
|
+
if (data1.code !== undefined) {
|
|
3424
|
+
const _errs10 = errors;
|
|
3425
|
+
if (typeof data1.code !== "string") {
|
|
3426
|
+
const err3 = { instancePath: instancePath + "/error/code", schemaPath: "#/properties/error/oneOf/0/properties/code/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3427
|
+
if (vErrors === null) {
|
|
3428
|
+
vErrors = [err3];
|
|
3429
|
+
}
|
|
3430
|
+
else {
|
|
3431
|
+
vErrors.push(err3);
|
|
3432
|
+
}
|
|
3433
|
+
errors++;
|
|
3434
|
+
}
|
|
3435
|
+
var valid4 = _errs10 === errors;
|
|
3436
|
+
}
|
|
3437
|
+
else {
|
|
3438
|
+
var valid4 = true;
|
|
3439
|
+
}
|
|
3440
|
+
if (valid4) {
|
|
3441
|
+
if (data1.message !== undefined) {
|
|
3442
|
+
const _errs12 = errors;
|
|
3443
|
+
if (typeof data1.message !== "string") {
|
|
3444
|
+
const err4 = { instancePath: instancePath + "/error/message", schemaPath: "#/properties/error/oneOf/0/properties/message/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3445
|
+
if (vErrors === null) {
|
|
3446
|
+
vErrors = [err4];
|
|
3447
|
+
}
|
|
3448
|
+
else {
|
|
3449
|
+
vErrors.push(err4);
|
|
3450
|
+
}
|
|
3451
|
+
errors++;
|
|
3452
|
+
}
|
|
3453
|
+
var valid4 = _errs12 === errors;
|
|
3454
|
+
}
|
|
3455
|
+
else {
|
|
3456
|
+
var valid4 = true;
|
|
3457
|
+
}
|
|
3458
|
+
if (valid4) {
|
|
3459
|
+
if (data1.type !== undefined) {
|
|
3460
|
+
const _errs14 = errors;
|
|
3461
|
+
if (typeof data1.type !== "string") {
|
|
3462
|
+
const err5 = { instancePath: instancePath + "/error/type", schemaPath: "#/properties/error/oneOf/0/properties/type/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3463
|
+
if (vErrors === null) {
|
|
3464
|
+
vErrors = [err5];
|
|
3465
|
+
}
|
|
3466
|
+
else {
|
|
3467
|
+
vErrors.push(err5);
|
|
3468
|
+
}
|
|
3469
|
+
errors++;
|
|
3470
|
+
}
|
|
3471
|
+
var valid4 = _errs14 === errors;
|
|
3472
|
+
}
|
|
3473
|
+
else {
|
|
3474
|
+
var valid4 = true;
|
|
3475
|
+
}
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3478
|
+
}
|
|
3479
|
+
}
|
|
3480
|
+
else {
|
|
3481
|
+
const err6 = { instancePath: instancePath + "/error", schemaPath: "#/properties/error/oneOf/0/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
3482
|
+
if (vErrors === null) {
|
|
3483
|
+
vErrors = [err6];
|
|
3484
|
+
}
|
|
3485
|
+
else {
|
|
3486
|
+
vErrors.push(err6);
|
|
3487
|
+
}
|
|
3488
|
+
errors++;
|
|
3489
|
+
}
|
|
3490
|
+
}
|
|
3491
|
+
var _valid1 = _errs8 === errors;
|
|
3492
|
+
if (_valid1) {
|
|
3493
|
+
valid3 = true;
|
|
3494
|
+
passing0 = 0;
|
|
3495
|
+
var props1 = {};
|
|
3496
|
+
props1.code = true;
|
|
3497
|
+
props1.message = true;
|
|
3498
|
+
props1.type = true;
|
|
3499
|
+
}
|
|
3500
|
+
const _errs16 = errors;
|
|
3501
|
+
if (typeof data1 !== "string") {
|
|
3502
|
+
const err7 = { instancePath: instancePath + "/error", schemaPath: "#/properties/error/oneOf/1/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3503
|
+
if (vErrors === null) {
|
|
3504
|
+
vErrors = [err7];
|
|
3505
|
+
}
|
|
3506
|
+
else {
|
|
3507
|
+
vErrors.push(err7);
|
|
3508
|
+
}
|
|
3509
|
+
errors++;
|
|
3510
|
+
}
|
|
3511
|
+
if ("ephemeral_session_expired" !== data1) {
|
|
3512
|
+
const err8 = { instancePath: instancePath + "/error", schemaPath: "#/properties/error/oneOf/1/const", keyword: "const", params: { allowedValue: "ephemeral_session_expired" }, message: "must be equal to constant" };
|
|
3513
|
+
if (vErrors === null) {
|
|
3514
|
+
vErrors = [err8];
|
|
3515
|
+
}
|
|
3516
|
+
else {
|
|
3517
|
+
vErrors.push(err8);
|
|
3518
|
+
}
|
|
3519
|
+
errors++;
|
|
3520
|
+
}
|
|
3521
|
+
var _valid1 = _errs16 === errors;
|
|
3522
|
+
if (_valid1 && valid3) {
|
|
3523
|
+
valid3 = false;
|
|
3524
|
+
passing0 = [passing0, 1];
|
|
3525
|
+
}
|
|
3526
|
+
else {
|
|
3527
|
+
if (_valid1) {
|
|
3528
|
+
valid3 = true;
|
|
3529
|
+
passing0 = 1;
|
|
3530
|
+
}
|
|
3531
|
+
}
|
|
3532
|
+
if (!valid3) {
|
|
3533
|
+
const err9 = { instancePath: instancePath + "/error", schemaPath: "#/properties/error/oneOf", keyword: "oneOf", params: { passingSchemas: passing0 }, message: "must match exactly one schema in oneOf" };
|
|
3534
|
+
if (vErrors === null) {
|
|
3535
|
+
vErrors = [err9];
|
|
3536
|
+
}
|
|
3537
|
+
else {
|
|
3538
|
+
vErrors.push(err9);
|
|
3539
|
+
}
|
|
3540
|
+
errors++;
|
|
3541
|
+
validate27.errors = vErrors;
|
|
3542
|
+
return false;
|
|
3543
|
+
}
|
|
3544
|
+
else {
|
|
3545
|
+
errors = _errs7;
|
|
3546
|
+
if (vErrors !== null) {
|
|
3547
|
+
if (_errs7) {
|
|
3548
|
+
vErrors.length = _errs7;
|
|
3549
|
+
}
|
|
3550
|
+
else {
|
|
3551
|
+
vErrors = null;
|
|
3552
|
+
}
|
|
3553
|
+
}
|
|
3554
|
+
}
|
|
3555
|
+
var valid2 = _errs6 === errors;
|
|
3556
|
+
}
|
|
3557
|
+
else {
|
|
3558
|
+
var valid2 = true;
|
|
3559
|
+
}
|
|
3560
|
+
if (valid2) {
|
|
3561
|
+
if (data.message !== undefined) {
|
|
3562
|
+
const _errs18 = errors;
|
|
3563
|
+
if (typeof data.message !== "string") {
|
|
3564
|
+
validate27.errors = [{ instancePath: instancePath + "/message", schemaPath: "#/properties/message/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
3565
|
+
return false;
|
|
3566
|
+
}
|
|
3567
|
+
var valid2 = _errs18 === errors;
|
|
3568
|
+
}
|
|
3569
|
+
else {
|
|
3570
|
+
var valid2 = true;
|
|
3571
|
+
}
|
|
3572
|
+
if (valid2) {
|
|
3573
|
+
if (data.request_id !== undefined) {
|
|
3574
|
+
const _errs20 = errors;
|
|
3575
|
+
if (typeof data.request_id !== "string") {
|
|
3576
|
+
validate27.errors = [{ instancePath: instancePath + "/request_id", schemaPath: "#/properties/request_id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
3577
|
+
return false;
|
|
3578
|
+
}
|
|
3579
|
+
var valid2 = _errs20 === errors;
|
|
3580
|
+
}
|
|
3581
|
+
else {
|
|
3582
|
+
var valid2 = true;
|
|
3583
|
+
}
|
|
3584
|
+
if (valid2) {
|
|
3585
|
+
if (data.retry_after !== undefined) {
|
|
3586
|
+
let data7 = data.retry_after;
|
|
3587
|
+
const _errs22 = errors;
|
|
3588
|
+
if (!(((typeof data7 == "number") && (!(data7 % 1) && !isNaN(data7))) && (isFinite(data7)))) {
|
|
3589
|
+
validate27.errors = [{ instancePath: instancePath + "/retry_after", schemaPath: "#/properties/retry_after/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
3590
|
+
return false;
|
|
3591
|
+
}
|
|
3592
|
+
if (errors === _errs22) {
|
|
3593
|
+
if ((typeof data7 == "number") && (isFinite(data7))) {
|
|
3594
|
+
if (data7 < 0 || isNaN(data7)) {
|
|
3595
|
+
validate27.errors = [{ instancePath: instancePath + "/retry_after", schemaPath: "#/properties/retry_after/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
|
|
3596
|
+
return false;
|
|
3597
|
+
}
|
|
3598
|
+
}
|
|
3599
|
+
}
|
|
3600
|
+
var valid2 = _errs22 === errors;
|
|
3601
|
+
}
|
|
3602
|
+
else {
|
|
3603
|
+
var valid2 = true;
|
|
3604
|
+
}
|
|
3605
|
+
if (valid2) {
|
|
3606
|
+
if (data.usage !== undefined) {
|
|
3607
|
+
let data8 = data.usage;
|
|
3608
|
+
const _errs24 = errors;
|
|
3609
|
+
const _errs25 = errors;
|
|
3610
|
+
if (errors === _errs25) {
|
|
3611
|
+
if (data8 && typeof data8 == "object" && !Array.isArray(data8)) {
|
|
3612
|
+
let missing3;
|
|
3613
|
+
if ((((data8.prompt_tokens === undefined) && (missing3 = "prompt_tokens")) || ((data8.completion_tokens === undefined) && (missing3 = "completion_tokens"))) || ((data8.total_tokens === undefined) && (missing3 = "total_tokens"))) {
|
|
3614
|
+
validate27.errors = [{ instancePath: instancePath + "/usage", schemaPath: "#/$defs/ChatCompletionStreamUsage/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" }];
|
|
3615
|
+
return false;
|
|
3616
|
+
}
|
|
3617
|
+
else {
|
|
3618
|
+
if (data8.prompt_tokens !== undefined) {
|
|
3619
|
+
let data9 = data8.prompt_tokens;
|
|
3620
|
+
const _errs27 = errors;
|
|
3621
|
+
if (!(((typeof data9 == "number") && (!(data9 % 1) && !isNaN(data9))) && (isFinite(data9)))) {
|
|
3622
|
+
validate27.errors = [{ instancePath: instancePath + "/usage/prompt_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/prompt_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
3623
|
+
return false;
|
|
3624
|
+
}
|
|
3625
|
+
if (errors === _errs27) {
|
|
3626
|
+
if ((typeof data9 == "number") && (isFinite(data9))) {
|
|
3627
|
+
if (data9 < 0 || isNaN(data9)) {
|
|
3628
|
+
validate27.errors = [{ instancePath: instancePath + "/usage/prompt_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/prompt_tokens/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
|
|
3629
|
+
return false;
|
|
3630
|
+
}
|
|
3631
|
+
}
|
|
3632
|
+
}
|
|
3633
|
+
var valid6 = _errs27 === errors;
|
|
3634
|
+
}
|
|
3635
|
+
else {
|
|
3636
|
+
var valid6 = true;
|
|
3637
|
+
}
|
|
3638
|
+
if (valid6) {
|
|
3639
|
+
if (data8.completion_tokens !== undefined) {
|
|
3640
|
+
let data10 = data8.completion_tokens;
|
|
3641
|
+
const _errs29 = errors;
|
|
3642
|
+
if (!(((typeof data10 == "number") && (!(data10 % 1) && !isNaN(data10))) && (isFinite(data10)))) {
|
|
3643
|
+
validate27.errors = [{ instancePath: instancePath + "/usage/completion_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/completion_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
3644
|
+
return false;
|
|
3645
|
+
}
|
|
3646
|
+
if (errors === _errs29) {
|
|
3647
|
+
if ((typeof data10 == "number") && (isFinite(data10))) {
|
|
3648
|
+
if (data10 < 0 || isNaN(data10)) {
|
|
3649
|
+
validate27.errors = [{ instancePath: instancePath + "/usage/completion_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/completion_tokens/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
|
|
3650
|
+
return false;
|
|
3651
|
+
}
|
|
3652
|
+
}
|
|
3653
|
+
}
|
|
3654
|
+
var valid6 = _errs29 === errors;
|
|
3655
|
+
}
|
|
3656
|
+
else {
|
|
3657
|
+
var valid6 = true;
|
|
3658
|
+
}
|
|
3659
|
+
if (valid6) {
|
|
3660
|
+
if (data8.total_tokens !== undefined) {
|
|
3661
|
+
let data11 = data8.total_tokens;
|
|
3662
|
+
const _errs31 = errors;
|
|
3663
|
+
if (!(((typeof data11 == "number") && (!(data11 % 1) && !isNaN(data11))) && (isFinite(data11)))) {
|
|
3664
|
+
validate27.errors = [{ instancePath: instancePath + "/usage/total_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/total_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
3665
|
+
return false;
|
|
3666
|
+
}
|
|
3667
|
+
if (errors === _errs31) {
|
|
3668
|
+
if ((typeof data11 == "number") && (isFinite(data11))) {
|
|
3669
|
+
if (data11 < 0 || isNaN(data11)) {
|
|
3670
|
+
validate27.errors = [{ instancePath: instancePath + "/usage/total_tokens", schemaPath: "#/$defs/ChatCompletionStreamUsage/properties/total_tokens/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
|
|
3671
|
+
return false;
|
|
3672
|
+
}
|
|
3673
|
+
}
|
|
3674
|
+
}
|
|
3675
|
+
var valid6 = _errs31 === errors;
|
|
3676
|
+
}
|
|
3677
|
+
else {
|
|
3678
|
+
var valid6 = true;
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3681
|
+
}
|
|
3682
|
+
}
|
|
3683
|
+
}
|
|
3684
|
+
else {
|
|
3685
|
+
validate27.errors = [{ instancePath: instancePath + "/usage", schemaPath: "#/$defs/ChatCompletionStreamUsage/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
3686
|
+
return false;
|
|
3687
|
+
}
|
|
3688
|
+
}
|
|
3689
|
+
var valid2 = _errs24 === errors;
|
|
3690
|
+
}
|
|
3691
|
+
else {
|
|
3692
|
+
var valid2 = true;
|
|
3693
|
+
}
|
|
3694
|
+
if (valid2) {
|
|
3695
|
+
if (data.x_flop_usage_source !== undefined) {
|
|
3696
|
+
let data12 = data.x_flop_usage_source;
|
|
3697
|
+
const _errs33 = errors;
|
|
3698
|
+
if (typeof data12 !== "string") {
|
|
3699
|
+
validate27.errors = [{ instancePath: instancePath + "/x_flop_usage_source", schemaPath: "#/properties/x_flop_usage_source/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
3700
|
+
return false;
|
|
3701
|
+
}
|
|
3702
|
+
if ("estimated" !== data12) {
|
|
3703
|
+
validate27.errors = [{ instancePath: instancePath + "/x_flop_usage_source", schemaPath: "#/properties/x_flop_usage_source/const", keyword: "const", params: { allowedValue: "estimated" }, message: "must be equal to constant" }];
|
|
3704
|
+
return false;
|
|
3705
|
+
}
|
|
3706
|
+
var valid2 = _errs33 === errors;
|
|
3707
|
+
}
|
|
3708
|
+
else {
|
|
3709
|
+
var valid2 = true;
|
|
3710
|
+
}
|
|
3711
|
+
if (valid2) {
|
|
3712
|
+
let missing4;
|
|
3713
|
+
if (data.usage !== undefined && ((data.x_flop_usage_source === undefined) && (missing4 = "x_flop_usage_source"))) {
|
|
3714
|
+
validate27.errors = [{ instancePath, schemaPath: "#/dependentRequired", keyword: "dependentRequired", params: { property: "usage",
|
|
3715
|
+
missingProperty: missing4,
|
|
3716
|
+
depsCount: 1,
|
|
3717
|
+
deps: "x_flop_usage_source" }, message: "must have property x_flop_usage_source when property usage is present" }];
|
|
3718
|
+
return false;
|
|
3719
|
+
}
|
|
3720
|
+
else {
|
|
3721
|
+
if (data.x_flop_usage_source !== undefined && ((data.usage === undefined) && (missing4 = "usage"))) {
|
|
3722
|
+
validate27.errors = [{ instancePath, schemaPath: "#/dependentRequired", keyword: "dependentRequired", params: { property: "x_flop_usage_source",
|
|
3723
|
+
missingProperty: missing4,
|
|
3724
|
+
depsCount: 1,
|
|
3725
|
+
deps: "usage" }, message: "must have property usage when property x_flop_usage_source is present" }];
|
|
3726
|
+
return false;
|
|
3727
|
+
}
|
|
3728
|
+
}
|
|
3729
|
+
}
|
|
3730
|
+
}
|
|
3731
|
+
}
|
|
3732
|
+
}
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
else {
|
|
3738
|
+
validate27.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
3739
|
+
return false;
|
|
3740
|
+
}
|
|
3741
|
+
}
|
|
3742
|
+
validate27.errors = vErrors;
|
|
3743
|
+
evaluated0.props = props0;
|
|
3744
|
+
return errors === 0;
|
|
3745
|
+
}
|
|
3746
|
+
validate27.evaluated = { "dynamicProps": true, "dynamicItems": false };
|
|
3747
|
+
export const validateChatCompletionToolCallFragment = validate28;
|
|
3748
|
+
function validate28(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
3749
|
+
let vErrors = null;
|
|
3750
|
+
let errors = 0;
|
|
3751
|
+
const evaluated0 = validate28.evaluated;
|
|
3752
|
+
if (evaluated0.dynamicProps) {
|
|
3753
|
+
evaluated0.props = undefined;
|
|
3754
|
+
}
|
|
3755
|
+
if (evaluated0.dynamicItems) {
|
|
3756
|
+
evaluated0.items = undefined;
|
|
3757
|
+
}
|
|
3758
|
+
const _errs1 = errors;
|
|
3759
|
+
let valid0 = false;
|
|
3760
|
+
const _errs2 = errors;
|
|
3761
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3762
|
+
let missing0;
|
|
3763
|
+
if ((data.id === undefined) && (missing0 = "id")) {
|
|
3764
|
+
const err0 = { instancePath, schemaPath: "#/anyOf/0/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" };
|
|
3765
|
+
if (vErrors === null) {
|
|
3766
|
+
vErrors = [err0];
|
|
3767
|
+
}
|
|
3768
|
+
else {
|
|
3769
|
+
vErrors.push(err0);
|
|
3770
|
+
}
|
|
3771
|
+
errors++;
|
|
3772
|
+
}
|
|
3773
|
+
}
|
|
3774
|
+
var _valid0 = _errs2 === errors;
|
|
3775
|
+
valid0 = valid0 || _valid0;
|
|
3776
|
+
if (_valid0) {
|
|
3777
|
+
var props0 = {};
|
|
3778
|
+
props0.id = true;
|
|
3779
|
+
}
|
|
3780
|
+
const _errs3 = errors;
|
|
3781
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3782
|
+
let missing1;
|
|
3783
|
+
if ((data.type === undefined) && (missing1 = "type")) {
|
|
3784
|
+
const err1 = { instancePath, schemaPath: "#/anyOf/1/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" };
|
|
3785
|
+
if (vErrors === null) {
|
|
3786
|
+
vErrors = [err1];
|
|
3787
|
+
}
|
|
3788
|
+
else {
|
|
3789
|
+
vErrors.push(err1);
|
|
3790
|
+
}
|
|
3791
|
+
errors++;
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3794
|
+
var _valid0 = _errs3 === errors;
|
|
3795
|
+
valid0 = valid0 || _valid0;
|
|
3796
|
+
if (_valid0) {
|
|
3797
|
+
if (props0 !== true) {
|
|
3798
|
+
props0 = props0 || {};
|
|
3799
|
+
props0.type = true;
|
|
3800
|
+
}
|
|
3801
|
+
}
|
|
3802
|
+
const _errs4 = errors;
|
|
3803
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3804
|
+
let missing2;
|
|
3805
|
+
if ((data.function === undefined) && (missing2 = "function")) {
|
|
3806
|
+
const err2 = { instancePath, schemaPath: "#/anyOf/2/required", keyword: "required", params: { missingProperty: missing2 }, message: "must have required property '" + missing2 + "'" };
|
|
3807
|
+
if (vErrors === null) {
|
|
3808
|
+
vErrors = [err2];
|
|
3809
|
+
}
|
|
3810
|
+
else {
|
|
3811
|
+
vErrors.push(err2);
|
|
3812
|
+
}
|
|
3813
|
+
errors++;
|
|
3814
|
+
}
|
|
3815
|
+
}
|
|
3816
|
+
var _valid0 = _errs4 === errors;
|
|
3817
|
+
valid0 = valid0 || _valid0;
|
|
3818
|
+
if (_valid0) {
|
|
3819
|
+
if (props0 !== true) {
|
|
3820
|
+
props0 = props0 || {};
|
|
3821
|
+
props0.function = true;
|
|
3822
|
+
}
|
|
3823
|
+
}
|
|
3824
|
+
if (!valid0) {
|
|
3825
|
+
const err3 = { instancePath, schemaPath: "#/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
|
|
3826
|
+
if (vErrors === null) {
|
|
3827
|
+
vErrors = [err3];
|
|
3828
|
+
}
|
|
3829
|
+
else {
|
|
3830
|
+
vErrors.push(err3);
|
|
3831
|
+
}
|
|
3832
|
+
errors++;
|
|
3833
|
+
validate28.errors = vErrors;
|
|
3834
|
+
return false;
|
|
3835
|
+
}
|
|
3836
|
+
else {
|
|
3837
|
+
errors = _errs1;
|
|
3838
|
+
if (vErrors !== null) {
|
|
3839
|
+
if (_errs1) {
|
|
3840
|
+
vErrors.length = _errs1;
|
|
3841
|
+
}
|
|
3842
|
+
else {
|
|
3843
|
+
vErrors = null;
|
|
3844
|
+
}
|
|
3845
|
+
}
|
|
3846
|
+
}
|
|
3847
|
+
if (errors === 0) {
|
|
3848
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3849
|
+
let missing3;
|
|
3850
|
+
if ((data.index === undefined) && (missing3 = "index")) {
|
|
3851
|
+
validate28.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" }];
|
|
3852
|
+
return false;
|
|
3853
|
+
}
|
|
3854
|
+
else {
|
|
3855
|
+
if (props0 !== true) {
|
|
3856
|
+
props0 = props0 || {};
|
|
3857
|
+
props0.index = true;
|
|
3858
|
+
props0.id = true;
|
|
3859
|
+
props0.type = true;
|
|
3860
|
+
props0.function = true;
|
|
3861
|
+
}
|
|
3862
|
+
if (data.index !== undefined) {
|
|
3863
|
+
let data0 = data.index;
|
|
3864
|
+
const _errs5 = errors;
|
|
3865
|
+
if (!(((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0))) && (isFinite(data0)))) {
|
|
3866
|
+
validate28.errors = [{ instancePath: instancePath + "/index", schemaPath: "#/properties/index/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
3867
|
+
return false;
|
|
3868
|
+
}
|
|
3869
|
+
if (errors === _errs5) {
|
|
3870
|
+
if ((typeof data0 == "number") && (isFinite(data0))) {
|
|
3871
|
+
if (data0 < 0 || isNaN(data0)) {
|
|
3872
|
+
validate28.errors = [{ instancePath: instancePath + "/index", schemaPath: "#/properties/index/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
|
|
3873
|
+
return false;
|
|
3874
|
+
}
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3877
|
+
var valid1 = _errs5 === errors;
|
|
3878
|
+
}
|
|
3879
|
+
else {
|
|
3880
|
+
var valid1 = true;
|
|
3881
|
+
}
|
|
3882
|
+
if (valid1) {
|
|
3883
|
+
if (data.id !== undefined) {
|
|
3884
|
+
let data1 = data.id;
|
|
3885
|
+
const _errs7 = errors;
|
|
3886
|
+
if (errors === _errs7) {
|
|
3887
|
+
if (typeof data1 === "string") {
|
|
3888
|
+
if (!pattern4.test(data1)) {
|
|
3889
|
+
validate28.errors = [{ instancePath: instancePath + "/id", schemaPath: "#/properties/id/pattern", keyword: "pattern", params: { pattern: "[\\s\\S]" }, message: "must match pattern \"" + "[\\s\\S]" + "\"" }];
|
|
3890
|
+
return false;
|
|
3891
|
+
}
|
|
3892
|
+
}
|
|
3893
|
+
else {
|
|
3894
|
+
validate28.errors = [{ instancePath: instancePath + "/id", schemaPath: "#/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
3895
|
+
return false;
|
|
3896
|
+
}
|
|
3897
|
+
}
|
|
3898
|
+
var valid1 = _errs7 === errors;
|
|
3899
|
+
}
|
|
3900
|
+
else {
|
|
3901
|
+
var valid1 = true;
|
|
3902
|
+
}
|
|
3903
|
+
if (valid1) {
|
|
3904
|
+
if (data.type !== undefined) {
|
|
3905
|
+
let data2 = data.type;
|
|
3906
|
+
const _errs9 = errors;
|
|
3907
|
+
if (typeof data2 !== "string") {
|
|
3908
|
+
validate28.errors = [{ instancePath: instancePath + "/type", schemaPath: "#/properties/type/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
3909
|
+
return false;
|
|
3910
|
+
}
|
|
3911
|
+
if ("function" !== data2) {
|
|
3912
|
+
validate28.errors = [{ instancePath: instancePath + "/type", schemaPath: "#/properties/type/const", keyword: "const", params: { allowedValue: "function" }, message: "must be equal to constant" }];
|
|
3913
|
+
return false;
|
|
3914
|
+
}
|
|
3915
|
+
var valid1 = _errs9 === errors;
|
|
3916
|
+
}
|
|
3917
|
+
else {
|
|
3918
|
+
var valid1 = true;
|
|
3919
|
+
}
|
|
3920
|
+
if (valid1) {
|
|
3921
|
+
if (data.function !== undefined) {
|
|
3922
|
+
let data3 = data.function;
|
|
3923
|
+
const _errs11 = errors;
|
|
3924
|
+
const _errs13 = errors;
|
|
3925
|
+
let valid2 = false;
|
|
3926
|
+
const _errs14 = errors;
|
|
3927
|
+
if (data3 && typeof data3 == "object" && !Array.isArray(data3)) {
|
|
3928
|
+
let missing4;
|
|
3929
|
+
if ((data3.name === undefined) && (missing4 = "name")) {
|
|
3930
|
+
const err4 = { instancePath: instancePath + "/function", schemaPath: "#/properties/function/anyOf/0/required", keyword: "required", params: { missingProperty: missing4 }, message: "must have required property '" + missing4 + "'" };
|
|
3931
|
+
if (vErrors === null) {
|
|
3932
|
+
vErrors = [err4];
|
|
3933
|
+
}
|
|
3934
|
+
else {
|
|
3935
|
+
vErrors.push(err4);
|
|
3936
|
+
}
|
|
3937
|
+
errors++;
|
|
3938
|
+
}
|
|
3939
|
+
}
|
|
3940
|
+
var _valid1 = _errs14 === errors;
|
|
3941
|
+
valid2 = valid2 || _valid1;
|
|
3942
|
+
if (_valid1) {
|
|
3943
|
+
var props1 = {};
|
|
3944
|
+
props1.name = true;
|
|
3945
|
+
}
|
|
3946
|
+
const _errs15 = errors;
|
|
3947
|
+
if (data3 && typeof data3 == "object" && !Array.isArray(data3)) {
|
|
3948
|
+
let missing5;
|
|
3949
|
+
if ((data3.arguments === undefined) && (missing5 = "arguments")) {
|
|
3950
|
+
const err5 = { instancePath: instancePath + "/function", schemaPath: "#/properties/function/anyOf/1/required", keyword: "required", params: { missingProperty: missing5 }, message: "must have required property '" + missing5 + "'" };
|
|
3951
|
+
if (vErrors === null) {
|
|
3952
|
+
vErrors = [err5];
|
|
3953
|
+
}
|
|
3954
|
+
else {
|
|
3955
|
+
vErrors.push(err5);
|
|
3956
|
+
}
|
|
3957
|
+
errors++;
|
|
3958
|
+
}
|
|
3959
|
+
}
|
|
3960
|
+
var _valid1 = _errs15 === errors;
|
|
3961
|
+
valid2 = valid2 || _valid1;
|
|
3962
|
+
if (_valid1) {
|
|
3963
|
+
if (props1 !== true) {
|
|
3964
|
+
props1 = props1 || {};
|
|
3965
|
+
props1.arguments = true;
|
|
3966
|
+
}
|
|
3967
|
+
}
|
|
3968
|
+
if (!valid2) {
|
|
3969
|
+
const err6 = { instancePath: instancePath + "/function", schemaPath: "#/properties/function/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
|
|
3970
|
+
if (vErrors === null) {
|
|
3971
|
+
vErrors = [err6];
|
|
3972
|
+
}
|
|
3973
|
+
else {
|
|
3974
|
+
vErrors.push(err6);
|
|
3975
|
+
}
|
|
3976
|
+
errors++;
|
|
3977
|
+
validate28.errors = vErrors;
|
|
3978
|
+
return false;
|
|
3979
|
+
}
|
|
3980
|
+
else {
|
|
3981
|
+
errors = _errs13;
|
|
3982
|
+
if (vErrors !== null) {
|
|
3983
|
+
if (_errs13) {
|
|
3984
|
+
vErrors.length = _errs13;
|
|
3985
|
+
}
|
|
3986
|
+
else {
|
|
3987
|
+
vErrors = null;
|
|
3988
|
+
}
|
|
3989
|
+
}
|
|
3990
|
+
}
|
|
3991
|
+
if (errors === _errs11) {
|
|
3992
|
+
if (data3 && typeof data3 == "object" && !Array.isArray(data3)) {
|
|
3993
|
+
const _errs16 = errors;
|
|
3994
|
+
for (const key0 in data3) {
|
|
3995
|
+
if (!((key0 === "name") || (key0 === "arguments"))) {
|
|
3996
|
+
validate28.errors = [{ instancePath: instancePath + "/function", schemaPath: "#/properties/function/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
|
|
3997
|
+
return false;
|
|
3998
|
+
break;
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
4001
|
+
if (_errs16 === errors) {
|
|
4002
|
+
if (data3.name !== undefined) {
|
|
4003
|
+
const _errs17 = errors;
|
|
4004
|
+
if (typeof data3.name !== "string") {
|
|
4005
|
+
validate28.errors = [{ instancePath: instancePath + "/function/name", schemaPath: "#/properties/function/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
4006
|
+
return false;
|
|
4007
|
+
}
|
|
4008
|
+
var valid3 = _errs17 === errors;
|
|
4009
|
+
}
|
|
4010
|
+
else {
|
|
4011
|
+
var valid3 = true;
|
|
4012
|
+
}
|
|
4013
|
+
if (valid3) {
|
|
4014
|
+
if (data3.arguments !== undefined) {
|
|
4015
|
+
const _errs19 = errors;
|
|
4016
|
+
if (typeof data3.arguments !== "string") {
|
|
4017
|
+
validate28.errors = [{ instancePath: instancePath + "/function/arguments", schemaPath: "#/properties/function/properties/arguments/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
4018
|
+
return false;
|
|
4019
|
+
}
|
|
4020
|
+
var valid3 = _errs19 === errors;
|
|
4021
|
+
}
|
|
4022
|
+
else {
|
|
4023
|
+
var valid3 = true;
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
4026
|
+
}
|
|
4027
|
+
}
|
|
4028
|
+
else {
|
|
4029
|
+
validate28.errors = [{ instancePath: instancePath + "/function", schemaPath: "#/properties/function/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
4030
|
+
return false;
|
|
4031
|
+
}
|
|
4032
|
+
}
|
|
4033
|
+
var valid1 = _errs11 === errors;
|
|
4034
|
+
}
|
|
4035
|
+
else {
|
|
4036
|
+
var valid1 = true;
|
|
4037
|
+
}
|
|
4038
|
+
}
|
|
4039
|
+
}
|
|
4040
|
+
}
|
|
4041
|
+
}
|
|
4042
|
+
}
|
|
4043
|
+
else {
|
|
4044
|
+
validate28.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
4045
|
+
return false;
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
validate28.errors = vErrors;
|
|
4049
|
+
evaluated0.props = props0;
|
|
4050
|
+
return errors === 0;
|
|
4051
|
+
}
|
|
4052
|
+
validate28.evaluated = { "dynamicProps": true, "dynamicItems": false };
|
|
4053
|
+
export const validateChatCompletionStreamUsage = validate29;
|
|
4054
|
+
function validate29(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
|
|
4055
|
+
let vErrors = null;
|
|
4056
|
+
let errors = 0;
|
|
4057
|
+
const evaluated0 = validate29.evaluated;
|
|
4058
|
+
if (evaluated0.dynamicProps) {
|
|
4059
|
+
evaluated0.props = undefined;
|
|
4060
|
+
}
|
|
4061
|
+
if (evaluated0.dynamicItems) {
|
|
4062
|
+
evaluated0.items = undefined;
|
|
4063
|
+
}
|
|
4064
|
+
if (errors === 0) {
|
|
4065
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
4066
|
+
let missing0;
|
|
4067
|
+
if ((((data.prompt_tokens === undefined) && (missing0 = "prompt_tokens")) || ((data.completion_tokens === undefined) && (missing0 = "completion_tokens"))) || ((data.total_tokens === undefined) && (missing0 = "total_tokens"))) {
|
|
4068
|
+
validate29.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
4069
|
+
return false;
|
|
4070
|
+
}
|
|
4071
|
+
else {
|
|
4072
|
+
if (data.prompt_tokens !== undefined) {
|
|
4073
|
+
let data0 = data.prompt_tokens;
|
|
4074
|
+
const _errs1 = errors;
|
|
4075
|
+
if (!(((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0))) && (isFinite(data0)))) {
|
|
4076
|
+
validate29.errors = [{ instancePath: instancePath + "/prompt_tokens", schemaPath: "#/properties/prompt_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
4077
|
+
return false;
|
|
4078
|
+
}
|
|
4079
|
+
if (errors === _errs1) {
|
|
4080
|
+
if ((typeof data0 == "number") && (isFinite(data0))) {
|
|
4081
|
+
if (data0 < 0 || isNaN(data0)) {
|
|
4082
|
+
validate29.errors = [{ instancePath: instancePath + "/prompt_tokens", schemaPath: "#/properties/prompt_tokens/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
|
|
4083
|
+
return false;
|
|
4084
|
+
}
|
|
4085
|
+
}
|
|
4086
|
+
}
|
|
4087
|
+
var valid0 = _errs1 === errors;
|
|
4088
|
+
}
|
|
4089
|
+
else {
|
|
4090
|
+
var valid0 = true;
|
|
4091
|
+
}
|
|
4092
|
+
if (valid0) {
|
|
4093
|
+
if (data.completion_tokens !== undefined) {
|
|
4094
|
+
let data1 = data.completion_tokens;
|
|
4095
|
+
const _errs3 = errors;
|
|
4096
|
+
if (!(((typeof data1 == "number") && (!(data1 % 1) && !isNaN(data1))) && (isFinite(data1)))) {
|
|
4097
|
+
validate29.errors = [{ instancePath: instancePath + "/completion_tokens", schemaPath: "#/properties/completion_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
4098
|
+
return false;
|
|
4099
|
+
}
|
|
4100
|
+
if (errors === _errs3) {
|
|
4101
|
+
if ((typeof data1 == "number") && (isFinite(data1))) {
|
|
4102
|
+
if (data1 < 0 || isNaN(data1)) {
|
|
4103
|
+
validate29.errors = [{ instancePath: instancePath + "/completion_tokens", schemaPath: "#/properties/completion_tokens/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
|
|
4104
|
+
return false;
|
|
4105
|
+
}
|
|
4106
|
+
}
|
|
4107
|
+
}
|
|
4108
|
+
var valid0 = _errs3 === errors;
|
|
4109
|
+
}
|
|
4110
|
+
else {
|
|
4111
|
+
var valid0 = true;
|
|
4112
|
+
}
|
|
4113
|
+
if (valid0) {
|
|
4114
|
+
if (data.total_tokens !== undefined) {
|
|
4115
|
+
let data2 = data.total_tokens;
|
|
4116
|
+
const _errs5 = errors;
|
|
4117
|
+
if (!(((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2))) && (isFinite(data2)))) {
|
|
4118
|
+
validate29.errors = [{ instancePath: instancePath + "/total_tokens", schemaPath: "#/properties/total_tokens/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
4119
|
+
return false;
|
|
4120
|
+
}
|
|
4121
|
+
if (errors === _errs5) {
|
|
4122
|
+
if ((typeof data2 == "number") && (isFinite(data2))) {
|
|
4123
|
+
if (data2 < 0 || isNaN(data2)) {
|
|
4124
|
+
validate29.errors = [{ instancePath: instancePath + "/total_tokens", schemaPath: "#/properties/total_tokens/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
|
|
4125
|
+
return false;
|
|
4126
|
+
}
|
|
4127
|
+
}
|
|
4128
|
+
}
|
|
4129
|
+
var valid0 = _errs5 === errors;
|
|
4130
|
+
}
|
|
4131
|
+
else {
|
|
4132
|
+
var valid0 = true;
|
|
4133
|
+
}
|
|
4134
|
+
}
|
|
4135
|
+
}
|
|
4136
|
+
}
|
|
4137
|
+
}
|
|
4138
|
+
else {
|
|
4139
|
+
validate29.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
4140
|
+
return false;
|
|
4141
|
+
}
|
|
4142
|
+
}
|
|
4143
|
+
validate29.errors = vErrors;
|
|
4144
|
+
return errors === 0;
|
|
4145
|
+
}
|
|
4146
|
+
validate29.evaluated = { "props": { "prompt_tokens": true, "completion_tokens": true, "total_tokens": true }, "dynamicProps": false, "dynamicItems": false };
|
|
4147
|
+
//# sourceMappingURL=validators.js.map
|