@openrouter/sdk 1.5.136 → 1.5.137
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/funcs/batchGetResults.d.ts +21 -0
- package/esm/funcs/batchGetResults.js +136 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/batchobject.d.ts +6 -658
- package/esm/models/batchobject.js +6 -755
- package/esm/models/batchresult.d.ts +662 -0
- package/esm/models/batchresult.js +755 -0
- package/esm/models/batchresultspageresponse.d.ts +24 -0
- package/esm/models/batchresultspageresponse.js +28 -0
- package/esm/models/index.d.ts +2 -0
- package/esm/models/index.js +2 -0
- package/esm/models/operations/getbatchresults.d.ts +77 -0
- package/esm/models/operations/getbatchresults.js +35 -0
- package/esm/models/operations/index.d.ts +1 -0
- package/esm/models/operations/index.js +1 -0
- package/esm/sdk/batch.d.ts +9 -0
- package/esm/sdk/batch.js +10 -0
- package/jsr.json +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,755 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v4";
|
|
5
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
6
|
+
import { collectExtraKeys as collectExtraKeys$, safeParse, } from "../lib/schemas.js";
|
|
7
|
+
import { discriminatedUnion } from "../types/discriminatedUnion.js";
|
|
8
|
+
import * as openEnums from "../types/enums.js";
|
|
9
|
+
import { Alignment$inboundSchema } from "./alignment.js";
|
|
10
|
+
import { AnthropicCacheCreation$inboundSchema, } from "./anthropiccachecreation.js";
|
|
11
|
+
import { AnthropicContainer$inboundSchema, } from "./anthropiccontainer.js";
|
|
12
|
+
import { AnthropicInputTransformation$inboundSchema, } from "./anthropicinputtransformation.js";
|
|
13
|
+
import { AnthropicOutputTokensDetails$inboundSchema, } from "./anthropicoutputtokensdetails.js";
|
|
14
|
+
import { AnthropicRefusalStopDetails$inboundSchema, } from "./anthropicrefusalstopdetails.js";
|
|
15
|
+
import { AnthropicServerToolUsage$inboundSchema, } from "./anthropicservertoolusage.js";
|
|
16
|
+
import { AnthropicServiceTier$inboundSchema, } from "./anthropicservicetier.js";
|
|
17
|
+
import { AnthropicSpeed$inboundSchema, } from "./anthropicspeed.js";
|
|
18
|
+
import { AnthropicUsageIteration$inboundSchema, } from "./anthropicusageiteration.js";
|
|
19
|
+
import { ApiErrorType$inboundSchema } from "./apierrortype.js";
|
|
20
|
+
import { ArmorSafeguardResult$inboundSchema, } from "./armorsafeguardresult.js";
|
|
21
|
+
import { CostDetails$inboundSchema } from "./costdetails.js";
|
|
22
|
+
import { FinishReason$inboundSchema } from "./finishreason.js";
|
|
23
|
+
import { OpenResponsesResult$inboundSchema, } from "./openresponsesresult.js";
|
|
24
|
+
import { OpenRouterMetadata$inboundSchema, } from "./openroutermetadata.js";
|
|
25
|
+
import { ORAnthropicContentBlock$inboundSchema, } from "./oranthropiccontentblock.js";
|
|
26
|
+
import { ORAnthropicStopReason$inboundSchema, } from "./oranthropicstopreason.js";
|
|
27
|
+
import { ReasoningDetailEncrypted$inboundSchema, } from "./reasoningdetailencrypted.js";
|
|
28
|
+
import { ReasoningDetailServerToolCall$inboundSchema, } from "./reasoningdetailservertoolcall.js";
|
|
29
|
+
import { ReasoningDetailSummary$inboundSchema, } from "./reasoningdetailsummary.js";
|
|
30
|
+
import { ReasoningDetailText$inboundSchema, } from "./reasoningdetailtext.js";
|
|
31
|
+
export const BatchResultFormat2 = {
|
|
32
|
+
Pcm: "pcm",
|
|
33
|
+
};
|
|
34
|
+
export const BatchResultFormat1 = {
|
|
35
|
+
Pcm: "pcm",
|
|
36
|
+
};
|
|
37
|
+
export const ObjectAudioSpeech = {
|
|
38
|
+
AudioSpeech: "audio.speech",
|
|
39
|
+
};
|
|
40
|
+
export const ObjectEmbedding = {
|
|
41
|
+
Embedding: "embedding",
|
|
42
|
+
};
|
|
43
|
+
export const BatchResultObjectList = {
|
|
44
|
+
List: "list",
|
|
45
|
+
};
|
|
46
|
+
export const BatchResultRole = {
|
|
47
|
+
Assistant: "assistant",
|
|
48
|
+
};
|
|
49
|
+
export const BatchResultTypeMessage = {
|
|
50
|
+
Message: "message",
|
|
51
|
+
};
|
|
52
|
+
export const ChoiceTypeImageURLEnum = {
|
|
53
|
+
ImageUrl: "image_url",
|
|
54
|
+
};
|
|
55
|
+
export const ChoiceRole = {
|
|
56
|
+
Assistant: "assistant",
|
|
57
|
+
};
|
|
58
|
+
export const ChoiceTypeFunction = {
|
|
59
|
+
Function: "function",
|
|
60
|
+
};
|
|
61
|
+
export const BatchResultEvent = {
|
|
62
|
+
AdapterRequest: "adapter_request",
|
|
63
|
+
UpstreamHeadersReceived: "upstream_headers_received",
|
|
64
|
+
FirstTokenReceived: "first_token_received",
|
|
65
|
+
UpstreamBodyEnded: "upstream_body_ended",
|
|
66
|
+
};
|
|
67
|
+
export const BatchResultObjectChatCompletion = {
|
|
68
|
+
ChatCompletion: "chat.completion",
|
|
69
|
+
};
|
|
70
|
+
/** @internal */
|
|
71
|
+
export const BatchResultError$inboundSchema = z.object({
|
|
72
|
+
error_type: ApiErrorType$inboundSchema.optional(),
|
|
73
|
+
message: z.string(),
|
|
74
|
+
param: z.nullable(z.string()),
|
|
75
|
+
type: z.string(),
|
|
76
|
+
}).transform((v) => {
|
|
77
|
+
return remap$(v, {
|
|
78
|
+
"error_type": "errorType",
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
export function batchResultErrorFromJSON(jsonString) {
|
|
82
|
+
return safeParse(jsonString, (x) => BatchResultError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultError' from JSON`);
|
|
83
|
+
}
|
|
84
|
+
/** @internal */
|
|
85
|
+
export const BatchResultFormat2$inboundSchema = z.enum(BatchResultFormat2);
|
|
86
|
+
/** @internal */
|
|
87
|
+
export const AudioPcm2$inboundSchema = z.object({
|
|
88
|
+
bits_per_sample: z.number(),
|
|
89
|
+
byte_length: z.int(),
|
|
90
|
+
channels: z.int(),
|
|
91
|
+
format: BatchResultFormat2$inboundSchema,
|
|
92
|
+
sample_rate: z.int(),
|
|
93
|
+
sha256: z.string(),
|
|
94
|
+
}).transform((v) => {
|
|
95
|
+
return remap$(v, {
|
|
96
|
+
"bits_per_sample": "bitsPerSample",
|
|
97
|
+
"byte_length": "byteLength",
|
|
98
|
+
"sample_rate": "sampleRate",
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
export function audioPcm2FromJSON(jsonString) {
|
|
102
|
+
return safeParse(jsonString, (x) => AudioPcm2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AudioPcm2' from JSON`);
|
|
103
|
+
}
|
|
104
|
+
/** @internal */
|
|
105
|
+
export const BatchResultFormat1$inboundSchema = z.enum(BatchResultFormat1);
|
|
106
|
+
/** @internal */
|
|
107
|
+
export const AudioPcm1$inboundSchema = z.object({
|
|
108
|
+
bits_per_sample: z.number(),
|
|
109
|
+
channels: z.int(),
|
|
110
|
+
data: z.string(),
|
|
111
|
+
format: BatchResultFormat1$inboundSchema,
|
|
112
|
+
sample_rate: z.int(),
|
|
113
|
+
}).transform((v) => {
|
|
114
|
+
return remap$(v, {
|
|
115
|
+
"bits_per_sample": "bitsPerSample",
|
|
116
|
+
"sample_rate": "sampleRate",
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
export function audioPcm1FromJSON(jsonString) {
|
|
120
|
+
return safeParse(jsonString, (x) => AudioPcm1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AudioPcm1' from JSON`);
|
|
121
|
+
}
|
|
122
|
+
/** @internal */
|
|
123
|
+
export const Audio$inboundSchema = z.union([
|
|
124
|
+
z.lazy(() => AudioPcm2$inboundSchema),
|
|
125
|
+
z.lazy(() => AudioPcm1$inboundSchema),
|
|
126
|
+
]);
|
|
127
|
+
export function audioFromJSON(jsonString) {
|
|
128
|
+
return safeParse(jsonString, (x) => Audio$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Audio' from JSON`);
|
|
129
|
+
}
|
|
130
|
+
/** @internal */
|
|
131
|
+
export const ObjectAudioSpeech$inboundSchema = z.enum(ObjectAudioSpeech);
|
|
132
|
+
/** @internal */
|
|
133
|
+
export const BatchResultUsage4$inboundSchema = z.object({
|
|
134
|
+
completion_tokens: z.int(),
|
|
135
|
+
prompt_tokens: z.int(),
|
|
136
|
+
total_tokens: z.int(),
|
|
137
|
+
}).transform((v) => {
|
|
138
|
+
return remap$(v, {
|
|
139
|
+
"completion_tokens": "completionTokens",
|
|
140
|
+
"prompt_tokens": "promptTokens",
|
|
141
|
+
"total_tokens": "totalTokens",
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
export function batchResultUsage4FromJSON(jsonString) {
|
|
145
|
+
return safeParse(jsonString, (x) => BatchResultUsage4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultUsage4' from JSON`);
|
|
146
|
+
}
|
|
147
|
+
/** @internal */
|
|
148
|
+
export const BodyAudioSpeech$inboundSchema = z.object({
|
|
149
|
+
audio: z.union([
|
|
150
|
+
z.lazy(() => AudioPcm2$inboundSchema),
|
|
151
|
+
z.lazy(() => AudioPcm1$inboundSchema),
|
|
152
|
+
]),
|
|
153
|
+
model: z.string(),
|
|
154
|
+
object: ObjectAudioSpeech$inboundSchema,
|
|
155
|
+
usage: z.lazy(() => BatchResultUsage4$inboundSchema),
|
|
156
|
+
});
|
|
157
|
+
export function bodyAudioSpeechFromJSON(jsonString) {
|
|
158
|
+
return safeParse(jsonString, (x) => BodyAudioSpeech$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BodyAudioSpeech' from JSON`);
|
|
159
|
+
}
|
|
160
|
+
/** @internal */
|
|
161
|
+
export const Embedding$inboundSchema = z.union([
|
|
162
|
+
z.array(z.number()),
|
|
163
|
+
z.string(),
|
|
164
|
+
]);
|
|
165
|
+
export function embeddingFromJSON(jsonString) {
|
|
166
|
+
return safeParse(jsonString, (x) => Embedding$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Embedding' from JSON`);
|
|
167
|
+
}
|
|
168
|
+
/** @internal */
|
|
169
|
+
export const ObjectEmbedding$inboundSchema = z.enum(ObjectEmbedding);
|
|
170
|
+
/** @internal */
|
|
171
|
+
export const BatchResultData$inboundSchema = z.object({
|
|
172
|
+
document_index: z.int().optional(),
|
|
173
|
+
embedding: z.union([z.array(z.number()), z.string()]),
|
|
174
|
+
index: z.int().optional(),
|
|
175
|
+
object: ObjectEmbedding$inboundSchema,
|
|
176
|
+
}).transform((v) => {
|
|
177
|
+
return remap$(v, {
|
|
178
|
+
"document_index": "documentIndex",
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
export function batchResultDataFromJSON(jsonString) {
|
|
182
|
+
return safeParse(jsonString, (x) => BatchResultData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultData' from JSON`);
|
|
183
|
+
}
|
|
184
|
+
/** @internal */
|
|
185
|
+
export const BatchResultObjectList$inboundSchema = z.enum(BatchResultObjectList);
|
|
186
|
+
/** @internal */
|
|
187
|
+
export const BatchResultPromptTokensDetails2$inboundSchema = z.object({
|
|
188
|
+
audio_tokens: z.int().optional(),
|
|
189
|
+
file_tokens: z.int().optional(),
|
|
190
|
+
image_tokens: z.int().optional(),
|
|
191
|
+
text_tokens: z.int().optional(),
|
|
192
|
+
video_tokens: z.int().optional(),
|
|
193
|
+
}).transform((v) => {
|
|
194
|
+
return remap$(v, {
|
|
195
|
+
"audio_tokens": "audioTokens",
|
|
196
|
+
"file_tokens": "fileTokens",
|
|
197
|
+
"image_tokens": "imageTokens",
|
|
198
|
+
"text_tokens": "textTokens",
|
|
199
|
+
"video_tokens": "videoTokens",
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
export function batchResultPromptTokensDetails2FromJSON(jsonString) {
|
|
203
|
+
return safeParse(jsonString, (x) => BatchResultPromptTokensDetails2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultPromptTokensDetails2' from JSON`);
|
|
204
|
+
}
|
|
205
|
+
/** @internal */
|
|
206
|
+
export const BatchResultUsage3$inboundSchema = z.object({
|
|
207
|
+
cost: z.number().optional(),
|
|
208
|
+
cost_details: z.nullable(CostDetails$inboundSchema).optional(),
|
|
209
|
+
is_byok: z.boolean().optional(),
|
|
210
|
+
prompt_tokens: z.int(),
|
|
211
|
+
prompt_tokens_details: z.lazy(() => BatchResultPromptTokensDetails2$inboundSchema).optional(),
|
|
212
|
+
total_tokens: z.int(),
|
|
213
|
+
}).transform((v) => {
|
|
214
|
+
return remap$(v, {
|
|
215
|
+
"cost_details": "costDetails",
|
|
216
|
+
"is_byok": "isByok",
|
|
217
|
+
"prompt_tokens": "promptTokens",
|
|
218
|
+
"prompt_tokens_details": "promptTokensDetails",
|
|
219
|
+
"total_tokens": "totalTokens",
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
export function batchResultUsage3FromJSON(jsonString) {
|
|
223
|
+
return safeParse(jsonString, (x) => BatchResultUsage3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultUsage3' from JSON`);
|
|
224
|
+
}
|
|
225
|
+
/** @internal */
|
|
226
|
+
export const BodyList$inboundSchema = z.object({
|
|
227
|
+
data: z.array(z.lazy(() => BatchResultData$inboundSchema)),
|
|
228
|
+
id: z.string().optional(),
|
|
229
|
+
model: z.string(),
|
|
230
|
+
object: BatchResultObjectList$inboundSchema,
|
|
231
|
+
usage: z.lazy(() => BatchResultUsage3$inboundSchema).optional(),
|
|
232
|
+
});
|
|
233
|
+
export function bodyListFromJSON(jsonString) {
|
|
234
|
+
return safeParse(jsonString, (x) => BodyList$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BodyList' from JSON`);
|
|
235
|
+
}
|
|
236
|
+
/** @internal */
|
|
237
|
+
export const BatchResultRole$inboundSchema = z.enum(BatchResultRole);
|
|
238
|
+
/** @internal */
|
|
239
|
+
export const BatchResultTypeMessage$inboundSchema = z.enum(BatchResultTypeMessage);
|
|
240
|
+
/** @internal */
|
|
241
|
+
export const BatchResultUsage2$inboundSchema = z.object({
|
|
242
|
+
cache_creation: z.nullable(AnthropicCacheCreation$inboundSchema),
|
|
243
|
+
cache_creation_input_tokens: z.nullable(z.int()),
|
|
244
|
+
cache_read_input_tokens: z.nullable(z.int()),
|
|
245
|
+
inference_geo: z.nullable(z.string()),
|
|
246
|
+
input_tokens: z.int(),
|
|
247
|
+
output_tokens: z.int(),
|
|
248
|
+
output_tokens_details: z.nullable(AnthropicOutputTokensDetails$inboundSchema),
|
|
249
|
+
server_tool_use: z.nullable(AnthropicServerToolUsage$inboundSchema),
|
|
250
|
+
service_tier: z.nullable(AnthropicServiceTier$inboundSchema),
|
|
251
|
+
iterations: z.array(AnthropicUsageIteration$inboundSchema).optional(),
|
|
252
|
+
speed: z.nullable(AnthropicSpeed$inboundSchema).optional(),
|
|
253
|
+
}).transform((v) => {
|
|
254
|
+
return remap$(v, {
|
|
255
|
+
"cache_creation": "cacheCreation",
|
|
256
|
+
"cache_creation_input_tokens": "cacheCreationInputTokens",
|
|
257
|
+
"cache_read_input_tokens": "cacheReadInputTokens",
|
|
258
|
+
"inference_geo": "inferenceGeo",
|
|
259
|
+
"input_tokens": "inputTokens",
|
|
260
|
+
"output_tokens": "outputTokens",
|
|
261
|
+
"output_tokens_details": "outputTokensDetails",
|
|
262
|
+
"server_tool_use": "serverToolUse",
|
|
263
|
+
"service_tier": "serviceTier",
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
export function batchResultUsage2FromJSON(jsonString) {
|
|
267
|
+
return safeParse(jsonString, (x) => BatchResultUsage2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultUsage2' from JSON`);
|
|
268
|
+
}
|
|
269
|
+
/** @internal */
|
|
270
|
+
export const BodyMessage$inboundSchema = z
|
|
271
|
+
.object({
|
|
272
|
+
container: z.nullable(AnthropicContainer$inboundSchema),
|
|
273
|
+
content: z.array(ORAnthropicContentBlock$inboundSchema),
|
|
274
|
+
id: z.string(),
|
|
275
|
+
input_transformations: z.nullable(z.array(AnthropicInputTransformation$inboundSchema)).optional(),
|
|
276
|
+
model: z.string(),
|
|
277
|
+
role: BatchResultRole$inboundSchema,
|
|
278
|
+
stop_details: z.nullable(AnthropicRefusalStopDetails$inboundSchema),
|
|
279
|
+
stop_reason: z.nullable(ORAnthropicStopReason$inboundSchema),
|
|
280
|
+
stop_sequence: z.nullable(z.string()),
|
|
281
|
+
type: BatchResultTypeMessage$inboundSchema,
|
|
282
|
+
usage: z.lazy(() => BatchResultUsage2$inboundSchema),
|
|
283
|
+
}).transform((v) => {
|
|
284
|
+
return remap$(v, {
|
|
285
|
+
"input_transformations": "inputTransformations",
|
|
286
|
+
"stop_details": "stopDetails",
|
|
287
|
+
"stop_reason": "stopReason",
|
|
288
|
+
"stop_sequence": "stopSequence",
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
export function bodyMessageFromJSON(jsonString) {
|
|
292
|
+
return safeParse(jsonString, (x) => BodyMessage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BodyMessage' from JSON`);
|
|
293
|
+
}
|
|
294
|
+
/** @internal */
|
|
295
|
+
export const ContentTopLogprob$inboundSchema = z.object({
|
|
296
|
+
bytes: z.nullable(z.array(z.int())),
|
|
297
|
+
logprob: z.number(),
|
|
298
|
+
token: z.string(),
|
|
299
|
+
});
|
|
300
|
+
export function contentTopLogprobFromJSON(jsonString) {
|
|
301
|
+
return safeParse(jsonString, (x) => ContentTopLogprob$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentTopLogprob' from JSON`);
|
|
302
|
+
}
|
|
303
|
+
/** @internal */
|
|
304
|
+
export const LogprobsContent$inboundSchema = z.object({
|
|
305
|
+
bytes: z.nullable(z.array(z.int())),
|
|
306
|
+
logprob: z.number(),
|
|
307
|
+
token: z.string(),
|
|
308
|
+
top_logprobs: z.array(z.lazy(() => ContentTopLogprob$inboundSchema)),
|
|
309
|
+
}).transform((v) => {
|
|
310
|
+
return remap$(v, {
|
|
311
|
+
"top_logprobs": "topLogprobs",
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
export function logprobsContentFromJSON(jsonString) {
|
|
315
|
+
return safeParse(jsonString, (x) => LogprobsContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LogprobsContent' from JSON`);
|
|
316
|
+
}
|
|
317
|
+
/** @internal */
|
|
318
|
+
export const RefusalTopLogprob$inboundSchema = z.object({
|
|
319
|
+
bytes: z.nullable(z.array(z.int())),
|
|
320
|
+
logprob: z.number(),
|
|
321
|
+
token: z.string(),
|
|
322
|
+
});
|
|
323
|
+
export function refusalTopLogprobFromJSON(jsonString) {
|
|
324
|
+
return safeParse(jsonString, (x) => RefusalTopLogprob$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RefusalTopLogprob' from JSON`);
|
|
325
|
+
}
|
|
326
|
+
/** @internal */
|
|
327
|
+
export const Refusal$inboundSchema = z.object({
|
|
328
|
+
bytes: z.nullable(z.array(z.int())),
|
|
329
|
+
logprob: z.number(),
|
|
330
|
+
token: z.string(),
|
|
331
|
+
top_logprobs: z.array(z.lazy(() => RefusalTopLogprob$inboundSchema)),
|
|
332
|
+
}).transform((v) => {
|
|
333
|
+
return remap$(v, {
|
|
334
|
+
"top_logprobs": "topLogprobs",
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
export function refusalFromJSON(jsonString) {
|
|
338
|
+
return safeParse(jsonString, (x) => Refusal$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Refusal' from JSON`);
|
|
339
|
+
}
|
|
340
|
+
/** @internal */
|
|
341
|
+
export const Logprobs$inboundSchema = z.object({
|
|
342
|
+
content: z.nullable(z.array(z.lazy(() => LogprobsContent$inboundSchema))),
|
|
343
|
+
refusal: z.nullable(z.array(z.lazy(() => Refusal$inboundSchema))).optional(),
|
|
344
|
+
});
|
|
345
|
+
export function logprobsFromJSON(jsonString) {
|
|
346
|
+
return safeParse(jsonString, (x) => Logprobs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Logprobs' from JSON`);
|
|
347
|
+
}
|
|
348
|
+
/** @internal */
|
|
349
|
+
export const WebSearchCitation$inboundSchema = z.object({
|
|
350
|
+
cited_text: z.string().optional(),
|
|
351
|
+
encrypted_index: z.string().optional(),
|
|
352
|
+
title: z.nullable(z.string()),
|
|
353
|
+
url: z.string(),
|
|
354
|
+
}).transform((v) => {
|
|
355
|
+
return remap$(v, {
|
|
356
|
+
"cited_text": "citedText",
|
|
357
|
+
"encrypted_index": "encryptedIndex",
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
export function webSearchCitationFromJSON(jsonString) {
|
|
361
|
+
return safeParse(jsonString, (x) => WebSearchCitation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebSearchCitation' from JSON`);
|
|
362
|
+
}
|
|
363
|
+
/** @internal */
|
|
364
|
+
export const AnnotationWebSearchCitation$inboundSchema = z.object({
|
|
365
|
+
type: z.literal("web_search_citation"),
|
|
366
|
+
web_search_citation: z.lazy(() => WebSearchCitation$inboundSchema),
|
|
367
|
+
}).transform((v) => {
|
|
368
|
+
return remap$(v, {
|
|
369
|
+
"web_search_citation": "webSearchCitation",
|
|
370
|
+
});
|
|
371
|
+
});
|
|
372
|
+
export function annotationWebSearchCitationFromJSON(jsonString) {
|
|
373
|
+
return safeParse(jsonString, (x) => AnnotationWebSearchCitation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnnotationWebSearchCitation' from JSON`);
|
|
374
|
+
}
|
|
375
|
+
/** @internal */
|
|
376
|
+
export const BatchResultUrlCitation$inboundSchema = z.object({
|
|
377
|
+
content: z.string().optional(),
|
|
378
|
+
end_index: z.int(),
|
|
379
|
+
start_index: z.int(),
|
|
380
|
+
title: z.string(),
|
|
381
|
+
uncited: z.literal(true).optional(),
|
|
382
|
+
url: z.string(),
|
|
383
|
+
}).transform((v) => {
|
|
384
|
+
return remap$(v, {
|
|
385
|
+
"end_index": "endIndex",
|
|
386
|
+
"start_index": "startIndex",
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
export function batchResultUrlCitationFromJSON(jsonString) {
|
|
390
|
+
return safeParse(jsonString, (x) => BatchResultUrlCitation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultUrlCitation' from JSON`);
|
|
391
|
+
}
|
|
392
|
+
/** @internal */
|
|
393
|
+
export const AnnotationURLCitation$inboundSchema = z.object({
|
|
394
|
+
type: z.literal("url_citation"),
|
|
395
|
+
url_citation: z.lazy(() => BatchResultUrlCitation$inboundSchema),
|
|
396
|
+
}).transform((v) => {
|
|
397
|
+
return remap$(v, {
|
|
398
|
+
"url_citation": "urlCitation",
|
|
399
|
+
});
|
|
400
|
+
});
|
|
401
|
+
export function annotationURLCitationFromJSON(jsonString) {
|
|
402
|
+
return safeParse(jsonString, (x) => AnnotationURLCitation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnnotationURLCitation' from JSON`);
|
|
403
|
+
}
|
|
404
|
+
/** @internal */
|
|
405
|
+
export const ContentImageUrlImageUrl$inboundSchema = z.object({
|
|
406
|
+
url: z.string(),
|
|
407
|
+
});
|
|
408
|
+
export function contentImageUrlImageUrlFromJSON(jsonString) {
|
|
409
|
+
return safeParse(jsonString, (x) => ContentImageUrlImageUrl$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentImageUrlImageUrl' from JSON`);
|
|
410
|
+
}
|
|
411
|
+
/** @internal */
|
|
412
|
+
export const ContentImageURL$inboundSchema = z.object({
|
|
413
|
+
image_url: z.lazy(() => ContentImageUrlImageUrl$inboundSchema),
|
|
414
|
+
type: z.literal("image_url"),
|
|
415
|
+
}).transform((v) => {
|
|
416
|
+
return remap$(v, {
|
|
417
|
+
"image_url": "imageUrl",
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
export function contentImageURLFromJSON(jsonString) {
|
|
421
|
+
return safeParse(jsonString, (x) => ContentImageURL$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentImageURL' from JSON`);
|
|
422
|
+
}
|
|
423
|
+
/** @internal */
|
|
424
|
+
export const ContentText$inboundSchema = z
|
|
425
|
+
.object({
|
|
426
|
+
text: z.string(),
|
|
427
|
+
type: z.literal("text"),
|
|
428
|
+
});
|
|
429
|
+
export function contentTextFromJSON(jsonString) {
|
|
430
|
+
return safeParse(jsonString, (x) => ContentText$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentText' from JSON`);
|
|
431
|
+
}
|
|
432
|
+
/** @internal */
|
|
433
|
+
export const AnnotationContentUnion$inboundSchema = discriminatedUnion("type", {
|
|
434
|
+
text: z.lazy(() => ContentText$inboundSchema),
|
|
435
|
+
image_url: z.lazy(() => ContentImageURL$inboundSchema),
|
|
436
|
+
});
|
|
437
|
+
export function annotationContentUnionFromJSON(jsonString) {
|
|
438
|
+
return safeParse(jsonString, (x) => AnnotationContentUnion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnnotationContentUnion' from JSON`);
|
|
439
|
+
}
|
|
440
|
+
/** @internal */
|
|
441
|
+
export const BatchResultFile$inboundSchema = z.object({
|
|
442
|
+
content: z.array(discriminatedUnion("type", {
|
|
443
|
+
text: z.lazy(() => ContentText$inboundSchema),
|
|
444
|
+
image_url: z.lazy(() => ContentImageURL$inboundSchema),
|
|
445
|
+
})),
|
|
446
|
+
hash: z.string(),
|
|
447
|
+
name: z.string().optional(),
|
|
448
|
+
});
|
|
449
|
+
export function batchResultFileFromJSON(jsonString) {
|
|
450
|
+
return safeParse(jsonString, (x) => BatchResultFile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultFile' from JSON`);
|
|
451
|
+
}
|
|
452
|
+
/** @internal */
|
|
453
|
+
export const AnnotationFile$inboundSchema = z.object({
|
|
454
|
+
file: z.lazy(() => BatchResultFile$inboundSchema),
|
|
455
|
+
type: z.literal("file"),
|
|
456
|
+
});
|
|
457
|
+
export function annotationFileFromJSON(jsonString) {
|
|
458
|
+
return safeParse(jsonString, (x) => AnnotationFile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnnotationFile' from JSON`);
|
|
459
|
+
}
|
|
460
|
+
/** @internal */
|
|
461
|
+
export const Annotation$inboundSchema = discriminatedUnion("type", {
|
|
462
|
+
file: z.lazy(() => AnnotationFile$inboundSchema),
|
|
463
|
+
url_citation: z.lazy(() => AnnotationURLCitation$inboundSchema),
|
|
464
|
+
web_search_citation: z.lazy(() => AnnotationWebSearchCitation$inboundSchema),
|
|
465
|
+
});
|
|
466
|
+
export function annotationFromJSON(jsonString) {
|
|
467
|
+
return safeParse(jsonString, (x) => Annotation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Annotation' from JSON`);
|
|
468
|
+
}
|
|
469
|
+
/** @internal */
|
|
470
|
+
export const BatchResultImageUrl$inboundSchema = z.object({
|
|
471
|
+
url: z.string(),
|
|
472
|
+
});
|
|
473
|
+
export function batchResultImageUrlFromJSON(jsonString) {
|
|
474
|
+
return safeParse(jsonString, (x) => BatchResultImageUrl$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultImageUrl' from JSON`);
|
|
475
|
+
}
|
|
476
|
+
/** @internal */
|
|
477
|
+
export const ChoiceTypeImageURLEnum$inboundSchema = z.enum(ChoiceTypeImageURLEnum);
|
|
478
|
+
/** @internal */
|
|
479
|
+
export const Image$inboundSchema = z.object({
|
|
480
|
+
image_url: z.lazy(() => BatchResultImageUrl$inboundSchema),
|
|
481
|
+
type: ChoiceTypeImageURLEnum$inboundSchema,
|
|
482
|
+
}).transform((v) => {
|
|
483
|
+
return remap$(v, {
|
|
484
|
+
"image_url": "imageUrl",
|
|
485
|
+
});
|
|
486
|
+
});
|
|
487
|
+
export function imageFromJSON(jsonString) {
|
|
488
|
+
return safeParse(jsonString, (x) => Image$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Image' from JSON`);
|
|
489
|
+
}
|
|
490
|
+
/** @internal */
|
|
491
|
+
export const ReasoningDetail$inboundSchema = discriminatedUnion("type", {
|
|
492
|
+
["reasoning.summary"]: ReasoningDetailSummary$inboundSchema,
|
|
493
|
+
["reasoning.encrypted"]: ReasoningDetailEncrypted$inboundSchema,
|
|
494
|
+
["reasoning.text"]: ReasoningDetailText$inboundSchema,
|
|
495
|
+
["reasoning.server_tool_call"]: ReasoningDetailServerToolCall$inboundSchema,
|
|
496
|
+
});
|
|
497
|
+
export function reasoningDetailFromJSON(jsonString) {
|
|
498
|
+
return safeParse(jsonString, (x) => ReasoningDetail$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReasoningDetail' from JSON`);
|
|
499
|
+
}
|
|
500
|
+
/** @internal */
|
|
501
|
+
export const ChoiceRole$inboundSchema = z.enum(ChoiceRole);
|
|
502
|
+
/** @internal */
|
|
503
|
+
export const BatchResultFunction$inboundSchema = z.object({
|
|
504
|
+
arguments: z.string(),
|
|
505
|
+
name: z.string(),
|
|
506
|
+
});
|
|
507
|
+
export function batchResultFunctionFromJSON(jsonString) {
|
|
508
|
+
return safeParse(jsonString, (x) => BatchResultFunction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultFunction' from JSON`);
|
|
509
|
+
}
|
|
510
|
+
/** @internal */
|
|
511
|
+
export const ChoiceTypeFunction$inboundSchema = z.enum(ChoiceTypeFunction);
|
|
512
|
+
/** @internal */
|
|
513
|
+
export const ToolCall$inboundSchema = z.object({
|
|
514
|
+
function: z.lazy(() => BatchResultFunction$inboundSchema),
|
|
515
|
+
id: z.string(),
|
|
516
|
+
index: z.int(),
|
|
517
|
+
type: ChoiceTypeFunction$inboundSchema,
|
|
518
|
+
});
|
|
519
|
+
export function toolCallFromJSON(jsonString) {
|
|
520
|
+
return safeParse(jsonString, (x) => ToolCall$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ToolCall' from JSON`);
|
|
521
|
+
}
|
|
522
|
+
/** @internal */
|
|
523
|
+
export const Message$inboundSchema = z.object({
|
|
524
|
+
annotations: z.array(discriminatedUnion("type", {
|
|
525
|
+
file: z.lazy(() => AnnotationFile$inboundSchema),
|
|
526
|
+
url_citation: z.lazy(() => AnnotationURLCitation$inboundSchema),
|
|
527
|
+
web_search_citation: z.lazy(() => AnnotationWebSearchCitation$inboundSchema),
|
|
528
|
+
})).optional(),
|
|
529
|
+
content: z.nullable(z.string()),
|
|
530
|
+
images: z.nullable(z.array(z.lazy(() => Image$inboundSchema))).optional(),
|
|
531
|
+
reasoning: z.nullable(z.string()).optional(),
|
|
532
|
+
reasoning_details: z.nullable(z.array(z.nullable(discriminatedUnion("type", {
|
|
533
|
+
["reasoning.summary"]: ReasoningDetailSummary$inboundSchema,
|
|
534
|
+
["reasoning.encrypted"]: ReasoningDetailEncrypted$inboundSchema,
|
|
535
|
+
["reasoning.text"]: ReasoningDetailText$inboundSchema,
|
|
536
|
+
["reasoning.server_tool_call"]: ReasoningDetailServerToolCall$inboundSchema,
|
|
537
|
+
})))).optional(),
|
|
538
|
+
refusal: z.nullable(z.string()),
|
|
539
|
+
role: ChoiceRole$inboundSchema,
|
|
540
|
+
tool_calls: z.array(z.lazy(() => ToolCall$inboundSchema)).optional(),
|
|
541
|
+
}).transform((v) => {
|
|
542
|
+
return remap$(v, {
|
|
543
|
+
"reasoning_details": "reasoningDetails",
|
|
544
|
+
"tool_calls": "toolCalls",
|
|
545
|
+
});
|
|
546
|
+
});
|
|
547
|
+
export function messageFromJSON(jsonString) {
|
|
548
|
+
return safeParse(jsonString, (x) => Message$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Message' from JSON`);
|
|
549
|
+
}
|
|
550
|
+
/** @internal */
|
|
551
|
+
export const Choice$inboundSchema = z.object({
|
|
552
|
+
finish_reason: FinishReason$inboundSchema,
|
|
553
|
+
index: z.int(),
|
|
554
|
+
logprobs: z.nullable(z.lazy(() => Logprobs$inboundSchema)),
|
|
555
|
+
message: z.lazy(() => Message$inboundSchema),
|
|
556
|
+
native_finish_reason: z.nullable(z.string()),
|
|
557
|
+
}).transform((v) => {
|
|
558
|
+
return remap$(v, {
|
|
559
|
+
"finish_reason": "finishReason",
|
|
560
|
+
"native_finish_reason": "nativeFinishReason",
|
|
561
|
+
});
|
|
562
|
+
});
|
|
563
|
+
export function choiceFromJSON(jsonString) {
|
|
564
|
+
return safeParse(jsonString, (x) => Choice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Choice' from JSON`);
|
|
565
|
+
}
|
|
566
|
+
/** @internal */
|
|
567
|
+
export const BatchResultEvent$inboundSchema = openEnums.inboundSchema(BatchResultEvent);
|
|
568
|
+
/** @internal */
|
|
569
|
+
export const BatchResultTimings$inboundSchema = z.object({
|
|
570
|
+
epoch_ms: z.int(),
|
|
571
|
+
event: BatchResultEvent$inboundSchema,
|
|
572
|
+
start_ms: z.int(),
|
|
573
|
+
}).transform((v) => {
|
|
574
|
+
return remap$(v, {
|
|
575
|
+
"epoch_ms": "epochMs",
|
|
576
|
+
"start_ms": "startMs",
|
|
577
|
+
});
|
|
578
|
+
});
|
|
579
|
+
export function batchResultTimingsFromJSON(jsonString) {
|
|
580
|
+
return safeParse(jsonString, (x) => BatchResultTimings$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultTimings' from JSON`);
|
|
581
|
+
}
|
|
582
|
+
/** @internal */
|
|
583
|
+
export const BatchResultDebug$inboundSchema = collectExtraKeys$(z.object({
|
|
584
|
+
echo_upstream_body: z.record(z.string(), z.any()).optional(),
|
|
585
|
+
timings: z.lazy(() => BatchResultTimings$inboundSchema).optional(),
|
|
586
|
+
}).catchall(z.any()), "additionalProperties", true).transform((v) => {
|
|
587
|
+
return remap$(v, {
|
|
588
|
+
"echo_upstream_body": "echoUpstreamBody",
|
|
589
|
+
});
|
|
590
|
+
});
|
|
591
|
+
export function batchResultDebugFromJSON(jsonString) {
|
|
592
|
+
return safeParse(jsonString, (x) => BatchResultDebug$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultDebug' from JSON`);
|
|
593
|
+
}
|
|
594
|
+
/** @internal */
|
|
595
|
+
export const BatchResultObjectChatCompletion$inboundSchema = z.enum(BatchResultObjectChatCompletion);
|
|
596
|
+
/** @internal */
|
|
597
|
+
export const BatchResultCompletionTokensDetails$inboundSchema = z.object({
|
|
598
|
+
audio_tokens: z.nullable(z.int()).optional(),
|
|
599
|
+
image_tokens: z.nullable(z.int()).optional(),
|
|
600
|
+
reasoning_tokens: z.nullable(z.int()).optional(),
|
|
601
|
+
}).transform((v) => {
|
|
602
|
+
return remap$(v, {
|
|
603
|
+
"audio_tokens": "audioTokens",
|
|
604
|
+
"image_tokens": "imageTokens",
|
|
605
|
+
"reasoning_tokens": "reasoningTokens",
|
|
606
|
+
});
|
|
607
|
+
});
|
|
608
|
+
export function batchResultCompletionTokensDetailsFromJSON(jsonString) {
|
|
609
|
+
return safeParse(jsonString, (x) => BatchResultCompletionTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultCompletionTokensDetails' from JSON`);
|
|
610
|
+
}
|
|
611
|
+
/** @internal */
|
|
612
|
+
export const BatchResultPromptTokensDetails1$inboundSchema = z.object({
|
|
613
|
+
audio_tokens: z.nullable(z.int()).optional(),
|
|
614
|
+
cache_write_tokens: z.nullable(z.int()).optional(),
|
|
615
|
+
cached_tokens: z.nullable(z.int()).optional(),
|
|
616
|
+
file_tokens: z.nullable(z.int()).optional(),
|
|
617
|
+
video_tokens: z.nullable(z.int()).optional(),
|
|
618
|
+
}).transform((v) => {
|
|
619
|
+
return remap$(v, {
|
|
620
|
+
"audio_tokens": "audioTokens",
|
|
621
|
+
"cache_write_tokens": "cacheWriteTokens",
|
|
622
|
+
"cached_tokens": "cachedTokens",
|
|
623
|
+
"file_tokens": "fileTokens",
|
|
624
|
+
"video_tokens": "videoTokens",
|
|
625
|
+
});
|
|
626
|
+
});
|
|
627
|
+
export function batchResultPromptTokensDetails1FromJSON(jsonString) {
|
|
628
|
+
return safeParse(jsonString, (x) => BatchResultPromptTokensDetails1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultPromptTokensDetails1' from JSON`);
|
|
629
|
+
}
|
|
630
|
+
/** @internal */
|
|
631
|
+
export const BatchResultServerToolUse$inboundSchema = z.object({
|
|
632
|
+
tool_calls_executed: z.nullable(z.int()).optional(),
|
|
633
|
+
tool_calls_requested: z.nullable(z.int()).optional(),
|
|
634
|
+
web_search_requests: z.nullable(z.int()).optional(),
|
|
635
|
+
}).transform((v) => {
|
|
636
|
+
return remap$(v, {
|
|
637
|
+
"tool_calls_executed": "toolCallsExecuted",
|
|
638
|
+
"tool_calls_requested": "toolCallsRequested",
|
|
639
|
+
"web_search_requests": "webSearchRequests",
|
|
640
|
+
});
|
|
641
|
+
});
|
|
642
|
+
export function batchResultServerToolUseFromJSON(jsonString) {
|
|
643
|
+
return safeParse(jsonString, (x) => BatchResultServerToolUse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultServerToolUse' from JSON`);
|
|
644
|
+
}
|
|
645
|
+
/** @internal */
|
|
646
|
+
export const BatchResultServerToolUseDetails$inboundSchema = z.object({
|
|
647
|
+
tool_calls_executed: z.nullable(z.int()).optional(),
|
|
648
|
+
tool_calls_requested: z.nullable(z.int()).optional(),
|
|
649
|
+
web_search_requests: z.nullable(z.int()).optional(),
|
|
650
|
+
}).transform((v) => {
|
|
651
|
+
return remap$(v, {
|
|
652
|
+
"tool_calls_executed": "toolCallsExecuted",
|
|
653
|
+
"tool_calls_requested": "toolCallsRequested",
|
|
654
|
+
"web_search_requests": "webSearchRequests",
|
|
655
|
+
});
|
|
656
|
+
});
|
|
657
|
+
export function batchResultServerToolUseDetailsFromJSON(jsonString) {
|
|
658
|
+
return safeParse(jsonString, (x) => BatchResultServerToolUseDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultServerToolUseDetails' from JSON`);
|
|
659
|
+
}
|
|
660
|
+
/** @internal */
|
|
661
|
+
export const BatchResultUsage1$inboundSchema = z.object({
|
|
662
|
+
completion_tokens: z.int(),
|
|
663
|
+
completion_tokens_details: z.nullable(z.lazy(() => BatchResultCompletionTokensDetails$inboundSchema)).optional(),
|
|
664
|
+
prompt_tokens: z.int(),
|
|
665
|
+
prompt_tokens_details: z.nullable(z.lazy(() => BatchResultPromptTokensDetails1$inboundSchema)).optional(),
|
|
666
|
+
server_tool_use: z.nullable(z.lazy(() => BatchResultServerToolUse$inboundSchema)).optional(),
|
|
667
|
+
server_tool_use_details: z.nullable(z.lazy(() => BatchResultServerToolUseDetails$inboundSchema)).optional(),
|
|
668
|
+
total_tokens: z.int(),
|
|
669
|
+
}).transform((v) => {
|
|
670
|
+
return remap$(v, {
|
|
671
|
+
"completion_tokens": "completionTokens",
|
|
672
|
+
"completion_tokens_details": "completionTokensDetails",
|
|
673
|
+
"prompt_tokens": "promptTokens",
|
|
674
|
+
"prompt_tokens_details": "promptTokensDetails",
|
|
675
|
+
"server_tool_use": "serverToolUse",
|
|
676
|
+
"server_tool_use_details": "serverToolUseDetails",
|
|
677
|
+
"total_tokens": "totalTokens",
|
|
678
|
+
});
|
|
679
|
+
});
|
|
680
|
+
export function batchResultUsage1FromJSON(jsonString) {
|
|
681
|
+
return safeParse(jsonString, (x) => BatchResultUsage1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultUsage1' from JSON`);
|
|
682
|
+
}
|
|
683
|
+
/** @internal */
|
|
684
|
+
export const BodyChatCompletion$inboundSchema = z.object({
|
|
685
|
+
alignment: Alignment$inboundSchema.optional(),
|
|
686
|
+
choices: z.array(z.lazy(() => Choice$inboundSchema)),
|
|
687
|
+
created: z.int(),
|
|
688
|
+
debug: z.lazy(() => BatchResultDebug$inboundSchema).optional(),
|
|
689
|
+
id: z.string(),
|
|
690
|
+
model: z.string(),
|
|
691
|
+
object: BatchResultObjectChatCompletion$inboundSchema,
|
|
692
|
+
openrouter_metadata: OpenRouterMetadata$inboundSchema.optional(),
|
|
693
|
+
provider: z.nullable(z.string()).optional(),
|
|
694
|
+
safeguard_results: z.array(ArmorSafeguardResult$inboundSchema).optional(),
|
|
695
|
+
service_tier: z.nullable(z.string()).optional(),
|
|
696
|
+
system_fingerprint: z.nullable(z.string()).optional(),
|
|
697
|
+
usage: z.lazy(() => BatchResultUsage1$inboundSchema).optional(),
|
|
698
|
+
}).transform((v) => {
|
|
699
|
+
return remap$(v, {
|
|
700
|
+
"openrouter_metadata": "openrouterMetadata",
|
|
701
|
+
"safeguard_results": "safeguardResults",
|
|
702
|
+
"service_tier": "serviceTier",
|
|
703
|
+
"system_fingerprint": "systemFingerprint",
|
|
704
|
+
});
|
|
705
|
+
});
|
|
706
|
+
export function bodyChatCompletionFromJSON(jsonString) {
|
|
707
|
+
return safeParse(jsonString, (x) => BodyChatCompletion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BodyChatCompletion' from JSON`);
|
|
708
|
+
}
|
|
709
|
+
/** @internal */
|
|
710
|
+
export const Body$inboundSchema = z.union([
|
|
711
|
+
OpenResponsesResult$inboundSchema,
|
|
712
|
+
z.lazy(() => BodyMessage$inboundSchema),
|
|
713
|
+
z.lazy(() => BodyChatCompletion$inboundSchema),
|
|
714
|
+
z.lazy(() => BodyAudioSpeech$inboundSchema),
|
|
715
|
+
z.lazy(() => BodyList$inboundSchema),
|
|
716
|
+
]);
|
|
717
|
+
export function bodyFromJSON(jsonString) {
|
|
718
|
+
return safeParse(jsonString, (x) => Body$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Body' from JSON`);
|
|
719
|
+
}
|
|
720
|
+
/** @internal */
|
|
721
|
+
export const BatchResultResponse$inboundSchema = z.object({
|
|
722
|
+
body: z.union([
|
|
723
|
+
OpenResponsesResult$inboundSchema,
|
|
724
|
+
z.lazy(() => BodyMessage$inboundSchema),
|
|
725
|
+
z.lazy(() => BodyChatCompletion$inboundSchema),
|
|
726
|
+
z.lazy(() => BodyAudioSpeech$inboundSchema),
|
|
727
|
+
z.lazy(() => BodyList$inboundSchema),
|
|
728
|
+
]),
|
|
729
|
+
request_id: z.nullable(z.string()),
|
|
730
|
+
status_code: z.int(),
|
|
731
|
+
}).transform((v) => {
|
|
732
|
+
return remap$(v, {
|
|
733
|
+
"request_id": "requestId",
|
|
734
|
+
"status_code": "statusCode",
|
|
735
|
+
});
|
|
736
|
+
});
|
|
737
|
+
export function batchResultResponseFromJSON(jsonString) {
|
|
738
|
+
return safeParse(jsonString, (x) => BatchResultResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResultResponse' from JSON`);
|
|
739
|
+
}
|
|
740
|
+
/** @internal */
|
|
741
|
+
export const BatchResult$inboundSchema = z
|
|
742
|
+
.object({
|
|
743
|
+
custom_id: z.string(),
|
|
744
|
+
error: z.nullable(z.lazy(() => BatchResultError$inboundSchema)),
|
|
745
|
+
id: z.string(),
|
|
746
|
+
response: z.nullable(z.lazy(() => BatchResultResponse$inboundSchema)),
|
|
747
|
+
}).transform((v) => {
|
|
748
|
+
return remap$(v, {
|
|
749
|
+
"custom_id": "customId",
|
|
750
|
+
});
|
|
751
|
+
});
|
|
752
|
+
export function batchResultFromJSON(jsonString) {
|
|
753
|
+
return safeParse(jsonString, (x) => BatchResult$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchResult' from JSON`);
|
|
754
|
+
}
|
|
755
|
+
//# sourceMappingURL=batchresult.js.map
|