objectiveai 1.2.0 → 1.2.2

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.
Files changed (4) hide show
  1. package/dist/index.cjs +1132 -1073
  2. package/dist/index.d.ts +7328 -11841
  3. package/dist/index.js +1131 -1072
  4. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4,145 +4,114 @@ export const ExpressionSchema = z
4
4
  .object({
5
5
  $jmespath: z.string().describe("A JMESPath expression."),
6
6
  })
7
- .describe("An expression which evaluates to a value.");
7
+ .describe("An expression which evaluates to a value.")
8
+ .meta({ title: "Expression" });
8
9
  export const JsonValueSchema = z
9
10
  .lazy(() => z.union([
10
11
  z.null(),
11
12
  z.boolean(),
12
13
  z.number(),
13
14
  z.string(),
14
- z.array(JsonValueSchema),
15
- z.record(z.string(), JsonValueSchema),
15
+ z.array(JsonValueSchema.meta({
16
+ title: "JsonValue",
17
+ recursive: true,
18
+ })),
19
+ z.record(z.string(), JsonValueSchema.meta({
20
+ title: "JsonValue",
21
+ recursive: true,
22
+ })),
16
23
  ]))
17
- .describe("A JSON value.");
24
+ .describe("A JSON value.")
25
+ .meta({ title: "JsonValue" });
18
26
  export const JsonValueExpressionSchema = z
19
27
  .lazy(() => z.union([
20
28
  z.null(),
21
29
  z.boolean(),
22
30
  z.number(),
23
31
  z.string(),
24
- z.array(JsonValueExpressionSchema),
25
- z.record(z.string(), JsonValueExpressionSchema),
32
+ z.array(JsonValueExpressionSchema.meta({
33
+ title: "JsonValueExpression",
34
+ recursive: true,
35
+ })),
36
+ z.record(z.string(), JsonValueExpressionSchema.meta({
37
+ title: "JsonValueExpression",
38
+ recursive: true,
39
+ })),
26
40
  ExpressionSchema.describe("An expression which evaluates to a JSON value."),
27
41
  ]))
28
- .describe(JsonValueSchema.description);
42
+ .describe(JsonValueSchema.description)
43
+ .meta({ title: "JsonValueExpression" });
29
44
  // Errors
30
45
  export const ObjectiveAIErrorSchema = z
31
46
  .object({
32
47
  code: z.uint32().describe("The status code of the error."),
33
48
  message: z.any().describe("The message or details of the error."),
34
49
  })
35
- .describe("An error returned by the ObjectiveAI API.");
50
+ .describe("An error returned by the ObjectiveAI API.")
51
+ .meta({ title: "ObjectiveAIError" });
36
52
  // Messages
37
- export const MessageSchema = z
38
- .discriminatedUnion("role", [
39
- Message.DeveloperSchema,
40
- Message.SystemSchema,
41
- Message.UserSchema,
42
- Message.ToolSchema,
43
- Message.AssistantSchema,
44
- ])
45
- .describe("A message exchanged in a chat conversation.");
46
- export const MessageExpressionSchema = z
47
- .union([
48
- z
49
- .discriminatedUnion("role", [
50
- Message.DeveloperExpressionSchema,
51
- Message.SystemExpressionSchema,
52
- Message.UserExpressionSchema,
53
- Message.ToolExpressionSchema,
54
- Message.AssistantExpressionSchema,
55
- ])
56
- .describe(MessageSchema.description),
57
- ExpressionSchema.describe("An expression which evaluates to a message."),
58
- ])
59
- .describe(MessageSchema.description);
60
53
  export var Message;
61
54
  (function (Message) {
62
- Message.SimpleContentPartSchema = z
63
- .object({
64
- type: z.literal("text"),
65
- text: z.string().describe("The text content."),
66
- })
67
- .describe("A simple text content part.");
68
- Message.SimpleContentSchema = z
69
- .union([SimpleContent.TextSchema, SimpleContent.PartsSchema])
70
- .describe("Simple content.");
71
- Message.SimpleContentExpressionSchema = z
72
- .union([
73
- SimpleContent.TextSchema,
74
- SimpleContent.PartsExpressionSchema,
75
- ExpressionSchema.describe("An expression which evaluates to simple content."),
76
- ])
77
- .describe(Message.SimpleContentSchema.description);
78
55
  let SimpleContent;
79
56
  (function (SimpleContent) {
80
- SimpleContent.TextSchema = z.string().describe("Plain text content.");
57
+ SimpleContent.TextSchema = z
58
+ .string()
59
+ .describe("Plain text content.")
60
+ .meta({ title: "SimpleContentText" });
81
61
  SimpleContent.PartSchema = z
82
62
  .object({
83
63
  type: z.literal("text"),
84
64
  text: z.string().describe("The text content."),
85
65
  })
86
- .describe("A simple content part.");
66
+ .describe("A simple content part.")
67
+ .meta({ title: "SimpleContentPart" });
87
68
  SimpleContent.PartExpressionSchema = z
88
69
  .union([
89
70
  SimpleContent.PartSchema,
90
71
  ExpressionSchema.describe("An expression which evaluates to a simple content part."),
91
72
  ])
92
- .describe(SimpleContent.PartSchema.description);
73
+ .describe(SimpleContent.PartSchema.description)
74
+ .meta({ title: "SimpleContentPartExpression" });
93
75
  SimpleContent.PartsSchema = z
94
76
  .array(SimpleContent.PartSchema)
95
- .describe("An array of simple content parts.");
77
+ .describe("An array of simple content parts.")
78
+ .meta({ title: "SimpleContentParts" });
96
79
  SimpleContent.PartsExpressionSchema = z
97
80
  .array(SimpleContent.PartExpressionSchema)
98
- .describe(SimpleContent.PartsSchema.description);
81
+ .describe(SimpleContent.PartsSchema.description)
82
+ .meta({ title: "SimpleContentPartExpressions" });
99
83
  })(SimpleContent = Message.SimpleContent || (Message.SimpleContent = {}));
100
- Message.RichContentSchema = z
101
- .union([RichContent.TextSchema, RichContent.PartsSchema])
102
- .describe("Rich content.");
103
- Message.RichContentExpressionSchema = z
84
+ Message.SimpleContentSchema = z
85
+ .union([SimpleContent.TextSchema, SimpleContent.PartsSchema])
86
+ .describe("Simple content.")
87
+ .meta({ title: "SimpleContent" });
88
+ Message.SimpleContentExpressionSchema = z
104
89
  .union([
105
- RichContent.TextSchema,
106
- RichContent.PartsExpressionSchema,
107
- ExpressionSchema.describe("An expression which evaluates to rich content."),
90
+ SimpleContent.TextSchema,
91
+ SimpleContent.PartsExpressionSchema,
92
+ ExpressionSchema.describe("An expression which evaluates to simple content."),
108
93
  ])
109
- .describe(Message.RichContentSchema.description);
94
+ .describe(Message.SimpleContentSchema.description)
95
+ .meta({ title: "SimpleContentExpression" });
110
96
  let RichContent;
111
97
  (function (RichContent) {
112
- RichContent.TextSchema = z.string().describe("Plain text content.");
113
- RichContent.PartSchema = z
114
- .discriminatedUnion("type", [
115
- Part.TextSchema,
116
- Part.ImageUrlSchema,
117
- Part.InputAudioSchema,
118
- Part.VideoUrlSchema,
119
- Part.FileSchema,
120
- ])
121
- .describe("A rich content part.");
122
- RichContent.PartExpressionSchema = z
123
- .union([
124
- RichContent.PartSchema,
125
- ExpressionSchema.describe("An expression which evaluates to a rich content part."),
126
- ])
127
- .describe(RichContent.PartSchema.description);
98
+ RichContent.TextSchema = z
99
+ .string()
100
+ .describe("Plain text content.")
101
+ .meta({ title: "RichContentText" });
128
102
  let Part;
129
103
  (function (Part) {
130
- Part.TextSchema = z
131
- .object({
132
- type: z.literal("text"),
133
- text: Text.TextSchema,
134
- })
135
- .describe("A text rich content part.");
136
104
  let Text;
137
105
  (function (Text) {
138
106
  Text.TextSchema = z.string().describe("The text content.");
139
107
  })(Text = Part.Text || (Part.Text = {}));
140
- Part.ImageUrlSchema = z
108
+ Part.TextSchema = z
141
109
  .object({
142
- type: z.literal("image_url"),
143
- image_url: ImageUrl.DefinitionSchema,
110
+ type: z.literal("text"),
111
+ text: Text.TextSchema,
144
112
  })
145
- .describe("An image rich content part.");
113
+ .describe("A text rich content part.")
114
+ .meta({ title: "TextRichContentPart" });
146
115
  let ImageUrl;
147
116
  (function (ImageUrl) {
148
117
  ImageUrl.DetailSchema = z
@@ -158,12 +127,13 @@ export var Message;
158
127
  })
159
128
  .describe("The URL of the image and its optional detail level.");
160
129
  })(ImageUrl = Part.ImageUrl || (Part.ImageUrl = {}));
161
- Part.InputAudioSchema = z
130
+ Part.ImageUrlSchema = z
162
131
  .object({
163
- type: z.literal("input_audio"),
164
- input_audio: InputAudio.DefinitionSchema,
132
+ type: z.literal("image_url"),
133
+ image_url: ImageUrl.DefinitionSchema,
165
134
  })
166
- .describe("An audio rich content part.");
135
+ .describe("An image rich content part.")
136
+ .meta({ title: "ImageRichContentPart" });
167
137
  let InputAudio;
168
138
  (function (InputAudio) {
169
139
  InputAudio.FormatSchema = z
@@ -179,12 +149,13 @@ export var Message;
179
149
  })
180
150
  .describe("The audio data and its format.");
181
151
  })(InputAudio = Part.InputAudio || (Part.InputAudio = {}));
182
- Part.VideoUrlSchema = z
152
+ Part.InputAudioSchema = z
183
153
  .object({
184
- type: z.enum(["video_url", "input_video"]),
185
- video_url: VideoUrl.DefinitionSchema,
154
+ type: z.literal("input_audio"),
155
+ input_audio: InputAudio.DefinitionSchema,
186
156
  })
187
- .describe("A video rich content part.");
157
+ .describe("An audio rich content part.")
158
+ .meta({ title: "AudioRichContentPart" });
188
159
  let VideoUrl;
189
160
  (function (VideoUrl) {
190
161
  VideoUrl.UrlSchema = z.string().describe("URL of the video.");
@@ -192,12 +163,13 @@ export var Message;
192
163
  url: VideoUrl.UrlSchema,
193
164
  });
194
165
  })(VideoUrl = Part.VideoUrl || (Part.VideoUrl = {}));
195
- Part.FileSchema = z
166
+ Part.VideoUrlSchema = z
196
167
  .object({
197
- type: z.literal("file"),
198
- file: File.DefinitionSchema,
168
+ type: z.enum(["video_url", "input_video"]),
169
+ video_url: VideoUrl.DefinitionSchema,
199
170
  })
200
- .describe("A file rich content part.");
171
+ .describe("A video rich content part.")
172
+ .meta({ title: "VideoRichContentPart" });
201
173
  let File;
202
174
  (function (File) {
203
175
  File.FileDataSchema = z
@@ -221,202 +193,253 @@ export var Message;
221
193
  })
222
194
  .describe("The file to be used as input, either as base64 data, an uploaded file ID, or a URL.");
223
195
  })(File = Part.File || (Part.File = {}));
196
+ Part.FileSchema = z
197
+ .object({
198
+ type: z.literal("file"),
199
+ file: File.DefinitionSchema,
200
+ })
201
+ .describe("A file rich content part.")
202
+ .meta({ title: "FileRichContentPart" });
224
203
  })(Part = RichContent.Part || (RichContent.Part = {}));
204
+ RichContent.PartSchema = z
205
+ .discriminatedUnion("type", [
206
+ Part.TextSchema,
207
+ Part.ImageUrlSchema,
208
+ Part.InputAudioSchema,
209
+ Part.VideoUrlSchema,
210
+ Part.FileSchema,
211
+ ])
212
+ .describe("A rich content part.")
213
+ .meta({ title: "RichContentPart" });
214
+ RichContent.PartExpressionSchema = z
215
+ .union([
216
+ RichContent.PartSchema,
217
+ ExpressionSchema.describe("An expression which evaluates to a rich content part."),
218
+ ])
219
+ .describe(RichContent.PartSchema.description)
220
+ .meta({ title: "RichContentPartExpression" });
225
221
  RichContent.PartsSchema = z
226
222
  .array(RichContent.PartSchema)
227
- .describe("An array of rich content parts.");
223
+ .describe("An array of rich content parts.")
224
+ .meta({ title: "RichContentParts" });
228
225
  RichContent.PartsExpressionSchema = z
229
226
  .array(RichContent.PartExpressionSchema)
230
- .describe(RichContent.PartsSchema.description);
227
+ .describe(RichContent.PartsSchema.description)
228
+ .meta({ title: "RichContentPartExpressions" });
231
229
  })(RichContent = Message.RichContent || (Message.RichContent = {}));
230
+ Message.RichContentSchema = z
231
+ .union([RichContent.TextSchema, RichContent.PartsSchema])
232
+ .describe("Rich content.")
233
+ .meta({ title: "RichContent" });
234
+ Message.RichContentExpressionSchema = z
235
+ .union([
236
+ RichContent.TextSchema,
237
+ RichContent.PartsExpressionSchema,
238
+ ExpressionSchema.describe("An expression which evaluates to rich content."),
239
+ ])
240
+ .describe(Message.RichContentSchema.description)
241
+ .meta({ title: "RichContentExpression" });
232
242
  Message.NameSchema = z
233
243
  .string()
234
- .describe("An optional name for the participant. Provides the model information to differentiate between participants of the same role.");
244
+ .describe("An optional name for the participant. Provides the model information to differentiate between participants of the same role.")
245
+ .meta({ title: "MessageName" });
235
246
  Message.NameExpressionSchema = z
236
247
  .union([
237
248
  Message.NameSchema,
238
249
  ExpressionSchema.describe("An expression which evaluates to a string."),
239
250
  ])
240
- .describe(Message.NameSchema.description);
251
+ .describe(Message.NameSchema.description)
252
+ .meta({ title: "MessageNameExpression" });
241
253
  Message.DeveloperSchema = z
242
254
  .object({
243
255
  role: z.literal("developer"),
244
256
  content: Message.SimpleContentSchema,
245
257
  name: Message.NameSchema.optional().nullable(),
246
258
  })
247
- .describe("Developer-provided instructions that the model should follow, regardless of messages sent by the user.");
259
+ .describe("Developer-provided instructions that the model should follow, regardless of messages sent by the user.")
260
+ .meta({ title: "DeveloperMessage" });
248
261
  Message.DeveloperExpressionSchema = z
249
262
  .object({
250
263
  role: z.literal("developer"),
251
264
  content: Message.SimpleContentExpressionSchema,
252
265
  name: Message.NameExpressionSchema.optional().nullable(),
253
266
  })
254
- .describe(Message.DeveloperSchema.description);
267
+ .describe(Message.DeveloperSchema.description)
268
+ .meta({ title: "DeveloperMessageExpression" });
255
269
  Message.SystemSchema = z
256
270
  .object({
257
271
  role: z.literal("system"),
258
272
  content: Message.SimpleContentSchema,
259
273
  name: Message.NameSchema.optional().nullable(),
260
274
  })
261
- .describe("Developer-provided instructions that the model should follow, regardless of messages sent by the user.");
275
+ .describe("Developer-provided instructions that the model should follow, regardless of messages sent by the user.")
276
+ .meta({ title: "SystemMessage" });
262
277
  Message.SystemExpressionSchema = z
263
278
  .object({
264
279
  role: z.literal("system"),
265
280
  content: Message.SimpleContentExpressionSchema,
266
281
  name: Message.NameExpressionSchema.optional().nullable(),
267
282
  })
268
- .describe(Message.SystemSchema.description);
283
+ .describe(Message.SystemSchema.description)
284
+ .meta({ title: "SystemMessageExpression" });
269
285
  Message.UserSchema = z
270
286
  .object({
271
287
  role: z.literal("user"),
272
288
  content: Message.RichContentSchema,
273
289
  name: Message.NameSchema.optional().nullable(),
274
290
  })
275
- .describe("Messages sent by an end user, containing prompts or additional context information.");
291
+ .describe("Messages sent by an end user, containing prompts or additional context information.")
292
+ .meta({ title: "UserMessage" });
276
293
  Message.UserExpressionSchema = z
277
294
  .object({
278
295
  role: z.literal("user"),
279
296
  content: Message.RichContentExpressionSchema,
280
297
  name: Message.NameExpressionSchema.optional().nullable(),
281
298
  })
282
- .describe(Message.UserSchema.description);
283
- Message.ToolSchema = z
284
- .object({
285
- role: z.literal("tool"),
286
- content: Message.RichContentSchema,
287
- tool_call_id: Tool.ToolCallIdSchema,
288
- })
289
- .describe("Messages sent by tools in response to tool calls made by the assistant.");
290
- Message.ToolExpressionSchema = z
291
- .object({
292
- role: z.literal("tool"),
293
- content: Message.RichContentExpressionSchema,
294
- tool_call_id: Tool.ToolCallIdExpressionSchema,
295
- })
296
- .describe(Message.ToolSchema.description);
299
+ .describe(Message.UserSchema.description)
300
+ .meta({ title: "UserMessageExpression" });
297
301
  let Tool;
298
302
  (function (Tool) {
299
303
  Tool.ToolCallIdSchema = z
300
304
  .string()
301
- .describe("The ID of the tool call that this message is responding to.");
305
+ .describe("The ID of the tool call that this message is responding to.")
306
+ .meta({ title: "ToolMessageToolCallId" });
302
307
  Tool.ToolCallIdExpressionSchema = z
303
308
  .union([
304
309
  Tool.ToolCallIdSchema,
305
310
  ExpressionSchema.describe("An expression which evaluates to a string."),
306
311
  ])
307
- .describe(Tool.ToolCallIdSchema.description);
312
+ .describe(Tool.ToolCallIdSchema.description)
313
+ .meta({ title: "ToolMessageToolCallIdExpression" });
308
314
  })(Tool = Message.Tool || (Message.Tool = {}));
309
- Message.AssistantSchema = z
315
+ Message.ToolSchema = z
310
316
  .object({
311
- role: z.literal("assistant"),
312
- content: Message.RichContentSchema.optional().nullable(),
313
- name: Message.NameSchema.optional().nullable(),
314
- refusal: Assistant.RefusalSchema.optional().nullable(),
315
- tool_calls: Assistant.ToolCallsSchema.optional().nullable(),
316
- reasoning: Assistant.ReasoningSchema.optional().nullable(),
317
+ role: z.literal("tool"),
318
+ content: Message.RichContentSchema,
319
+ tool_call_id: Tool.ToolCallIdSchema,
317
320
  })
318
- .describe("Messages sent by the model in response to user messages.");
319
- Message.AssistantExpressionSchema = z
321
+ .describe("Messages sent by tools in response to tool calls made by the assistant.")
322
+ .meta({ title: "ToolMessage" });
323
+ Message.ToolExpressionSchema = z
320
324
  .object({
321
- role: z.literal("assistant"),
322
- content: Message.RichContentExpressionSchema.optional().nullable(),
323
- name: Message.NameExpressionSchema.optional().nullable(),
324
- refusal: Assistant.RefusalExpressionSchema.optional().nullable(),
325
- tool_calls: Assistant.ToolCallsExpressionSchema.optional().nullable(),
326
- reasoning: Assistant.ReasoningExpressionSchema.optional().nullable(),
325
+ role: z.literal("tool"),
326
+ content: Message.RichContentExpressionSchema,
327
+ tool_call_id: Tool.ToolCallIdExpressionSchema,
327
328
  })
328
- .describe(Message.AssistantSchema.description);
329
+ .describe(Message.ToolSchema.description)
330
+ .meta({ title: "ToolMessageExpression" });
329
331
  let Assistant;
330
332
  (function (Assistant) {
331
333
  Assistant.RefusalSchema = z
332
334
  .string()
333
- .describe("The refusal message by the assistant.");
335
+ .describe("The refusal message by the assistant.")
336
+ .meta({ title: "AssistantMessageRefusal" });
334
337
  Assistant.RefusalExpressionSchema = z
335
338
  .union([
336
339
  Assistant.RefusalSchema,
337
340
  ExpressionSchema.describe("An expression which evaluates to a string."),
338
341
  ])
339
- .describe(Assistant.RefusalSchema.description);
342
+ .describe(Assistant.RefusalSchema.description)
343
+ .meta({ title: "AssistantMessageRefusalExpression" });
340
344
  Assistant.ReasoningSchema = z
341
345
  .string()
342
- .describe("The reasoning provided by the assistant.");
346
+ .describe("The reasoning provided by the assistant.")
347
+ .meta({ title: "AssistantMessageReasoning" });
343
348
  Assistant.ReasoningExpressionSchema = z
344
349
  .union([
345
350
  Assistant.ReasoningSchema,
346
351
  ExpressionSchema.describe("An expression which evaluates to a string."),
347
352
  ])
348
- .describe(Assistant.ReasoningSchema.description);
349
- Assistant.ToolCallSchema = z
350
- .union([ToolCall.FunctionSchema])
351
- .describe("A tool call made by the assistant.");
352
- Assistant.ToolCallExpressionSchema = z
353
- .union([
354
- ToolCall.FunctionExpressionSchema,
355
- ExpressionSchema.describe("An expression which evaluates to a tool call."),
356
- ])
357
- .describe(Assistant.ToolCallSchema.description);
353
+ .describe(Assistant.ReasoningSchema.description)
354
+ .meta({ title: "AssistantMessageReasoningExpression" });
358
355
  let ToolCall;
359
356
  (function (ToolCall) {
360
357
  ToolCall.IdSchema = z
361
358
  .string()
362
- .describe("The unique identifier for the tool call.");
359
+ .describe("The unique identifier for the tool call.")
360
+ .meta({ title: "AssistantMessageToolCallId" });
363
361
  ToolCall.IdExpressionSchema = z
364
362
  .union([
365
363
  ToolCall.IdSchema,
366
364
  ExpressionSchema.describe("An expression which evaluates to a string."),
367
365
  ])
368
- .describe(ToolCall.IdSchema.description);
369
- ToolCall.FunctionSchema = z
370
- .object({
371
- type: z.literal("function"),
372
- id: ToolCall.IdSchema,
373
- function: Function.DefinitionSchema,
374
- })
375
- .describe("A function tool call made by the assistant.");
376
- ToolCall.FunctionExpressionSchema = z
377
- .object({
378
- type: z.literal("function"),
379
- id: ToolCall.IdExpressionSchema,
380
- function: Function.DefinitionExpressionSchema,
381
- })
382
- .describe(ToolCall.FunctionSchema.description);
366
+ .describe(ToolCall.IdSchema.description)
367
+ .meta({ title: "AssistantMessageToolCallIdExpression" });
383
368
  let Function;
384
369
  (function (Function) {
385
370
  Function.NameSchema = z
386
371
  .string()
387
- .describe("The name of the function called.");
372
+ .describe("The name of the function called.")
373
+ .meta({ title: "AssistantMessageToolCallFunctionName" });
388
374
  Function.NameExpressionSchema = z
389
375
  .union([
390
376
  Function.NameSchema,
391
377
  ExpressionSchema.describe("An expression which evaluates to a string."),
392
378
  ])
393
- .describe(Function.NameSchema.description);
379
+ .describe(Function.NameSchema.description)
380
+ .meta({ title: "AssistantMessageToolCallFunctionNameExpression" });
394
381
  Function.ArgumentsSchema = z
395
382
  .string()
396
- .describe("The arguments passed to the function.");
383
+ .describe("The arguments passed to the function.")
384
+ .meta({ title: "AssistantMessageToolCallFunctionArguments" });
397
385
  Function.ArgumentsExpressionSchema = z
398
386
  .union([
399
387
  Function.ArgumentsSchema,
400
388
  ExpressionSchema.describe("An expression which evaluates to a string."),
401
389
  ])
402
- .describe(Function.ArgumentsSchema.description);
390
+ .describe(Function.ArgumentsSchema.description)
391
+ .meta({
392
+ title: "AssistantMessageToolCallFunctionArgumentsExpression",
393
+ });
403
394
  Function.DefinitionSchema = z
404
395
  .object({
405
396
  name: Function.NameSchema,
406
397
  arguments: Function.ArgumentsSchema,
407
398
  })
408
- .describe("The name and arguments of the function called.");
399
+ .describe("The name and arguments of the function called.")
400
+ .meta({ title: "AssistantMessageToolCallFunctionDefinition" });
409
401
  Function.DefinitionExpressionSchema = z
410
402
  .object({
411
403
  name: Function.NameExpressionSchema,
412
404
  arguments: Function.ArgumentsExpressionSchema,
413
405
  })
414
- .describe(Function.DefinitionSchema.description);
406
+ .describe(Function.DefinitionSchema.description)
407
+ .meta({
408
+ title: "AssistantMessageToolCallFunctionDefinitionExpression",
409
+ });
415
410
  })(Function = ToolCall.Function || (ToolCall.Function = {}));
411
+ ToolCall.FunctionSchema = z
412
+ .object({
413
+ type: z.literal("function"),
414
+ id: ToolCall.IdSchema,
415
+ function: Function.DefinitionSchema,
416
+ })
417
+ .describe("A function tool call made by the assistant.")
418
+ .meta({ title: "AssistantMessageToolCallFunction" });
419
+ ToolCall.FunctionExpressionSchema = z
420
+ .object({
421
+ type: z.literal("function"),
422
+ id: ToolCall.IdExpressionSchema,
423
+ function: Function.DefinitionExpressionSchema,
424
+ })
425
+ .describe(ToolCall.FunctionSchema.description)
426
+ .meta({ title: "AssistantMessageToolCallFunctionExpression" });
416
427
  })(ToolCall = Assistant.ToolCall || (Assistant.ToolCall = {}));
428
+ Assistant.ToolCallSchema = z
429
+ .union([ToolCall.FunctionSchema])
430
+ .describe("A tool call made by the assistant.")
431
+ .meta({ title: "AssistantMessageToolCall" });
432
+ Assistant.ToolCallExpressionSchema = z
433
+ .union([
434
+ ToolCall.FunctionExpressionSchema,
435
+ ExpressionSchema.describe("An expression which evaluates to a tool call."),
436
+ ])
437
+ .describe(Assistant.ToolCallSchema.description)
438
+ .meta({ title: "AssistantMessageToolCallExpression" });
417
439
  Assistant.ToolCallsSchema = z
418
440
  .array(Assistant.ToolCallSchema)
419
- .describe("Tool calls made by the assistant.");
441
+ .describe("Tool calls made by the assistant.")
442
+ .meta({ title: "AssistantMessageToolCalls" });
420
443
  Assistant.ToolCallsExpressionSchema = z
421
444
  .union([
422
445
  z
@@ -424,78 +447,120 @@ export var Message;
424
447
  .describe(Assistant.ToolCallsSchema.description),
425
448
  ExpressionSchema.describe("An expression which evaluates to an array of tool calls."),
426
449
  ])
427
- .describe(Assistant.ToolCallsSchema.description);
450
+ .describe(Assistant.ToolCallsSchema.description)
451
+ .meta({ title: "AssistantMessageToolCallsExpression" });
428
452
  })(Assistant = Message.Assistant || (Message.Assistant = {}));
453
+ Message.AssistantSchema = z
454
+ .object({
455
+ role: z.literal("assistant"),
456
+ content: Message.RichContentSchema.optional().nullable(),
457
+ name: Message.NameSchema.optional().nullable(),
458
+ refusal: Assistant.RefusalSchema.optional().nullable(),
459
+ tool_calls: Assistant.ToolCallsSchema.optional().nullable(),
460
+ reasoning: Assistant.ReasoningSchema.optional().nullable(),
461
+ })
462
+ .describe("Messages sent by the model in response to user messages.")
463
+ .meta({ title: "AssistantMessage" });
464
+ Message.AssistantExpressionSchema = z
465
+ .object({
466
+ role: z.literal("assistant"),
467
+ content: Message.RichContentExpressionSchema.optional().nullable(),
468
+ name: Message.NameExpressionSchema.optional().nullable(),
469
+ refusal: Assistant.RefusalExpressionSchema.optional().nullable(),
470
+ tool_calls: Assistant.ToolCallsExpressionSchema.optional().nullable(),
471
+ reasoning: Assistant.ReasoningExpressionSchema.optional().nullable(),
472
+ })
473
+ .describe(Message.AssistantSchema.description)
474
+ .meta({ title: "AssistantMessageExpression" });
429
475
  })(Message || (Message = {}));
476
+ export const MessageSchema = z
477
+ .discriminatedUnion("role", [
478
+ Message.DeveloperSchema,
479
+ Message.SystemSchema,
480
+ Message.UserSchema,
481
+ Message.ToolSchema,
482
+ Message.AssistantSchema,
483
+ ])
484
+ .describe("A message exchanged in a chat conversation.")
485
+ .meta({ title: "Message" });
486
+ export const MessageExpressionSchema = z
487
+ .union([
488
+ z
489
+ .discriminatedUnion("role", [
490
+ Message.DeveloperExpressionSchema,
491
+ Message.SystemExpressionSchema,
492
+ Message.UserExpressionSchema,
493
+ Message.ToolExpressionSchema,
494
+ Message.AssistantExpressionSchema,
495
+ ])
496
+ .describe(MessageSchema.description),
497
+ ExpressionSchema.describe("An expression which evaluates to a message."),
498
+ ])
499
+ .describe(MessageSchema.description)
500
+ .meta({ title: "MessageExpression" });
430
501
  export const MessagesSchema = z
431
502
  .array(MessageSchema)
432
- .describe("A list of messages exchanged in a chat conversation.");
503
+ .describe("A list of messages exchanged in a chat conversation.")
504
+ .meta({ title: "Messages" });
433
505
  export const MessagesExpressionSchema = z
434
506
  .union([
435
- z.array(MessageExpressionSchema).describe(MessagesSchema.description),
507
+ z
508
+ .array(MessageExpressionSchema)
509
+ .describe(MessagesSchema.description)
510
+ .meta({ title: "MessageExpressions" }),
436
511
  ExpressionSchema.describe("An expression which evaluates to an array of messages."),
437
512
  ])
438
- .describe(MessagesSchema.description);
513
+ .describe(MessagesSchema.description)
514
+ .meta({ title: "MessagesExpression" });
439
515
  // Tools
440
- export const ToolSchema = z
441
- .union([Tool.FunctionSchema])
442
- .describe("A tool that the assistant can call.");
443
- export const ToolExpressionSchema = z
444
- .union([
445
- Tool.FunctionExpressionSchema,
446
- ExpressionSchema.describe("An expression which evaluates to a tool."),
447
- ])
448
- .describe(ToolSchema.description);
449
516
  export var Tool;
450
517
  (function (Tool) {
451
- Tool.FunctionSchema = z
452
- .object({
453
- type: z.literal("function"),
454
- function: Function.DefinitionSchema,
455
- })
456
- .describe("A function tool that the assistant can call.");
457
- Tool.FunctionExpressionSchema = z
458
- .object({
459
- type: z.literal("function"),
460
- function: Function.DefinitionExpressionSchema,
461
- })
462
- .describe(Tool.FunctionSchema.description);
463
518
  let Function;
464
519
  (function (Function) {
465
- Function.NameSchema = z.string().describe("The name of the function.");
520
+ Function.NameSchema = z
521
+ .string()
522
+ .describe("The name of the function.")
523
+ .meta({ title: "FunctionToolName" });
466
524
  Function.NameExpressionSchema = z
467
525
  .union([
468
526
  Function.NameSchema,
469
527
  ExpressionSchema.describe("An expression which evaluates to a string."),
470
528
  ])
471
- .describe(Function.NameSchema.description);
529
+ .describe(Function.NameSchema.description)
530
+ .meta({ title: "FunctionToolNameExpression" });
472
531
  Function.DescriptionSchema = z
473
532
  .string()
474
- .describe("The description of the function.");
533
+ .describe("The description of the function.")
534
+ .meta({ title: "FunctionToolDescription" });
475
535
  Function.DescriptionExpressionSchema = z
476
536
  .union([
477
537
  Function.DescriptionSchema,
478
538
  ExpressionSchema.describe("An expression which evaluates to a string."),
479
539
  ])
480
- .describe(Function.DescriptionSchema.description);
540
+ .describe(Function.DescriptionSchema.description)
541
+ .meta({ title: "FunctionToolDescriptionExpression" });
481
542
  Function.ParametersSchema = z
482
543
  .record(z.string(), JsonValueSchema)
483
- .describe("The JSON schema defining the parameters of the function.");
544
+ .describe("The JSON schema defining the parameters of the function.")
545
+ .meta({ title: "FunctionToolParameters" });
484
546
  Function.ParametersExpressionSchema = z
485
547
  .union([
486
548
  z.record(z.string(), JsonValueExpressionSchema),
487
549
  ExpressionSchema.describe("An expression which evaluates to a JSON schema object."),
488
550
  ])
489
- .describe(Function.ParametersSchema.description);
551
+ .describe(Function.ParametersSchema.description)
552
+ .meta({ title: "FunctionToolParametersExpression" });
490
553
  Function.StrictSchema = z
491
554
  .boolean()
492
- .describe("Whether to enforce strict adherence to the parameter schema.");
555
+ .describe("Whether to enforce strict adherence to the parameter schema.")
556
+ .meta({ title: "FunctionToolStrict" });
493
557
  Function.StrictExpressionSchema = z
494
558
  .union([
495
559
  Function.StrictSchema,
496
560
  ExpressionSchema.describe("An expression which evaluates to a boolean."),
497
561
  ])
498
- .describe(Function.StrictSchema.description);
562
+ .describe(Function.StrictSchema.description)
563
+ .meta({ title: "FunctionToolStrictExpression" });
499
564
  Function.DefinitionSchema = z
500
565
  .object({
501
566
  name: Function.NameSchema,
@@ -503,7 +568,8 @@ export var Tool;
503
568
  parameters: Function.ParametersSchema.optional().nullable(),
504
569
  strict: Function.StrictSchema.optional().nullable(),
505
570
  })
506
- .describe("The definition of a function tool.");
571
+ .describe("The definition of a function tool.")
572
+ .meta({ title: "FunctionToolDefinition" });
507
573
  Function.DefinitionExpressionSchema = z
508
574
  .object({
509
575
  name: Function.NameExpressionSchema,
@@ -511,38 +577,214 @@ export var Tool;
511
577
  parameters: Function.ParametersExpressionSchema.optional().nullable(),
512
578
  strict: Function.StrictExpressionSchema.optional().nullable(),
513
579
  })
514
- .describe(Function.DefinitionSchema.description);
580
+ .describe(Function.DefinitionSchema.description)
581
+ .meta({ title: "FunctionToolDefinitionExpression" });
515
582
  })(Function = Tool.Function || (Tool.Function = {}));
583
+ Tool.FunctionSchema = z
584
+ .object({
585
+ type: z.literal("function"),
586
+ function: Function.DefinitionSchema,
587
+ })
588
+ .describe("A function tool that the assistant can call.")
589
+ .meta({ title: "FunctionTool" });
590
+ Tool.FunctionExpressionSchema = z
591
+ .object({
592
+ type: z.literal("function"),
593
+ function: Function.DefinitionExpressionSchema,
594
+ })
595
+ .describe(Tool.FunctionSchema.description)
596
+ .meta({ title: "FunctionToolExpression" });
516
597
  })(Tool || (Tool = {}));
517
- export const ToolsSchema = z
598
+ export const ToolSchema = z
599
+ .union([Tool.FunctionSchema])
600
+ .describe("A tool that the assistant can call.")
601
+ .meta({ title: "Tool" });
602
+ export const ToolExpressionSchema = z
603
+ .union([
604
+ Tool.FunctionExpressionSchema,
605
+ ExpressionSchema.describe("An expression which evaluates to a tool."),
606
+ ])
607
+ .describe(ToolSchema.description)
608
+ .meta({ title: "ToolExpression" });
609
+ export const ToolsSchema = z
518
610
  .array(ToolSchema)
519
- .describe("A list of tools that the assistant can call.");
611
+ .describe("A list of tools that the assistant can call.")
612
+ .meta({ title: "Tools" });
520
613
  export const ToolsExpressionSchema = z
521
614
  .union([
522
- z.array(ToolExpressionSchema).describe(ToolsSchema.description),
615
+ z
616
+ .array(ToolExpressionSchema)
617
+ .describe(ToolsSchema.description)
618
+ .meta({ title: "ToolExpressions" }),
523
619
  ExpressionSchema.describe("An expression which evaluates to an array of tools."),
524
620
  ])
525
- .describe(ToolsSchema.description);
621
+ .describe(ToolsSchema.description)
622
+ .meta({ title: "ToolsExpression" });
526
623
  // Vector Responses
527
- export const VectorResponseSchema = Message.RichContentSchema.describe("A possible assistant response. The LLMs in the Ensemble may vote for this option.");
624
+ export const VectorResponseSchema = Message.RichContentSchema.describe("A possible assistant response. The LLMs in the Ensemble may vote for this option.").meta({ title: "VectorResponse" });
528
625
  export const VectorResponseExpressionSchema = z
529
626
  .union([
530
627
  VectorResponseSchema,
531
628
  ExpressionSchema.describe("An expression which evaluates to a possible assistant response."),
532
629
  ])
533
- .describe(VectorResponseSchema.description);
630
+ .describe(VectorResponseSchema.description)
631
+ .meta({ title: "VectorResponseExpression" });
534
632
  export const VectorResponsesSchema = z
535
633
  .array(VectorResponseSchema)
536
- .describe("A list of possible assistant responses which the LLMs in the Ensemble will vote on. The output scores will be of the same length, each corresponding to one response. The winner is the response with the highest score.");
634
+ .describe("A list of possible assistant responses which the LLMs in the Ensemble will vote on. The output scores will be of the same length, each corresponding to one response. The winner is the response with the highest score.")
635
+ .meta({ title: "VectorResponses" });
537
636
  export const VectorResponsesExpressionSchema = z
538
637
  .union([
539
638
  z
540
639
  .array(VectorResponseExpressionSchema)
541
- .describe(VectorResponsesSchema.description),
640
+ .describe(VectorResponsesSchema.description)
641
+ .meta({ title: "VectorResponseExpressions" }),
542
642
  ExpressionSchema.describe("An expression which evaluates to an array of possible assistant responses."),
543
643
  ])
544
- .describe(VectorResponsesSchema.description);
644
+ .describe(VectorResponsesSchema.description)
645
+ .meta({ title: "VectorResponsesExpression" });
545
646
  // Ensemble LLM
647
+ export var EnsembleLlm;
648
+ (function (EnsembleLlm) {
649
+ EnsembleLlm.OutputModeSchema = z
650
+ .enum(["instruction", "json_schema", "tool_call"])
651
+ .describe('For Vector Completions only, specifies the LLM\'s voting output mode. For "instruction", the assistant is instructed to output a key. For "json_schema", the assistant is constrained to output a valid key using a JSON schema. For "tool_call", the assistant is instructed to output a tool call to select the key.');
652
+ EnsembleLlm.StopSchema = z
653
+ .union([
654
+ z
655
+ .string()
656
+ .describe("Generation will stop when this string is generated.")
657
+ .meta({ title: "StopString" }),
658
+ z
659
+ .array(z.string().meta({ title: "StopString" }))
660
+ .describe("Generation will stop when any of these strings are generated.")
661
+ .meta({ title: "StopStrings" }),
662
+ ])
663
+ .describe("The assistant will stop when any of the provided strings are generated.")
664
+ .meta({ title: "Stop" });
665
+ let Provider;
666
+ (function (Provider) {
667
+ Provider.QuantizationSchema = z
668
+ .enum([
669
+ "int4",
670
+ "int8",
671
+ "fp4",
672
+ "fp6",
673
+ "fp8",
674
+ "fp16",
675
+ "bf16",
676
+ "fp32",
677
+ "unknown",
678
+ ])
679
+ .describe("An LLM quantization.")
680
+ .meta({ title: "ProviderQuantization" });
681
+ })(Provider = EnsembleLlm.Provider || (EnsembleLlm.Provider = {}));
682
+ EnsembleLlm.ProviderSchema = z
683
+ .object({
684
+ allow_fallbacks: z
685
+ .boolean()
686
+ .optional()
687
+ .nullable()
688
+ .describe("Whether to allow fallback providers if the preferred provider is unavailable."),
689
+ require_parameters: z
690
+ .boolean()
691
+ .optional()
692
+ .nullable()
693
+ .describe("Whether to require that the provider supports all specified parameters."),
694
+ order: z
695
+ .array(z.string().meta({ title: "ProviderName" }))
696
+ .optional()
697
+ .nullable()
698
+ .describe("An ordered list of provider names to use when selecting a provider for this model."),
699
+ only: z
700
+ .array(z.string().meta({ title: "ProviderName" }))
701
+ .optional()
702
+ .nullable()
703
+ .describe("A list of provider names to restrict selection to when selecting a provider for this model."),
704
+ ignore: z
705
+ .array(z.string().meta({ title: "ProviderName" }))
706
+ .optional()
707
+ .nullable()
708
+ .describe("A list of provider names to ignore when selecting a provider for this model."),
709
+ quantizations: z
710
+ .array(Provider.QuantizationSchema)
711
+ .optional()
712
+ .nullable()
713
+ .describe("Specifies the quantizations to allow when selecting providers for this model."),
714
+ })
715
+ .describe("Options for selecting the upstream provider of this model.");
716
+ let Reasoning;
717
+ (function (Reasoning) {
718
+ Reasoning.EffortSchema = z
719
+ .enum(["none", "minimal", "low", "medium", "high", "xhigh"])
720
+ .describe("Constrains effort on reasoning for supported reasoning models. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.")
721
+ .meta({ title: "ReasoningEffort" });
722
+ Reasoning.SummaryVerbositySchema = z
723
+ .enum(["auto", "concise", "detailed"])
724
+ .describe("Controls the verbosity of the reasoning summary for supported reasoning models.")
725
+ .meta({ title: "ReasoningSummaryVerbosity" });
726
+ })(Reasoning = EnsembleLlm.Reasoning || (EnsembleLlm.Reasoning = {}));
727
+ EnsembleLlm.ReasoningSchema = z
728
+ .object({
729
+ enabled: z
730
+ .boolean()
731
+ .optional()
732
+ .nullable()
733
+ .describe("Enables or disables reasoning for supported models."),
734
+ max_tokens: z
735
+ .int()
736
+ .min(0)
737
+ .max(2147483647)
738
+ .optional()
739
+ .nullable()
740
+ .describe("The maximum number of tokens to use for reasoning in a response."),
741
+ effort: Reasoning.EffortSchema.optional().nullable(),
742
+ summary_verbosity: Reasoning.SummaryVerbositySchema.optional().nullable(),
743
+ })
744
+ .optional()
745
+ .nullable()
746
+ .describe("Options for controlling reasoning behavior of the model.");
747
+ EnsembleLlm.VerbositySchema = z
748
+ .enum(["low", "medium", "high"])
749
+ .describe("Controls the verbosity and length of the model response. Lower values produce more concise responses, while higher values produce more detailed and comprehensive responses.");
750
+ EnsembleLlm.ListItemSchema = z.object({
751
+ id: z.string().describe("The unique identifier for the Ensemble LLM."),
752
+ });
753
+ async function list(openai, options) {
754
+ const response = await openai.get("/ensemble_llms", options);
755
+ return response;
756
+ }
757
+ EnsembleLlm.list = list;
758
+ EnsembleLlm.RetrieveItemSchema = z.lazy(() => EnsembleLlmSchema.extend({
759
+ created: z
760
+ .uint32()
761
+ .describe("The Unix timestamp (in seconds) when the Ensemble LLM was created."),
762
+ }));
763
+ async function retrieve(openai, id, options) {
764
+ const response = await openai.get(`/ensemble_llms/${id}`, options);
765
+ return response;
766
+ }
767
+ EnsembleLlm.retrieve = retrieve;
768
+ EnsembleLlm.HistoricalUsageSchema = z.object({
769
+ requests: z
770
+ .uint32()
771
+ .describe("The total number of requests made to this Ensemble LLM."),
772
+ completion_tokens: z
773
+ .uint32()
774
+ .describe("The total number of completion tokens generated by this Ensemble LLM."),
775
+ prompt_tokens: z
776
+ .uint32()
777
+ .describe("The total number of prompt tokens sent to this Ensemble LLM."),
778
+ total_cost: z
779
+ .number()
780
+ .describe("The total cost incurred by using this Ensemble LLM."),
781
+ });
782
+ async function retrieveUsage(openai, id, options) {
783
+ const response = await openai.get(`/ensemble_llms/${id}/usage`, options);
784
+ return response;
785
+ }
786
+ EnsembleLlm.retrieveUsage = retrieveUsage;
787
+ })(EnsembleLlm || (EnsembleLlm = {}));
546
788
  export const EnsembleLlmBaseSchema = z
547
789
  .object({
548
790
  model: z.string().describe("The full ID of the LLM to use."),
@@ -670,141 +912,6 @@ export const EnsembleLlmWithFallbacksAndCountSchema = EnsembleLlmSchema.extend({
670
912
  .nullable()
671
913
  .describe(EnsembleLlmBaseWithFallbacksAndCountSchema.shape.fallbacks.description),
672
914
  }).describe("An LLM to be used within an Ensemble, including its unique identifier, optional fallbacks, and count.");
673
- export var EnsembleLlm;
674
- (function (EnsembleLlm) {
675
- EnsembleLlm.OutputModeSchema = z
676
- .enum(["instruction", "json_schema", "tool_call"])
677
- .describe('For Vector Completions only, specifies the LLM\'s voting output mode. For "instruction", the assistant is instructed to output a key. For "json_schema", the assistant is constrained to output a valid key using a JSON schema. For "tool_call", the assistant is instructed to output a tool call to select the key.');
678
- EnsembleLlm.StopSchema = z
679
- .union([
680
- z
681
- .string()
682
- .describe("Generation will stop when this string is generated."),
683
- z
684
- .array(z.string())
685
- .describe("Generation will stop when any of these strings are generated."),
686
- ])
687
- .describe("The assistant will stop when any of the provided strings are generated.");
688
- EnsembleLlm.ProviderSchema = z
689
- .object({
690
- allow_fallbacks: z
691
- .boolean()
692
- .optional()
693
- .nullable()
694
- .describe("Whether to allow fallback providers if the preferred provider is unavailable."),
695
- require_parameters: z
696
- .boolean()
697
- .optional()
698
- .nullable()
699
- .describe("Whether to require that the provider supports all specified parameters."),
700
- order: z
701
- .array(z.string())
702
- .optional()
703
- .nullable()
704
- .describe("An ordered list of provider names to use when selecting a provider for this model."),
705
- only: z
706
- .array(z.string())
707
- .optional()
708
- .nullable()
709
- .describe("A list of provider names to restrict selection to when selecting a provider for this model."),
710
- ignore: z
711
- .array(z.string())
712
- .optional()
713
- .nullable()
714
- .describe("A list of provider names to ignore when selecting a provider for this model."),
715
- quantizations: z
716
- .array(Provider.QuantizationSchema)
717
- .optional()
718
- .nullable()
719
- .describe("Specifies the quantizations to allow when selecting providers for this model."),
720
- })
721
- .describe("Options for selecting the upstream provider of this model.");
722
- let Provider;
723
- (function (Provider) {
724
- Provider.QuantizationSchema = z
725
- .enum([
726
- "int4",
727
- "int8",
728
- "fp4",
729
- "fp6",
730
- "fp8",
731
- "fp16",
732
- "bf16",
733
- "fp32",
734
- "unknown",
735
- ])
736
- .describe("An LLM quantization.");
737
- })(Provider = EnsembleLlm.Provider || (EnsembleLlm.Provider = {}));
738
- EnsembleLlm.ReasoningSchema = z
739
- .object({
740
- enabled: z
741
- .boolean()
742
- .optional()
743
- .nullable()
744
- .describe("Enables or disables reasoning for supported models."),
745
- max_tokens: z
746
- .int()
747
- .min(0)
748
- .max(2147483647)
749
- .optional()
750
- .nullable()
751
- .describe("The maximum number of tokens to use for reasoning in a response."),
752
- effort: Reasoning.EffortSchema.optional().nullable(),
753
- summary_verbosity: Reasoning.SummaryVerbositySchema.optional().nullable(),
754
- })
755
- .optional()
756
- .nullable()
757
- .describe("Options for controlling reasoning behavior of the model.");
758
- let Reasoning;
759
- (function (Reasoning) {
760
- Reasoning.EffortSchema = z
761
- .enum(["none", "minimal", "low", "medium", "high", "xhigh"])
762
- .describe("Constrains effort on reasoning for supported reasoning models. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.");
763
- Reasoning.SummaryVerbositySchema = z
764
- .enum(["auto", "concise", "detailed"])
765
- .describe("Controls the verbosity of the reasoning summary for supported reasoning models.");
766
- })(Reasoning = EnsembleLlm.Reasoning || (EnsembleLlm.Reasoning = {}));
767
- EnsembleLlm.VerbositySchema = z
768
- .enum(["low", "medium", "high"])
769
- .describe("Controls the verbosity and length of the model response. Lower values produce more concise responses, while higher values produce more detailed and comprehensive responses.");
770
- EnsembleLlm.ListItemSchema = z.object({
771
- id: z.string().describe("The unique identifier for the Ensemble LLM."),
772
- });
773
- async function list(openai, options) {
774
- const response = await openai.get("/ensemble_llms", options);
775
- return response;
776
- }
777
- EnsembleLlm.list = list;
778
- EnsembleLlm.RetrieveItemSchema = EnsembleLlmSchema.extend({
779
- created: z
780
- .uint32()
781
- .describe("The Unix timestamp (in seconds) when the Ensemble LLM was created."),
782
- });
783
- async function retrieve(openai, id, options) {
784
- const response = await openai.get(`/ensemble_llms/${id}`, options);
785
- return response;
786
- }
787
- EnsembleLlm.retrieve = retrieve;
788
- EnsembleLlm.HistoricalUsageSchema = z.object({
789
- requests: z
790
- .uint32()
791
- .describe("The total number of requests made to this Ensemble LLM."),
792
- completion_tokens: z
793
- .uint32()
794
- .describe("The total number of completion tokens generated by this Ensemble LLM."),
795
- prompt_tokens: z
796
- .uint32()
797
- .describe("The total number of prompt tokens sent to this Ensemble LLM."),
798
- total_cost: z
799
- .number()
800
- .describe("The total cost incurred by using this Ensemble LLM."),
801
- });
802
- async function retrieveUsage(openai, id, options) {
803
- const response = await openai.get(`/ensemble_llms/${id}/usage`, options);
804
- return response;
805
- }
806
- EnsembleLlm.retrieveUsage = retrieveUsage;
807
- })(EnsembleLlm || (EnsembleLlm = {}));
808
915
  // Ensemble
809
916
  export const EnsembleBaseSchema = z
810
917
  .object({
@@ -860,46 +967,14 @@ export var Ensemble;
860
967
  return response;
861
968
  }
862
969
  Ensemble.retrieveUsage = retrieveUsage;
863
- })(Ensemble || (Ensemble = {}));
864
- // Chat Completions
865
- export var Chat;
866
- (function (Chat) {
867
- let Completions;
868
- (function (Completions) {
869
- let Request;
870
- (function (Request) {
871
- Request.ProviderSchema = z
872
- .object({
873
- data_collection: Provider.DataCollectionSchema.optional().nullable(),
874
- zdr: z
875
- .boolean()
876
- .optional()
877
- .nullable()
878
- .describe("Whether to enforce Zero Data Retention (ZDR) policies when selecting providers."),
879
- sort: Provider.SortSchema.optional().nullable(),
880
- max_price: Provider.MaxPriceSchema.optional().nullable(),
881
- preferred_min_throughput: z
882
- .number()
883
- .optional()
884
- .nullable()
885
- .describe("Preferred minimum throughput for the provider."),
886
- preferred_max_latency: z
887
- .number()
888
- .optional()
889
- .nullable()
890
- .describe("Preferred maximum latency for the provider."),
891
- min_throughput: z
892
- .number()
893
- .optional()
894
- .nullable()
895
- .describe("Minimum throughput for the provider."),
896
- max_latency: z
897
- .number()
898
- .optional()
899
- .nullable()
900
- .describe("Maximum latency for the provider."),
901
- })
902
- .describe("Options for selecting the upstream provider of this completion.");
970
+ })(Ensemble || (Ensemble = {}));
971
+ // Chat Completions
972
+ export var Chat;
973
+ (function (Chat) {
974
+ let Completions;
975
+ (function (Completions) {
976
+ let Request;
977
+ (function (Request) {
903
978
  let Provider;
904
979
  (function (Provider) {
905
980
  Provider.DataCollectionSchema = z
@@ -936,36 +1011,55 @@ export var Chat;
936
1011
  .describe("Maximum price per request."),
937
1012
  });
938
1013
  })(Provider = Request.Provider || (Request.Provider = {}));
1014
+ Request.ProviderSchema = z
1015
+ .object({
1016
+ data_collection: Provider.DataCollectionSchema.optional().nullable(),
1017
+ zdr: z
1018
+ .boolean()
1019
+ .optional()
1020
+ .nullable()
1021
+ .describe("Whether to enforce Zero Data Retention (ZDR) policies when selecting providers."),
1022
+ sort: Provider.SortSchema.optional().nullable(),
1023
+ max_price: Provider.MaxPriceSchema.optional().nullable(),
1024
+ preferred_min_throughput: z
1025
+ .number()
1026
+ .optional()
1027
+ .nullable()
1028
+ .describe("Preferred minimum throughput for the provider."),
1029
+ preferred_max_latency: z
1030
+ .number()
1031
+ .optional()
1032
+ .nullable()
1033
+ .describe("Preferred maximum latency for the provider."),
1034
+ min_throughput: z
1035
+ .number()
1036
+ .optional()
1037
+ .nullable()
1038
+ .describe("Minimum throughput for the provider."),
1039
+ max_latency: z
1040
+ .number()
1041
+ .optional()
1042
+ .nullable()
1043
+ .describe("Maximum latency for the provider."),
1044
+ })
1045
+ .describe("Options for selecting the upstream provider of this completion.");
939
1046
  Request.ModelSchema = z
940
1047
  .union([z.string(), EnsembleLlmBaseSchema])
941
1048
  .describe("The Ensemble LLM to use for this completion. May be a unique ID or an inline definition.");
942
- Request.ResponseFormatSchema = z
943
- .union([
944
- ResponseFormat.TextSchema,
945
- ResponseFormat.JsonObjectSchema,
946
- ResponseFormat.JsonSchemaSchema,
947
- ResponseFormat.GrammarSchema,
948
- ResponseFormat.PythonSchema,
949
- ])
950
- .describe("The desired format of the model's response.");
951
1049
  let ResponseFormat;
952
1050
  (function (ResponseFormat) {
953
1051
  ResponseFormat.TextSchema = z
954
1052
  .object({
955
1053
  type: z.literal("text"),
956
1054
  })
957
- .describe("The response will be arbitrary text.");
1055
+ .describe("The response will be arbitrary text.")
1056
+ .meta({ title: "ResponseFormatText" });
958
1057
  ResponseFormat.JsonObjectSchema = z
959
1058
  .object({
960
1059
  type: z.literal("json_object"),
961
1060
  })
962
- .describe("The response will be a JSON object.");
963
- ResponseFormat.JsonSchemaSchema = z
964
- .object({
965
- type: z.literal("json_schema"),
966
- json_schema: JsonSchema.JsonSchemaSchema,
967
- })
968
- .describe("The response will conform to the provided JSON schema.");
1061
+ .describe("The response will be a JSON object.")
1062
+ .meta({ title: "ResponseFormatJsonObject" });
969
1063
  let JsonSchema;
970
1064
  (function (JsonSchema) {
971
1065
  JsonSchema.JsonSchemaSchema = z
@@ -986,8 +1080,16 @@ export var Chat;
986
1080
  .nullable()
987
1081
  .describe("Whether to enforce strict adherence to the JSON schema."),
988
1082
  })
989
- .describe("A JSON schema definition for constraining model output.");
1083
+ .describe("A JSON schema definition for constraining model output.")
1084
+ .meta({ title: "ResponseFormatJsonSchemaJsonSchema" });
990
1085
  })(JsonSchema = ResponseFormat.JsonSchema || (ResponseFormat.JsonSchema = {}));
1086
+ ResponseFormat.JsonSchemaSchema = z
1087
+ .object({
1088
+ type: z.literal("json_schema"),
1089
+ json_schema: JsonSchema.JsonSchemaSchema,
1090
+ })
1091
+ .describe("The response will conform to the provided JSON schema.")
1092
+ .meta({ title: "ResponseFormatJsonSchema" });
991
1093
  ResponseFormat.GrammarSchema = z
992
1094
  .object({
993
1095
  type: z.literal("grammar"),
@@ -995,50 +1097,56 @@ export var Chat;
995
1097
  .string()
996
1098
  .describe("The grammar definition to constrain the response."),
997
1099
  })
998
- .describe("The response will conform to the provided grammar definition.");
1100
+ .describe("The response will conform to the provided grammar definition.")
1101
+ .meta({ title: "ResponseFormatGrammar" });
999
1102
  ResponseFormat.PythonSchema = z
1000
1103
  .object({
1001
1104
  type: z.literal("python"),
1002
1105
  })
1003
- .describe("The response will be Python code.");
1106
+ .describe("The response will be Python code.")
1107
+ .meta({ title: "ResponseFormatPython" });
1004
1108
  })(ResponseFormat = Request.ResponseFormat || (Request.ResponseFormat = {}));
1005
- Request.ToolChoiceSchema = z
1109
+ Request.ResponseFormatSchema = z
1006
1110
  .union([
1007
- z.literal("none"),
1008
- z.literal("auto"),
1009
- z.literal("required"),
1010
- ToolChoice.FunctionSchema,
1111
+ ResponseFormat.TextSchema,
1112
+ ResponseFormat.JsonObjectSchema,
1113
+ ResponseFormat.JsonSchemaSchema,
1114
+ ResponseFormat.GrammarSchema,
1115
+ ResponseFormat.PythonSchema,
1011
1116
  ])
1012
- .describe("Specifies tool call behavior for the assistant.");
1117
+ .describe("The desired format of the model's response.")
1118
+ .meta({ title: "ResponseFormat" });
1013
1119
  let ToolChoice;
1014
1120
  (function (ToolChoice) {
1015
- ToolChoice.FunctionSchema = z
1016
- .object({
1017
- type: z.literal("function"),
1018
- function: Function.FunctionSchema,
1019
- })
1020
- .describe("Specify a function for the assistant to call.");
1021
1121
  let Function;
1022
1122
  (function (Function) {
1023
- Function.FunctionSchema = z.object({
1123
+ Function.FunctionSchema = z
1124
+ .object({
1024
1125
  name: z
1025
1126
  .string()
1026
1127
  .describe("The name of the function the assistant will call."),
1027
- });
1128
+ })
1129
+ .meta({ title: "ToolChoiceFunctionFunction" });
1028
1130
  })(Function = ToolChoice.Function || (ToolChoice.Function = {}));
1131
+ ToolChoice.FunctionSchema = z
1132
+ .object({
1133
+ type: z.literal("function"),
1134
+ function: Function.FunctionSchema,
1135
+ })
1136
+ .describe("Specify a function for the assistant to call.")
1137
+ .meta({ title: "ToolChoiceFunction" });
1029
1138
  })(ToolChoice = Request.ToolChoice || (Request.ToolChoice = {}));
1030
- Request.PredictionSchema = z
1031
- .object({
1032
- type: z.literal("content"),
1033
- content: Prediction.ContentSchema,
1034
- })
1035
- .describe("Configuration for a Predicted Output, which can greatly improve response times when large parts of the model response are known ahead of time. This is most common when you are regenerating a file with only minor changes to most of the content.");
1139
+ Request.ToolChoiceSchema = z
1140
+ .union([
1141
+ z.literal("none"),
1142
+ z.literal("auto"),
1143
+ z.literal("required"),
1144
+ ToolChoice.FunctionSchema,
1145
+ ])
1146
+ .describe("Specifies tool call behavior for the assistant.")
1147
+ .meta({ title: "ToolChoice" });
1036
1148
  let Prediction;
1037
1149
  (function (Prediction) {
1038
- Prediction.ContentSchema = z.union([
1039
- z.string(),
1040
- z.array(Content.PartSchema),
1041
- ]);
1042
1150
  let Content;
1043
1151
  (function (Content) {
1044
1152
  Content.PartSchema = z
@@ -1046,9 +1154,20 @@ export var Chat;
1046
1154
  type: z.literal("text"),
1047
1155
  text: z.string(),
1048
1156
  })
1049
- .describe("A part of the predicted content.");
1157
+ .describe("A part of the predicted content.")
1158
+ .meta({ title: "PredictionContentPart" });
1050
1159
  })(Content = Prediction.Content || (Prediction.Content = {}));
1160
+ Prediction.ContentSchema = z.union([
1161
+ z.string().meta({ title: "PredictionContentText" }),
1162
+ z.array(Content.PartSchema).meta({ title: "PredictionContentParts" }),
1163
+ ]);
1051
1164
  })(Prediction = Request.Prediction || (Request.Prediction = {}));
1165
+ Request.PredictionSchema = z
1166
+ .object({
1167
+ type: z.literal("content"),
1168
+ content: Prediction.ContentSchema,
1169
+ })
1170
+ .describe("Configuration for a Predicted Output, which can greatly improve response times when large parts of the model response are known ahead of time. This is most common when you are regenerating a file with only minor changes to most of the content.");
1052
1171
  Request.SeedSchema = z
1053
1172
  .bigint()
1054
1173
  .describe("If specified, upstream systems will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result.");
@@ -1098,53 +1217,30 @@ export var Chat;
1098
1217
  .describe("Whether to stream the response as a series of chunks.");
1099
1218
  Request.ChatCompletionCreateParamsStreamingSchema = Request.ChatCompletionCreateParamsBaseSchema.extend({
1100
1219
  stream: Request.StreamTrueSchema,
1101
- }).describe("Parameters for creating a streaming chat completion.");
1220
+ })
1221
+ .describe("Parameters for creating a streaming chat completion.")
1222
+ .meta({ title: "ChatCompletionCreateParamsStreaming" });
1102
1223
  Request.StreamFalseSchema = z
1103
1224
  .literal(false)
1104
1225
  .describe("Whether to stream the response as a series of chunks.");
1105
1226
  Request.ChatCompletionCreateParamsNonStreamingSchema = Request.ChatCompletionCreateParamsBaseSchema.extend({
1106
1227
  stream: Request.StreamFalseSchema.optional().nullable(),
1107
- }).describe("Parameters for creating a unary chat completion.");
1228
+ })
1229
+ .describe("Parameters for creating a unary chat completion.")
1230
+ .meta({ title: "ChatCompletionCreateParamsNonStreaming" });
1108
1231
  Request.ChatCompletionCreateParamsSchema = z
1109
1232
  .union([
1110
1233
  Request.ChatCompletionCreateParamsStreamingSchema,
1111
1234
  Request.ChatCompletionCreateParamsNonStreamingSchema,
1112
1235
  ])
1113
- .describe("Parameters for creating a chat completion.");
1236
+ .describe("Parameters for creating a chat completion.")
1237
+ .meta({ title: "ChatCompletionCreateParams" });
1114
1238
  })(Request = Completions.Request || (Completions.Request = {}));
1115
1239
  let Response;
1116
1240
  (function (Response) {
1117
1241
  Response.FinishReasonSchema = z
1118
1242
  .enum(["stop", "length", "tool_calls", "content_filter", "error"])
1119
1243
  .describe("The reason why the assistant ceased to generate further tokens.");
1120
- Response.UsageSchema = z
1121
- .object({
1122
- completion_tokens: z
1123
- .uint32()
1124
- .describe("The number of tokens generated in the completion."),
1125
- prompt_tokens: z
1126
- .uint32()
1127
- .describe("The number of tokens in the prompt."),
1128
- total_tokens: z
1129
- .uint32()
1130
- .describe("The total number of tokens used in the prompt or generated in the completion."),
1131
- completion_tokens_details: Usage.CompletionTokensDetailsSchema.optional(),
1132
- prompt_tokens_details: Usage.PromptTokensDetailsSchema.optional(),
1133
- cost: z
1134
- .number()
1135
- .describe("The cost in credits incurred for this completion."),
1136
- cost_details: Usage.CostDetailsSchema.optional(),
1137
- total_cost: z
1138
- .number()
1139
- .describe("The total cost in credits incurred including upstream costs."),
1140
- cost_multiplier: z
1141
- .number()
1142
- .describe("The cost multiplier applied to upstream costs for computing ObjectiveAI costs."),
1143
- is_byok: z
1144
- .boolean()
1145
- .describe("Whether the completion used a BYOK (Bring Your Own Key) API Key."),
1146
- })
1147
- .describe("Token and cost usage statistics for the completion.");
1148
1244
  let Usage;
1149
1245
  (function (Usage) {
1150
1246
  Usage.CompletionTokensDetailsSchema = z
@@ -1200,20 +1296,34 @@ export var Chat;
1200
1296
  })
1201
1297
  .describe("Detailed breakdown of upstream costs incurred.");
1202
1298
  })(Usage = Response.Usage || (Response.Usage = {}));
1203
- Response.LogprobsSchema = z
1299
+ Response.UsageSchema = z
1204
1300
  .object({
1205
- content: z
1206
- .array(Logprobs.LogprobSchema)
1207
- .optional()
1208
- .nullable()
1209
- .describe("The log probabilities of the tokens in the content."),
1210
- refusal: z
1211
- .array(Logprobs.LogprobSchema)
1212
- .optional()
1213
- .nullable()
1214
- .describe("The log probabilities of the tokens in the refusal."),
1301
+ completion_tokens: z
1302
+ .uint32()
1303
+ .describe("The number of tokens generated in the completion."),
1304
+ prompt_tokens: z
1305
+ .uint32()
1306
+ .describe("The number of tokens in the prompt."),
1307
+ total_tokens: z
1308
+ .uint32()
1309
+ .describe("The total number of tokens used in the prompt or generated in the completion."),
1310
+ completion_tokens_details: Usage.CompletionTokensDetailsSchema.optional(),
1311
+ prompt_tokens_details: Usage.PromptTokensDetailsSchema.optional(),
1312
+ cost: z
1313
+ .number()
1314
+ .describe("The cost in credits incurred for this completion."),
1315
+ cost_details: Usage.CostDetailsSchema.optional(),
1316
+ total_cost: z
1317
+ .number()
1318
+ .describe("The total cost in credits incurred including upstream costs."),
1319
+ cost_multiplier: z
1320
+ .number()
1321
+ .describe("The cost multiplier applied to upstream costs for computing ObjectiveAI costs."),
1322
+ is_byok: z
1323
+ .boolean()
1324
+ .describe("Whether the completion used a BYOK (Bring Your Own Key) API Key."),
1215
1325
  })
1216
- .describe("The log probabilities of the tokens generated by the model.");
1326
+ .describe("Token and cost usage statistics for the completion.");
1217
1327
  let Logprobs;
1218
1328
  (function (Logprobs) {
1219
1329
  function merged(a, b) {
@@ -1227,24 +1337,6 @@ export var Chat;
1227
1337
  }
1228
1338
  }
1229
1339
  Logprobs.merged = merged;
1230
- Logprobs.LogprobSchema = z
1231
- .object({
1232
- token: z
1233
- .string()
1234
- .describe("The token string which was selected by the sampler."),
1235
- bytes: z
1236
- .array(z.uint32())
1237
- .optional()
1238
- .nullable()
1239
- .describe("The byte representation of the token which was selected by the sampler."),
1240
- logprob: z
1241
- .number()
1242
- .describe("The log probability of the token which was selected by the sampler."),
1243
- top_logprobs: z
1244
- .array(Logprob.TopLogprobSchema)
1245
- .describe("The log probabilities of the top tokens for this position."),
1246
- })
1247
- .describe("The token which was selected by the sampler for this position as well as the logprobabilities of the top options.");
1248
1340
  let Logprob;
1249
1341
  (function (Logprob) {
1250
1342
  function mergedList(a, b) {
@@ -1275,13 +1367,42 @@ export var Chat;
1275
1367
  })
1276
1368
  .describe("The log probability of a token in the list of top tokens.");
1277
1369
  })(Logprob = Logprobs.Logprob || (Logprobs.Logprob = {}));
1370
+ Logprobs.LogprobSchema = z
1371
+ .object({
1372
+ token: z
1373
+ .string()
1374
+ .describe("The token string which was selected by the sampler."),
1375
+ bytes: z
1376
+ .array(z.uint32())
1377
+ .optional()
1378
+ .nullable()
1379
+ .describe("The byte representation of the token which was selected by the sampler."),
1380
+ logprob: z
1381
+ .number()
1382
+ .describe("The log probability of the token which was selected by the sampler."),
1383
+ top_logprobs: z
1384
+ .array(Logprob.TopLogprobSchema)
1385
+ .describe("The log probabilities of the top tokens for this position."),
1386
+ })
1387
+ .describe("The token which was selected by the sampler for this position as well as the logprobabilities of the top options.");
1278
1388
  })(Logprobs = Response.Logprobs || (Response.Logprobs = {}));
1389
+ Response.LogprobsSchema = z
1390
+ .object({
1391
+ content: z
1392
+ .array(Logprobs.LogprobSchema)
1393
+ .optional()
1394
+ .nullable()
1395
+ .describe("The log probabilities of the tokens in the content."),
1396
+ refusal: z
1397
+ .array(Logprobs.LogprobSchema)
1398
+ .optional()
1399
+ .nullable()
1400
+ .describe("The log probabilities of the tokens in the refusal."),
1401
+ })
1402
+ .describe("The log probabilities of the tokens generated by the model.");
1279
1403
  Response.RoleSchema = z
1280
1404
  .enum(["assistant"])
1281
1405
  .describe("The role of the message author.");
1282
- Response.ImageSchema = z
1283
- .union([Image.ImageUrlSchema])
1284
- .describe("An image generated by the model.");
1285
1406
  let Image;
1286
1407
  (function (Image) {
1287
1408
  function mergedList(a, b) {
@@ -1303,11 +1424,11 @@ export var Chat;
1303
1424
  }),
1304
1425
  });
1305
1426
  })(Image = Response.Image || (Response.Image = {}));
1427
+ Response.ImageSchema = z
1428
+ .union([Image.ImageUrlSchema])
1429
+ .describe("An image generated by the model.");
1306
1430
  let Streaming;
1307
1431
  (function (Streaming) {
1308
- Streaming.ToolCallSchema = z
1309
- .union([ToolCall.FunctionSchema])
1310
- .describe("A tool call made by the assistant.");
1311
1432
  let ToolCall;
1312
1433
  (function (ToolCall) {
1313
1434
  function merged(a, b) {
@@ -1339,19 +1460,6 @@ export var Chat;
1339
1460
  return merged ? [merged, true] : [a, false];
1340
1461
  }
1341
1462
  ToolCall.mergedList = mergedList;
1342
- ToolCall.FunctionSchema = z
1343
- .object({
1344
- index: z
1345
- .uint32()
1346
- .describe("The index of the tool call in the sequence of tool calls."),
1347
- type: z.literal("function").optional(),
1348
- id: z
1349
- .string()
1350
- .optional()
1351
- .describe("The unique identifier of the function tool."),
1352
- function: Function.DefinitionSchema.optional(),
1353
- })
1354
- .describe("A function tool call made by the assistant.");
1355
1463
  let Function;
1356
1464
  (function (Function) {
1357
1465
  function merged(a, b) {
@@ -1370,13 +1478,6 @@ export var Chat;
1370
1478
  }
1371
1479
  }
1372
1480
  Function.merged = merged;
1373
- Function.DefinitionSchema = z.object({
1374
- name: z.string().optional().describe("The name of the function."),
1375
- arguments: z
1376
- .string()
1377
- .optional()
1378
- .describe("The arguments passed to the function."),
1379
- });
1380
1481
  let Definition;
1381
1482
  (function (Definition) {
1382
1483
  function merged(a, b) {
@@ -1396,8 +1497,31 @@ export var Chat;
1396
1497
  }
1397
1498
  Definition.merged = merged;
1398
1499
  })(Definition = Function.Definition || (Function.Definition = {}));
1500
+ Function.DefinitionSchema = z.object({
1501
+ name: z.string().optional().describe("The name of the function."),
1502
+ arguments: z
1503
+ .string()
1504
+ .optional()
1505
+ .describe("The arguments passed to the function."),
1506
+ });
1399
1507
  })(Function = ToolCall.Function || (ToolCall.Function = {}));
1508
+ ToolCall.FunctionSchema = z
1509
+ .object({
1510
+ index: z
1511
+ .uint32()
1512
+ .describe("The index of the tool call in the sequence of tool calls."),
1513
+ type: z.literal("function").optional(),
1514
+ id: z
1515
+ .string()
1516
+ .optional()
1517
+ .describe("The unique identifier of the function tool."),
1518
+ function: Function.DefinitionSchema.optional(),
1519
+ })
1520
+ .describe("A function tool call made by the assistant.");
1400
1521
  })(ToolCall = Streaming.ToolCall || (Streaming.ToolCall = {}));
1522
+ Streaming.ToolCallSchema = z
1523
+ .union([ToolCall.FunctionSchema])
1524
+ .describe("A tool call made by the assistant.");
1401
1525
  Streaming.DeltaSchema = z
1402
1526
  .object({
1403
1527
  content: z
@@ -1576,20 +1700,8 @@ export var Chat;
1576
1700
  })(Streaming = Response.Streaming || (Response.Streaming = {}));
1577
1701
  let Unary;
1578
1702
  (function (Unary) {
1579
- Unary.ToolCallSchema = z
1580
- .union([ToolCall.FunctionSchema])
1581
- .describe(Streaming.ToolCallSchema.description);
1582
1703
  let ToolCall;
1583
1704
  (function (ToolCall) {
1584
- ToolCall.FunctionSchema = z
1585
- .object({
1586
- type: z.literal("function"),
1587
- id: z
1588
- .string()
1589
- .describe(Streaming.ToolCall.FunctionSchema.shape.id.description),
1590
- function: Function.DefinitionSchema,
1591
- })
1592
- .describe(Streaming.ToolCall.FunctionSchema.description);
1593
1705
  let Function;
1594
1706
  (function (Function) {
1595
1707
  Function.DefinitionSchema = z.object({
@@ -1603,7 +1715,19 @@ export var Chat;
1603
1715
  .description),
1604
1716
  });
1605
1717
  })(Function = ToolCall.Function || (ToolCall.Function = {}));
1718
+ ToolCall.FunctionSchema = z
1719
+ .object({
1720
+ type: z.literal("function"),
1721
+ id: z
1722
+ .string()
1723
+ .describe(Streaming.ToolCall.FunctionSchema.shape.id.description),
1724
+ function: Function.DefinitionSchema,
1725
+ })
1726
+ .describe(Streaming.ToolCall.FunctionSchema.description);
1606
1727
  })(ToolCall = Unary.ToolCall || (Unary.ToolCall = {}));
1728
+ Unary.ToolCallSchema = z
1729
+ .union([ToolCall.FunctionSchema])
1730
+ .describe(Streaming.ToolCallSchema.description);
1607
1731
  Unary.MessageSchema = z
1608
1732
  .object({
1609
1733
  content: z
@@ -1715,19 +1839,43 @@ export var Vector;
1715
1839
  .describe("Base parameters for creating a vector completion.");
1716
1840
  Request.VectorCompletionCreateParamsStreamingSchema = Request.VectorCompletionCreateParamsBaseSchema.extend({
1717
1841
  stream: Chat.Completions.Request.StreamTrueSchema,
1718
- }).describe("Parameters for creating a streaming vector completion.");
1842
+ })
1843
+ .describe("Parameters for creating a streaming vector completion.")
1844
+ .meta({ title: "VectorCompletionCreateParamsStreaming" });
1719
1845
  Request.VectorCompletionCreateParamsNonStreamingSchema = Request.VectorCompletionCreateParamsBaseSchema.extend({
1720
1846
  stream: Chat.Completions.Request.StreamFalseSchema.optional().nullable(),
1721
- }).describe("Parameters for creating a unary vector completion.");
1847
+ })
1848
+ .describe("Parameters for creating a unary vector completion.")
1849
+ .meta({ title: "VectorCompletionCreateParamsNonStreaming" });
1722
1850
  Request.VectorCompletionCreateParamsSchema = z
1723
1851
  .union([
1724
1852
  Request.VectorCompletionCreateParamsStreamingSchema,
1725
1853
  Request.VectorCompletionCreateParamsNonStreamingSchema,
1726
1854
  ])
1727
- .describe("Parameters for creating a vector completion.");
1855
+ .describe("Parameters for creating a vector completion.")
1856
+ .meta({ title: "VectorCompletionCreateParams" });
1728
1857
  })(Request = Completions.Request || (Completions.Request = {}));
1729
1858
  let Response;
1730
1859
  (function (Response) {
1860
+ let Vote;
1861
+ (function (Vote) {
1862
+ function mergedList(a, b) {
1863
+ let merged = undefined;
1864
+ for (const vote of b) {
1865
+ const existingIndex = a.findIndex(({ flat_ensemble_index }) => flat_ensemble_index === vote.flat_ensemble_index);
1866
+ if (existingIndex === -1) {
1867
+ if (merged === undefined) {
1868
+ merged = [...a, vote];
1869
+ }
1870
+ else {
1871
+ merged.push(vote);
1872
+ }
1873
+ }
1874
+ }
1875
+ return merged ? [merged, true] : [a, false];
1876
+ }
1877
+ Vote.mergedList = mergedList;
1878
+ })(Vote = Response.Vote || (Response.Vote = {}));
1731
1879
  Response.VoteSchema = z
1732
1880
  .object({
1733
1881
  model: z
@@ -1749,25 +1897,42 @@ export var Vector;
1749
1897
  .describe("Whether this vote came from a previous Vector Completion which was retried."),
1750
1898
  })
1751
1899
  .describe("A vote from an Ensemble LLM within a Vector Completion.");
1752
- let Vote;
1753
- (function (Vote) {
1754
- function mergedList(a, b) {
1755
- let merged = undefined;
1756
- for (const vote of b) {
1757
- const existingIndex = a.findIndex(({ flat_ensemble_index }) => flat_ensemble_index === vote.flat_ensemble_index);
1758
- if (existingIndex === -1) {
1759
- if (merged === undefined) {
1760
- merged = [...a, vote];
1761
- }
1762
- else {
1763
- merged.push(vote);
1900
+ Response.VotesSchema = z
1901
+ .array(Response.VoteSchema)
1902
+ .describe("The list of votes for responses in the request from the Ensemble LLMs within the provided Ensemble.");
1903
+ let Scores;
1904
+ (function (Scores) {
1905
+ function merged(a, b) {
1906
+ if (a.length === b.length) {
1907
+ for (let i = 0; i < a.length; i++) {
1908
+ if (a[i] !== b[i]) {
1909
+ return [b, true];
1764
1910
  }
1765
1911
  }
1912
+ return [a, false];
1913
+ }
1914
+ else {
1915
+ return [b, true];
1766
1916
  }
1767
- return merged ? [merged, true] : [a, false];
1768
1917
  }
1769
- Vote.mergedList = mergedList;
1770
- })(Vote = Response.Vote || (Response.Vote = {}));
1918
+ Scores.merged = merged;
1919
+ })(Scores = Response.Scores || (Response.Scores = {}));
1920
+ Response.ScoresSchema = z
1921
+ .array(z.number())
1922
+ .describe("The scores for each response in the request, aggregated from the votes of the Ensemble LLMs.");
1923
+ let Weights;
1924
+ (function (Weights) {
1925
+ function merged(a, b) {
1926
+ return Scores.merged(a, b);
1927
+ }
1928
+ Weights.merged = merged;
1929
+ })(Weights = Response.Weights || (Response.Weights = {}));
1930
+ Response.WeightsSchema = z
1931
+ .array(z.number())
1932
+ .describe("The weights assigned to each response in the request, aggregated from the votes of the Ensemble LLMs.");
1933
+ Response.EnsembleSchema = z
1934
+ .string()
1935
+ .describe("The unique identifier of the Ensemble used for this vector completion.");
1771
1936
  Response.UsageSchema = z
1772
1937
  .object({
1773
1938
  completion_tokens: z
@@ -1790,26 +1955,8 @@ export var Vector;
1790
1955
  .describe("The total cost in credits incurred including upstream costs."),
1791
1956
  })
1792
1957
  .describe("Token and cost usage statistics for the completion.");
1793
- Response.VotesSchema = z
1794
- .array(Response.VoteSchema)
1795
- .describe("The list of votes for responses in the request from the Ensemble LLMs within the provided Ensemble.");
1796
- Response.ScoresSchema = z
1797
- .array(z.number())
1798
- .describe("The scores for each response in the request, aggregated from the votes of the Ensemble LLMs.");
1799
- Response.WeightsSchema = z
1800
- .array(z.number())
1801
- .describe("The weights assigned to each response in the request, aggregated from the votes of the Ensemble LLMs.");
1802
- Response.EnsembleSchema = z
1803
- .string()
1804
- .describe("The unique identifier of the Ensemble used for this vector completion.");
1805
1958
  let Streaming;
1806
1959
  (function (Streaming) {
1807
- Streaming.ChatCompletionChunkSchema = Chat.Completions.Response.Streaming.ChatCompletionChunkSchema.extend({
1808
- index: z
1809
- .uint32()
1810
- .describe("The index of the completion amongst all chat completions."),
1811
- error: ObjectiveAIErrorSchema.optional().describe("An error encountered during the generation of this chat completion."),
1812
- }).describe("A chat completion chunk generated in the pursuit of a vector completion.");
1813
1960
  let ChatCompletionChunk;
1814
1961
  (function (ChatCompletionChunk) {
1815
1962
  function merged(a, b) {
@@ -1853,25 +2000,12 @@ export var Vector;
1853
2000
  }
1854
2001
  ChatCompletionChunk.mergedList = mergedList;
1855
2002
  })(ChatCompletionChunk = Streaming.ChatCompletionChunk || (Streaming.ChatCompletionChunk = {}));
1856
- Streaming.VectorCompletionChunkSchema = z
1857
- .object({
1858
- id: z
1859
- .string()
1860
- .describe("The unique identifier of the vector completion."),
1861
- completions: z
1862
- .array(Streaming.ChatCompletionChunkSchema)
1863
- .describe("The list of chat completion chunks created for this vector completion."),
1864
- votes: Response.VotesSchema,
1865
- scores: Response.ScoresSchema,
1866
- weights: Response.WeightsSchema,
1867
- created: z
2003
+ Streaming.ChatCompletionChunkSchema = Chat.Completions.Response.Streaming.ChatCompletionChunkSchema.extend({
2004
+ index: z
1868
2005
  .uint32()
1869
- .describe("The Unix timestamp (in seconds) when the vector completion was created."),
1870
- ensemble: Response.EnsembleSchema,
1871
- object: z.literal("vector.completion.chunk"),
1872
- usage: Response.UsageSchema.optional(),
1873
- })
1874
- .describe("A chunk in a streaming vector completion response.");
2006
+ .describe("The index of the completion amongst all chat completions."),
2007
+ error: ObjectiveAIErrorSchema.optional().describe("An error encountered during the generation of this chat completion."),
2008
+ }).describe("A chat completion chunk generated in the pursuit of a vector completion.");
1875
2009
  let VectorCompletionChunk;
1876
2010
  (function (VectorCompletionChunk) {
1877
2011
  function merged(a, b) {
@@ -1907,30 +2041,25 @@ export var Vector;
1907
2041
  }
1908
2042
  VectorCompletionChunk.merged = merged;
1909
2043
  })(VectorCompletionChunk = Streaming.VectorCompletionChunk || (Streaming.VectorCompletionChunk = {}));
1910
- let Scores;
1911
- (function (Scores) {
1912
- function merged(a, b) {
1913
- if (a.length === b.length) {
1914
- for (let i = 0; i < a.length; i++) {
1915
- if (a[i] !== b[i]) {
1916
- return [b, true];
1917
- }
1918
- }
1919
- return [a, false];
1920
- }
1921
- else {
1922
- return [b, true];
1923
- }
1924
- }
1925
- Scores.merged = merged;
1926
- })(Scores = Streaming.Scores || (Streaming.Scores = {}));
1927
- let Weights;
1928
- (function (Weights) {
1929
- function merged(a, b) {
1930
- return Scores.merged(a, b);
1931
- }
1932
- Weights.merged = merged;
1933
- })(Weights = Streaming.Weights || (Streaming.Weights = {}));
2044
+ Streaming.VectorCompletionChunkSchema = z
2045
+ .object({
2046
+ id: z
2047
+ .string()
2048
+ .describe("The unique identifier of the vector completion."),
2049
+ completions: z
2050
+ .array(Streaming.ChatCompletionChunkSchema)
2051
+ .describe("The list of chat completion chunks created for this vector completion."),
2052
+ votes: Response.VotesSchema,
2053
+ scores: Response.ScoresSchema,
2054
+ weights: Response.WeightsSchema,
2055
+ created: z
2056
+ .uint32()
2057
+ .describe("The Unix timestamp (in seconds) when the vector completion was created."),
2058
+ ensemble: Response.EnsembleSchema,
2059
+ object: z.literal("vector.completion.chunk"),
2060
+ usage: Response.UsageSchema.optional(),
2061
+ })
2062
+ .describe("A chunk in a streaming vector completion response.");
1934
2063
  })(Streaming = Response.Streaming || (Response.Streaming = {}));
1935
2064
  let Unary;
1936
2065
  (function (Unary) {
@@ -1970,9 +2099,6 @@ export var Vector;
1970
2099
  })(Completions = Vector.Completions || (Vector.Completions = {}));
1971
2100
  })(Vector || (Vector = {}));
1972
2101
  // Function
1973
- export const FunctionSchema = z
1974
- .discriminatedUnion("type", [Function.ScalarSchema, Function.VectorSchema])
1975
- .describe("A function.");
1976
2102
  export var Function;
1977
2103
  (function (Function_1) {
1978
2104
  Function_1.VectorCompletionProfileSchema = z
@@ -1981,54 +2107,53 @@ export var Function;
1981
2107
  profile: Vector.Completions.Request.ProfileSchema,
1982
2108
  })
1983
2109
  .describe("A vector completion profile containing an Ensemble and array of weights.");
1984
- Function_1.FunctionProfileVersionRequiredSchema = z
2110
+ Function_1.FunctionProfileCommitRequiredSchema = z
1985
2111
  .union([
1986
2112
  z.object({
1987
- function_author: z
2113
+ owner: z
2114
+ .string()
2115
+ .describe("The owner of the GitHub repository containing the profile."),
2116
+ repository: z
1988
2117
  .string()
1989
- .describe("The author of the function the profile was published to."),
1990
- function_id: z
2118
+ .describe("The name of the GitHub repository containing the profile."),
2119
+ commit: z
1991
2120
  .string()
1992
- .describe("The unique identifier of the function the profile was published to."),
1993
- author: z.string().describe("The author of the profile."),
1994
- id: z.string().describe("The unique identifier of the profile."),
1995
- version: z.uint32().describe("The version of the profile."),
2121
+ .describe("The commit SHA of the GitHub repository containing the profile."),
1996
2122
  }),
1997
- z.lazy(() => z.array(Function_1.ProfileVersionRequiredSchema)),
2123
+ z.lazy(() => z.array(Function_1.ProfileCommitRequiredSchema).meta({
2124
+ title: "ProfileCommitRequiredArray",
2125
+ recursive: true,
2126
+ })),
1998
2127
  ])
1999
- .describe("A function profile where remote profiles must specify a version.");
2000
- Function_1.FunctionProfileVersionOptionalSchema = z
2128
+ .describe("A function profile where remote profiles must specify a commit.");
2129
+ Function_1.FunctionProfileCommitOptionalSchema = z
2001
2130
  .union([
2002
2131
  z.object({
2003
- function_author: z
2132
+ owner: z
2004
2133
  .string()
2005
- .describe("The author of the function the profile was published to."),
2006
- function_id: z
2134
+ .describe("The owner of the GitHub repository containing the profile."),
2135
+ repository: z
2007
2136
  .string()
2008
- .describe("The unique identifier of the function the profile was published to."),
2009
- author: z.string().describe("The author of the profile."),
2010
- id: z.string().describe("The unique identifier of the profile."),
2011
- version: z
2012
- .uint32()
2013
- .optional()
2014
- .nullable()
2015
- .describe("The version of the profile."),
2137
+ .describe("The name of the GitHub repository containing the profile."),
2138
+ commit: z
2139
+ .string()
2140
+ .describe("The commit SHA of the GitHub repository containing the profile.")
2141
+ .optional(),
2142
+ }),
2143
+ z
2144
+ .lazy(() => z.array(Function_1.ProfileCommitOptionalSchema))
2145
+ .meta({
2146
+ title: "ProfileCommitOptionalArray",
2147
+ recursive: true,
2016
2148
  }),
2017
- z.lazy(() => z.array(Function_1.ProfileVersionOptionalSchema)),
2018
- ])
2019
- .describe("A function profile where remote profiles may omit a version.");
2020
- Function_1.ProfileVersionRequiredSchema = z
2021
- .union([
2022
- Function_1.FunctionProfileVersionRequiredSchema,
2023
- Function_1.VectorCompletionProfileSchema,
2024
- ])
2025
- .describe("A profile where remote function profiles must specify a version.");
2026
- Function_1.ProfileVersionOptionalSchema = z
2027
- .union([
2028
- Function_1.FunctionProfileVersionOptionalSchema,
2029
- Function_1.VectorCompletionProfileSchema,
2030
2149
  ])
2031
- .describe("A profile where remote function profiles may omit a version.");
2150
+ .describe("A function profile where remote profiles may omit a commit.");
2151
+ Function_1.ProfileCommitRequiredSchema = z
2152
+ .union([Function_1.FunctionProfileCommitRequiredSchema, Function_1.VectorCompletionProfileSchema])
2153
+ .describe("A profile where remote function profiles must specify a commit.");
2154
+ Function_1.ProfileCommitOptionalSchema = z
2155
+ .union([Function_1.FunctionProfileCommitOptionalSchema, Function_1.VectorCompletionProfileSchema])
2156
+ .describe("A profile where remote function profiles may omit a commit.");
2032
2157
  Function_1.InputSchemaSchema = z.lazy(() => z
2033
2158
  .union([
2034
2159
  InputSchema.ObjectSchema,
@@ -2054,7 +2179,10 @@ export var Function;
2054
2179
  .nullable()
2055
2180
  .describe("The description of the object input."),
2056
2181
  properties: z
2057
- .record(z.string(), Function_1.InputSchemaSchema)
2182
+ .record(z.string(), Function_1.InputSchemaSchema.meta({
2183
+ title: "InputSchema",
2184
+ recursive: true,
2185
+ }))
2058
2186
  .describe("The properties of the object input."),
2059
2187
  required: z
2060
2188
  .array(z.string())
@@ -2081,7 +2209,10 @@ export var Function;
2081
2209
  .optional()
2082
2210
  .nullable()
2083
2211
  .describe("The maximum number of items in the array input."),
2084
- items: Function_1.InputSchemaSchema.describe("The schema of the items in the array input."),
2212
+ items: Function_1.InputSchemaSchema.describe("The schema of the items in the array input.").meta({
2213
+ title: "InputSchema",
2214
+ recursive: true,
2215
+ }),
2085
2216
  })
2086
2217
  .describe("An array input schema.");
2087
2218
  InputSchema.StringSchema = z
@@ -2193,8 +2324,14 @@ export var Function;
2193
2324
  Function_1.InputSchema_ = z
2194
2325
  .lazy(() => z.union([
2195
2326
  Message.RichContent.PartSchema,
2196
- z.record(z.string(), Function_1.InputSchema_),
2197
- z.array(Function_1.InputSchema_),
2327
+ z.record(z.string(), Function_1.InputSchema_.meta({
2328
+ title: "Input",
2329
+ recursive: true,
2330
+ })),
2331
+ z.array(Function_1.InputSchema_.meta({
2332
+ title: "Input",
2333
+ recursive: true,
2334
+ })),
2198
2335
  z.string(),
2199
2336
  z.number(),
2200
2337
  z.boolean(),
@@ -2203,8 +2340,14 @@ export var Function;
2203
2340
  Function_1.InputExpressionSchema = z.lazy(() => z
2204
2341
  .union([
2205
2342
  Message.RichContent.PartSchema,
2206
- z.record(z.string(), Function_1.InputExpressionSchema),
2207
- z.array(Function_1.InputExpressionSchema),
2343
+ z.record(z.string(), Function_1.InputExpressionSchema.meta({
2344
+ title: "InputExpression",
2345
+ recursive: true,
2346
+ })),
2347
+ z.array(Function_1.InputExpressionSchema.meta({
2348
+ title: "InputExpression",
2349
+ recursive: true,
2350
+ })),
2208
2351
  z.string(),
2209
2352
  z.number(),
2210
2353
  z.boolean(),
@@ -2219,13 +2362,6 @@ export var Function;
2219
2362
  .describe("A list of expressions which each evaluate to a 1D array of Inputs."),
2220
2363
  ])
2221
2364
  .describe("An expression or list of expressions which evaluate to a 2D array of Inputs. Each sub-array will be fed into Tasks which specify an index of this input map.");
2222
- Function_1.TaskExpressionSchema = z
2223
- .discriminatedUnion("type", [
2224
- TaskExpression.ScalarFunctionSchema,
2225
- TaskExpression.VectorFunctionSchema,
2226
- TaskExpression.VectorCompletionSchema,
2227
- ])
2228
- .describe("A task to be executed as part of the function. Will first be compiled using the parent function's input. May be skipped or mapped.");
2229
2365
  let TaskExpression;
2230
2366
  (function (TaskExpression) {
2231
2367
  TaskExpression.SkipSchema = ExpressionSchema.describe("An expression which evaluates to a boolean indicating whether to skip this task.");
@@ -2235,15 +2371,15 @@ export var Function;
2235
2371
  TaskExpression.ScalarFunctionSchema = z
2236
2372
  .object({
2237
2373
  type: z.literal("scalar.function"),
2238
- author: z
2374
+ owner: z
2239
2375
  .string()
2240
- .describe("The author of the remote published scalar function."),
2241
- id: z
2376
+ .describe("The owner of the GitHub repository containing the function."),
2377
+ repository: z
2242
2378
  .string()
2243
- .describe("The unique identifier of the remote published scalar function."),
2244
- version: z
2245
- .uint32()
2246
- .describe("The version of the remote published scalar function."),
2379
+ .describe("The name of the GitHub repository containing the function."),
2380
+ commit: z
2381
+ .string()
2382
+ .describe("The commit SHA of the GitHub repository containing the function."),
2247
2383
  skip: TaskExpression.SkipSchema.optional().nullable(),
2248
2384
  map: TaskExpression.MapSchema.optional().nullable(),
2249
2385
  input: Function_1.InputExpressionSchema,
@@ -2252,15 +2388,15 @@ export var Function;
2252
2388
  TaskExpression.VectorFunctionSchema = z
2253
2389
  .object({
2254
2390
  type: z.literal("vector.function"),
2255
- author: z
2391
+ owner: z
2256
2392
  .string()
2257
- .describe("The author of the remote published vector function."),
2258
- id: z
2393
+ .describe("The owner of the GitHub repository containing the function."),
2394
+ repository: z
2259
2395
  .string()
2260
- .describe("The unique identifier of the remote published vector function."),
2261
- version: z
2262
- .uint32()
2263
- .describe("The version of the remote published vector function."),
2396
+ .describe("The name of the GitHub repository containing the function."),
2397
+ commit: z
2398
+ .string()
2399
+ .describe("The commit SHA of the GitHub repository containing the function."),
2264
2400
  skip: TaskExpression.SkipSchema.optional().nullable(),
2265
2401
  map: TaskExpression.MapSchema.optional().nullable(),
2266
2402
  input: Function_1.InputExpressionSchema,
@@ -2279,15 +2415,19 @@ export var Function;
2279
2415
  })
2280
2416
  .describe("A vector completion task.");
2281
2417
  })(TaskExpression = Function_1.TaskExpression || (Function_1.TaskExpression = {}));
2418
+ Function_1.TaskExpressionSchema = z
2419
+ .discriminatedUnion("type", [
2420
+ TaskExpression.ScalarFunctionSchema,
2421
+ TaskExpression.VectorFunctionSchema,
2422
+ TaskExpression.VectorCompletionSchema,
2423
+ ])
2424
+ .describe("A task to be executed as part of the function. Will first be compiled using the parent function's input. May be skipped or mapped.");
2282
2425
  Function_1.TaskExpressionsSchema = z
2283
2426
  .array(Function_1.TaskExpressionSchema)
2284
2427
  .describe("The list of tasks to be executed as part of the function.");
2285
2428
  Function_1.ScalarSchema = z
2286
2429
  .object({
2287
2430
  type: z.literal("scalar.function"),
2288
- author: z.string().describe("The author of the scalar function."),
2289
- id: z.string().describe("The unique identifier of the scalar function."),
2290
- version: z.uint32().describe("The version of the scalar function."),
2291
2431
  description: z
2292
2432
  .string()
2293
2433
  .describe("The description of the scalar function."),
@@ -2301,13 +2441,11 @@ export var Function;
2301
2441
  tasks: Function_1.TaskExpressionsSchema,
2302
2442
  output: ExpressionSchema.describe("An expression which evaluates to a single number. This is the output of the scalar function. Will be provided with the outputs of all tasks."),
2303
2443
  })
2304
- .describe("A scalar function.");
2444
+ .describe("A scalar function.")
2445
+ .meta({ title: "ScalarFunction" });
2305
2446
  Function_1.VectorSchema = z
2306
2447
  .object({
2307
2448
  type: z.literal("vector.function"),
2308
- author: z.string().describe("The author of the vector function."),
2309
- id: z.string().describe("The unique identifier of the vector function."),
2310
- version: z.uint32().describe("The version of the vector function."),
2311
2449
  description: z
2312
2450
  .string()
2313
2451
  .describe("The description of the vector function."),
@@ -2327,12 +2465,14 @@ export var Function;
2327
2465
  ])
2328
2466
  .describe("The length of the output vector."),
2329
2467
  })
2330
- .describe("A vector function.");
2468
+ .describe("A vector function.")
2469
+ .meta({ title: "VectorFunction" });
2331
2470
  let Executions;
2332
2471
  (function (Executions) {
2333
2472
  let Request;
2334
2473
  (function (Request) {
2335
- Request.FunctionExecutionParamsBaseSchema = z
2474
+ // Remote Function Remote Profile
2475
+ Request.FunctionExecutionParamsRemoteFunctionRemoteProfileBaseSchema = z
2336
2476
  .object({
2337
2477
  retry_token: z
2338
2478
  .string()
@@ -2346,197 +2486,104 @@ export var Function;
2346
2486
  first_chunk_timeout: Chat.Completions.Request.FirstChunkTimeoutSchema.optional().nullable(),
2347
2487
  other_chunk_timeout: Chat.Completions.Request.OtherChunkTimeoutSchema.optional().nullable(),
2348
2488
  })
2349
- .describe("Base parameters for executing a function.");
2350
- // Execute Inline Function
2351
- Request.FunctionExecutionParamsExecuteInlineBaseSchema = Request.FunctionExecutionParamsBaseSchema.extend({
2352
- function: FunctionSchema,
2353
- profile: Function_1.FunctionProfileVersionOptionalSchema,
2354
- }).describe("Base parameters for executing an inline function.");
2355
- Request.FunctionExecutionParamsExecuteInlineStreamingSchema = Request.FunctionExecutionParamsExecuteInlineBaseSchema.extend({
2489
+ .describe("Base parameters for executing a remote function with a remote profile.");
2490
+ Request.FunctionExecutionParamsRemoteFunctionRemoteProfileStreamingSchema = Request.FunctionExecutionParamsRemoteFunctionRemoteProfileBaseSchema.extend({
2356
2491
  stream: Chat.Completions.Request.StreamTrueSchema,
2357
- }).describe("Parameters for executing an inline function and streaming the response.");
2358
- Request.FunctionExecutionParamsExecuteInlineNonStreamingSchema = Request.FunctionExecutionParamsExecuteInlineBaseSchema.extend({
2359
- stream: Chat.Completions.Request.StreamFalseSchema.optional().nullable(),
2360
- }).describe("Parameters for executing an inline function with a unary response.");
2361
- Request.FunctionExecutionParamsExecuteInlineSchema = z
2362
- .union([
2363
- Request.FunctionExecutionParamsExecuteInlineStreamingSchema,
2364
- Request.FunctionExecutionParamsExecuteInlineNonStreamingSchema,
2365
- ])
2366
- .describe("Parameters for executing an inline function.");
2367
- // Execute Published Function
2368
- Request.FunctionExecutionParamsExecuteBaseSchema = Request.FunctionExecutionParamsBaseSchema.extend({
2369
- profile: Function_1.FunctionProfileVersionOptionalSchema.optional().nullable(),
2370
- }).describe("Base parameters for executing a remote published function.");
2371
- Request.FunctionExecutionParamsExecuteStreamingSchema = Request.FunctionExecutionParamsExecuteBaseSchema.extend({
2372
- stream: Chat.Completions.Request.StreamTrueSchema,
2373
- }).describe("Parameters for executing a remote published function and streaming the response.");
2374
- Request.FunctionExecutionParamsExecuteNonStreamingSchema = Request.FunctionExecutionParamsExecuteBaseSchema.extend({
2492
+ })
2493
+ .describe("Parameters for executing a remote function with a remote profile and streaming the response.")
2494
+ .meta({
2495
+ title: "FunctionExecutionParamsRemoteFunctionRemoteProfileStreaming",
2496
+ });
2497
+ Request.FunctionExecutionParamsRemoteFunctionRemoteProfileNonStreamingSchema = Request.FunctionExecutionParamsRemoteFunctionRemoteProfileBaseSchema.extend({
2375
2498
  stream: Chat.Completions.Request.StreamFalseSchema.optional().nullable(),
2376
- }).describe("Parameters for executing a remote published function with a unary response.");
2377
- Request.FunctionExecutionParamsExecuteSchema = z
2499
+ })
2500
+ .describe("Parameters for executing a remote function with a remote profile with a unary response.")
2501
+ .meta({
2502
+ title: "FunctionExecutionParamsRemoteFunctionRemoteProfileNonStreaming",
2503
+ });
2504
+ Request.FunctionExecutionParamsRemoteFunctionRemoteProfileSchema = z
2378
2505
  .union([
2379
- Request.FunctionExecutionParamsExecuteStreamingSchema,
2380
- Request.FunctionExecutionParamsExecuteNonStreamingSchema,
2506
+ Request.FunctionExecutionParamsRemoteFunctionRemoteProfileStreamingSchema,
2507
+ Request.FunctionExecutionParamsRemoteFunctionRemoteProfileNonStreamingSchema,
2381
2508
  ])
2382
- .describe("Parameters for executing a remote published function.");
2383
- // Publish Scalar Function
2384
- Request.FunctionExecutionParamsPublishScalarFunctionBaseSchema = Request.FunctionExecutionParamsBaseSchema.extend({
2385
- function: Function_1.ScalarSchema,
2386
- publish_function: z
2387
- .object({
2388
- description: z
2389
- .string()
2390
- .describe("The description of the published scalar function."),
2391
- changelog: z
2392
- .string()
2393
- .optional()
2394
- .nullable()
2395
- .describe("When present, describes changes from the previous version or versions."),
2396
- input_schema: Function_1.InputSchemaSchema,
2397
- })
2398
- .describe("Details about the scalar function to be published."),
2399
- profile: Function_1.FunctionProfileVersionRequiredSchema,
2400
- publish_profile: z
2401
- .object({
2402
- id: z
2403
- .literal("default")
2404
- .describe('The identifier of the profile to publish. Must be "default" when publishing a function.'),
2405
- version: z
2406
- .uint32()
2407
- .describe("The version of the profile to publish. Must match the function's version."),
2408
- description: z
2409
- .string()
2410
- .describe("The description of the published profile."),
2411
- changelog: z
2412
- .string()
2413
- .optional()
2414
- .nullable()
2415
- .describe("When present, describes changes from the previous version or versions."),
2416
- })
2417
- .describe("Details about the profile to be published."),
2418
- }).describe("Base parameters for executing and publishing an inline scalar function.");
2419
- Request.FunctionExecutionParamsPublishScalarFunctionStreamingSchema = Request.FunctionExecutionParamsPublishScalarFunctionBaseSchema.extend({
2509
+ .describe("Parameters for executing a remote function with a remote profile.")
2510
+ .meta({ title: "FunctionExecutionParamsRemoteFunctionRemoteProfile" });
2511
+ // Remote Function Inline Profile
2512
+ Request.FunctionExecutionParamsRemoteFunctionInlineProfileBaseSchema = Request.FunctionExecutionParamsRemoteFunctionRemoteProfileBaseSchema.extend({
2513
+ profile: Function_1.FunctionProfileCommitOptionalSchema,
2514
+ }).describe("Base parameters for executing a remote function with an inline profile.");
2515
+ Request.FunctionExecutionParamsRemoteFunctionInlineProfileStreamingSchema = Request.FunctionExecutionParamsRemoteFunctionInlineProfileBaseSchema.extend({
2420
2516
  stream: Chat.Completions.Request.StreamTrueSchema,
2421
- }).describe("Parameters for executing and publishing an inline scalar function and streaming the response.");
2422
- Request.FunctionExecutionParamsPublishScalarFunctionNonStreamingSchema = Request.FunctionExecutionParamsPublishScalarFunctionBaseSchema.extend({
2517
+ })
2518
+ .describe("Parameters for executing a remote function with an inline profile and streaming the response.")
2519
+ .meta({
2520
+ title: "FunctionExecutionParamsRemoteFunctionInlineProfileStreaming",
2521
+ });
2522
+ Request.FunctionExecutionParamsRemoteFunctionInlineProfileNonStreamingSchema = Request.FunctionExecutionParamsRemoteFunctionInlineProfileBaseSchema.extend({
2423
2523
  stream: Chat.Completions.Request.StreamFalseSchema.optional().nullable(),
2424
- }).describe("Parameters for executing and publishing an inline scalar function with a unary response.");
2425
- Request.FunctionExecutionParamsPublishScalarFunctionSchema = z
2524
+ })
2525
+ .describe("Parameters for executing a remote function with an inline profile with a unary response.")
2526
+ .meta({
2527
+ title: "FunctionExecutionParamsRemoteFunctionInlineProfileNonStreaming",
2528
+ });
2529
+ Request.FunctionExecutionParamsRemoteFunctionInlineProfileSchema = z
2426
2530
  .union([
2427
- Request.FunctionExecutionParamsPublishScalarFunctionStreamingSchema,
2428
- Request.FunctionExecutionParamsPublishScalarFunctionNonStreamingSchema,
2531
+ Request.FunctionExecutionParamsRemoteFunctionInlineProfileStreamingSchema,
2532
+ Request.FunctionExecutionParamsRemoteFunctionInlineProfileNonStreamingSchema,
2429
2533
  ])
2430
- .describe("Parameters for executing and publishing an inline scalar function.");
2431
- // Publish Vector Function
2432
- Request.FunctionExecutionParamsPublishVectorFunctionBaseSchema = Request.FunctionExecutionParamsBaseSchema.extend({
2433
- function: Function_1.VectorSchema,
2434
- publish_function: z
2435
- .object({
2436
- description: z
2437
- .string()
2438
- .describe("The description of the published vector function."),
2439
- changelog: z
2440
- .string()
2441
- .optional()
2442
- .nullable()
2443
- .describe("When present, describes changes from the previous version or versions."),
2444
- input_schema: Function_1.InputSchemaSchema,
2445
- output_length: z
2446
- .union([
2447
- z.uint32().describe("The fixed length of the output vector."),
2448
- ExpressionSchema.describe("An expression which evaluates to the length of the output vector. Will only be provided with the function input. The output length must be determinable from the input alone."),
2449
- ])
2450
- .describe("The length of the output vector."),
2451
- })
2452
- .describe("Details about the vector function to be published."),
2453
- profile: Function_1.FunctionProfileVersionRequiredSchema,
2454
- publish_profile: z
2455
- .object({
2456
- id: z
2457
- .literal("default")
2458
- .describe('The identifier of the profile to publish. Must be "default" when publishing a function.'),
2459
- version: z
2460
- .uint32()
2461
- .describe("The version of the profile to publish. Must match the function's version."),
2462
- description: z
2463
- .string()
2464
- .describe("The description of the published profile."),
2465
- changelog: z
2466
- .string()
2467
- .optional()
2468
- .nullable()
2469
- .describe("When present, describes changes from the previous version or versions."),
2470
- })
2471
- .describe("Details about the profile to be published."),
2472
- }).describe("Base parameters for executing and publishing an inline vector function.");
2473
- Request.FunctionExecutionParamsPublishVectorFunctionStreamingSchema = Request.FunctionExecutionParamsPublishVectorFunctionBaseSchema.extend({
2534
+ .describe("Parameters for executing a remote function with an inline profile.")
2535
+ .meta({ title: "FunctionExecutionParamsRemoteFunctionInlineProfile" });
2536
+ // Inline Function Remote Profile
2537
+ Request.FunctionExecutionParamsInlineFunctionRemoteProfileBaseSchema = Request.FunctionExecutionParamsRemoteFunctionRemoteProfileBaseSchema.extend({
2538
+ function: z.lazy(() => FunctionSchema),
2539
+ }).describe("Base parameters for executing an inline function with a remote profile.");
2540
+ Request.FunctionExecutionParamsInlineFunctionRemoteProfileStreamingSchema = Request.FunctionExecutionParamsInlineFunctionRemoteProfileBaseSchema.extend({
2474
2541
  stream: Chat.Completions.Request.StreamTrueSchema,
2475
- }).describe("Parameters for executing and publishing an inline vector function and streaming the response.");
2476
- Request.FunctionExecutionParamsPublishVectorFunctionNonStreamingSchema = Request.FunctionExecutionParamsPublishVectorFunctionBaseSchema.extend({
2542
+ })
2543
+ .describe("Parameters for executing an inline function with a remote profile and streaming the response.")
2544
+ .meta({
2545
+ title: "FunctionExecutionParamsInlineFunctionRemoteProfileStreaming",
2546
+ });
2547
+ Request.FunctionExecutionParamsInlineFunctionRemoteProfileNonStreamingSchema = Request.FunctionExecutionParamsInlineFunctionRemoteProfileBaseSchema.extend({
2477
2548
  stream: Chat.Completions.Request.StreamFalseSchema.optional().nullable(),
2478
- }).describe("Parameters for executing and publishing an inline vector function with a unary response.");
2479
- Request.FunctionExecutionParamsPublishVectorFunctionSchema = z
2480
- .union([
2481
- Request.FunctionExecutionParamsPublishVectorFunctionStreamingSchema,
2482
- Request.FunctionExecutionParamsPublishVectorFunctionNonStreamingSchema,
2483
- ])
2484
- .describe("Parameters for executing and publishing an inline vector function.");
2485
- // Publish Function
2486
- Request.FunctionExecutionParamsPublishFunctionStreamingSchema = z
2487
- .union([
2488
- Request.FunctionExecutionParamsPublishScalarFunctionStreamingSchema,
2489
- Request.FunctionExecutionParamsPublishVectorFunctionStreamingSchema,
2490
- ])
2491
- .describe("Parameters for executing and publishing an inline function and streaming the response.");
2492
- Request.FunctionExecutionParamsPublishFunctionNonStreamingSchema = z
2493
- .union([
2494
- Request.FunctionExecutionParamsPublishScalarFunctionNonStreamingSchema,
2495
- Request.FunctionExecutionParamsPublishVectorFunctionNonStreamingSchema,
2496
- ])
2497
- .describe("Parameters for executing and publishing an inline function with a unary response.");
2498
- Request.FunctionExecutionParamsPublishFunctionSchema = z
2549
+ })
2550
+ .describe("Parameters for executing an inline function with a remote profile with a unary response.")
2551
+ .meta({
2552
+ title: "FunctionExecutionParamsInlineFunctionRemoteProfileNonStreaming",
2553
+ });
2554
+ Request.FunctionExecutionParamsInlineFunctionRemoteProfileSchema = z
2499
2555
  .union([
2500
- Request.FunctionExecutionParamsPublishScalarFunctionSchema,
2501
- Request.FunctionExecutionParamsPublishVectorFunctionSchema,
2502
- ])
2503
- .describe("Parameters for executing and publishing an inline function.");
2504
- // Publish Profile
2505
- Request.FunctionExecutionParamsPublishProfileBaseSchema = Request.FunctionExecutionParamsBaseSchema.extend({
2506
- profile: z
2507
- .array(Function_1.ProfileVersionRequiredSchema)
2508
- .describe("The profile to publish."),
2509
- publish_profile: z
2510
- .object({
2511
- id: z
2512
- .string()
2513
- .describe("The unique identifier of the profile to publish."),
2514
- version: z
2515
- .uint32()
2516
- .describe("The version of the profile to publish."),
2517
- description: z
2518
- .string()
2519
- .describe("The description of the published profile."),
2520
- changelog: z
2521
- .string()
2522
- .optional()
2523
- .nullable()
2524
- .describe("When present, describes changes from the previous version or versions."),
2525
- })
2526
- .describe("Details about the profile to be published."),
2527
- }).describe("Base parameters for executing a remote published function and publishing a profile.");
2528
- Request.FunctionExecutionParamsPublishProfileStreamingSchema = Request.FunctionExecutionParamsPublishProfileBaseSchema.extend({
2556
+ Request.FunctionExecutionParamsInlineFunctionRemoteProfileStreamingSchema,
2557
+ Request.FunctionExecutionParamsInlineFunctionRemoteProfileNonStreamingSchema,
2558
+ ])
2559
+ .describe("Parameters for executing an inline function with a remote profile.")
2560
+ .meta({ title: "FunctionExecutionParamsInlineFunctionRemoteProfile" });
2561
+ // Inline Function Inline Profile
2562
+ Request.FunctionExecutionParamsInlineFunctionInlineProfileBaseSchema = Request.FunctionExecutionParamsRemoteFunctionRemoteProfileBaseSchema.extend({
2563
+ function: z.lazy(() => FunctionSchema),
2564
+ profile: Function_1.FunctionProfileCommitOptionalSchema,
2565
+ }).describe("Base parameters for executing an inline function with an inline profile.");
2566
+ Request.FunctionExecutionParamsInlineFunctionInlineProfileStreamingSchema = Request.FunctionExecutionParamsInlineFunctionInlineProfileBaseSchema.extend({
2529
2567
  stream: Chat.Completions.Request.StreamTrueSchema,
2530
- }).describe("Parameters for executing a remote published function, publishing a profile, and streaming the response.");
2531
- Request.FunctionExecutionParamsPublishProfileNonStreamingSchema = Request.FunctionExecutionParamsPublishProfileBaseSchema.extend({
2568
+ })
2569
+ .describe("Parameters for executing an inline function with an inline profile and streaming the response.")
2570
+ .meta({
2571
+ title: "FunctionExecutionParamsInlineFunctionInlineProfileStreaming",
2572
+ });
2573
+ Request.FunctionExecutionParamsInlineFunctionInlineProfileNonStreamingSchema = Request.FunctionExecutionParamsInlineFunctionInlineProfileBaseSchema.extend({
2532
2574
  stream: Chat.Completions.Request.StreamFalseSchema.optional().nullable(),
2533
- }).describe("Parameters for executing a remote published function and publishing a profile with a unary response.");
2534
- Request.FunctionExecutionParamsPublishProfileSchema = z
2575
+ })
2576
+ .describe("Parameters for executing an inline function with an inline profile with a unary response.")
2577
+ .meta({
2578
+ title: "FunctionExecutionParamsInlineFunctionInlineProfileNonStreaming",
2579
+ });
2580
+ Request.FunctionExecutionParamsInlineFunctionInlineProfileSchema = z
2535
2581
  .union([
2536
- Request.FunctionExecutionParamsPublishProfileStreamingSchema,
2537
- Request.FunctionExecutionParamsPublishProfileNonStreamingSchema,
2582
+ Request.FunctionExecutionParamsInlineFunctionInlineProfileStreamingSchema,
2583
+ Request.FunctionExecutionParamsInlineFunctionInlineProfileNonStreamingSchema,
2538
2584
  ])
2539
- .describe("Parameters for executing a remote published function and publishing a profile.");
2585
+ .describe("Parameters for executing an inline function with an inline profile.")
2586
+ .meta({ title: "FunctionExecutionParamsInlineFunctionInlineProfile" });
2540
2587
  })(Request = Executions.Request || (Executions.Request = {}));
2541
2588
  let Response;
2542
2589
  (function (Response) {
@@ -2554,9 +2601,6 @@ export var Function;
2554
2601
  })(Task = Response.Task || (Response.Task = {}));
2555
2602
  let Streaming;
2556
2603
  (function (Streaming) {
2557
- Streaming.TaskChunkSchema = z
2558
- .union([TaskChunk.FunctionSchema, TaskChunk.VectorCompletionSchema])
2559
- .describe("A chunk of a task execution.");
2560
2604
  let TaskChunk;
2561
2605
  (function (TaskChunk) {
2562
2606
  function merged(a, b) {
@@ -2593,13 +2637,6 @@ export var Function;
2593
2637
  return merged ? [merged, true] : [a, false];
2594
2638
  }
2595
2639
  TaskChunk.mergedList = mergedList;
2596
- TaskChunk.FunctionSchema = z
2597
- .lazy(() => Streaming.FunctionExecutionChunkSchema.extend({
2598
- index: Task.IndexSchema,
2599
- task_index: Task.TaskIndexSchema,
2600
- task_path: Task.TaskPathSchema,
2601
- }))
2602
- .describe("A chunk of a function execution task.");
2603
2640
  let Function;
2604
2641
  (function (Function) {
2605
2642
  function merged(a, b) {
@@ -2621,12 +2658,20 @@ export var Function;
2621
2658
  }
2622
2659
  Function.merged = merged;
2623
2660
  })(Function = TaskChunk.Function || (TaskChunk.Function = {}));
2624
- TaskChunk.VectorCompletionSchema = Vector.Completions.Response.Streaming.VectorCompletionChunkSchema.extend({
2661
+ TaskChunk.FunctionSchema = z
2662
+ .lazy(() => Streaming.FunctionExecutionChunkSchema.extend({
2625
2663
  index: Task.IndexSchema,
2626
2664
  task_index: Task.TaskIndexSchema,
2627
2665
  task_path: Task.TaskPathSchema,
2628
- error: ObjectiveAIErrorSchema.optional().describe("When present, indicates that an error occurred during the vector completion task."),
2629
- }).describe("A chunk of a vector completion task.");
2666
+ tasks: z
2667
+ .array(Streaming.TaskChunkSchema)
2668
+ .meta({
2669
+ title: "TaskChunkArray",
2670
+ recursive: true,
2671
+ })
2672
+ .describe("The tasks executed as part of the function execution."),
2673
+ }))
2674
+ .describe("A chunk of a function execution task.");
2630
2675
  let VectorCompletion;
2631
2676
  (function (VectorCompletion) {
2632
2677
  function merged(a, b) {
@@ -2649,7 +2694,57 @@ export var Function;
2649
2694
  }
2650
2695
  VectorCompletion.merged = merged;
2651
2696
  })(VectorCompletion = TaskChunk.VectorCompletion || (TaskChunk.VectorCompletion = {}));
2697
+ TaskChunk.VectorCompletionSchema = Vector.Completions.Response.Streaming.VectorCompletionChunkSchema.extend({
2698
+ index: Task.IndexSchema,
2699
+ task_index: Task.TaskIndexSchema,
2700
+ task_path: Task.TaskPathSchema,
2701
+ error: ObjectiveAIErrorSchema.optional().describe("When present, indicates that an error occurred during the vector completion task."),
2702
+ }).describe("A chunk of a vector completion task.");
2652
2703
  })(TaskChunk = Streaming.TaskChunk || (Streaming.TaskChunk = {}));
2704
+ Streaming.TaskChunkSchema = z
2705
+ .union([TaskChunk.FunctionSchema, TaskChunk.VectorCompletionSchema])
2706
+ .describe("A chunk of a task execution.");
2707
+ let FunctionExecutionChunk;
2708
+ (function (FunctionExecutionChunk) {
2709
+ function merged(a, b) {
2710
+ const id = a.id;
2711
+ const [tasks, tasksChanged] = TaskChunk.mergedList(a.tasks, b.tasks);
2712
+ const [tasks_errors, tasks_errorsChanged] = merge(a.tasks_errors, b.tasks_errors);
2713
+ const [output, outputChanged] = merge(a.output, b.output);
2714
+ const [error, errorChanged] = merge(a.error, b.error);
2715
+ const [retry_token, retry_tokenChanged] = merge(a.retry_token, b.retry_token);
2716
+ const [function_published, function_publishedChanged] = merge(a.function_published, b.function_published);
2717
+ const [profile_published, profile_publishedChanged] = merge(a.profile_published, b.profile_published);
2718
+ const created = a.created;
2719
+ const function_ = a.function;
2720
+ const profile = a.profile;
2721
+ const object = a.object;
2722
+ const [usage, usageChanged] = merge(a.usage, b.usage);
2723
+ if (tasksChanged ||
2724
+ tasks_errorsChanged ||
2725
+ outputChanged ||
2726
+ errorChanged ||
2727
+ retry_tokenChanged ||
2728
+ function_publishedChanged ||
2729
+ profile_publishedChanged ||
2730
+ usageChanged) {
2731
+ return [
2732
+ Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ id,
2733
+ tasks }, (tasks_errors !== undefined ? { tasks_errors } : {})), (output !== undefined ? { output } : {})), (error !== undefined ? { error } : {})), (retry_token !== undefined ? { retry_token } : {})), (function_published !== undefined
2734
+ ? { function_published }
2735
+ : {})), (profile_published !== undefined
2736
+ ? { profile_published }
2737
+ : {})), { created, function: function_, profile,
2738
+ object }), (usage !== undefined ? { usage } : {})),
2739
+ true,
2740
+ ];
2741
+ }
2742
+ else {
2743
+ return [a, false];
2744
+ }
2745
+ }
2746
+ FunctionExecutionChunk.merged = merged;
2747
+ })(FunctionExecutionChunk = Streaming.FunctionExecutionChunk || (Streaming.FunctionExecutionChunk = {}));
2653
2748
  Streaming.FunctionExecutionChunkSchema = z
2654
2749
  .object({
2655
2750
  id: z
@@ -2707,53 +2802,9 @@ export var Function;
2707
2802
  usage: Vector.Completions.Response.UsageSchema.optional(),
2708
2803
  })
2709
2804
  .describe("A chunk of a function execution.");
2710
- let FunctionExecutionChunk;
2711
- (function (FunctionExecutionChunk) {
2712
- function merged(a, b) {
2713
- const id = a.id;
2714
- const [tasks, tasksChanged] = TaskChunk.mergedList(a.tasks, b.tasks);
2715
- const [tasks_errors, tasks_errorsChanged] = merge(a.tasks_errors, b.tasks_errors);
2716
- const [output, outputChanged] = merge(a.output, b.output);
2717
- const [error, errorChanged] = merge(a.error, b.error);
2718
- const [retry_token, retry_tokenChanged] = merge(a.retry_token, b.retry_token);
2719
- const [function_published, function_publishedChanged] = merge(a.function_published, b.function_published);
2720
- const [profile_published, profile_publishedChanged] = merge(a.profile_published, b.profile_published);
2721
- const created = a.created;
2722
- const function_ = a.function;
2723
- const profile = a.profile;
2724
- const object = a.object;
2725
- const [usage, usageChanged] = merge(a.usage, b.usage);
2726
- if (tasksChanged ||
2727
- tasks_errorsChanged ||
2728
- outputChanged ||
2729
- errorChanged ||
2730
- retry_tokenChanged ||
2731
- function_publishedChanged ||
2732
- profile_publishedChanged ||
2733
- usageChanged) {
2734
- return [
2735
- Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ id,
2736
- tasks }, (tasks_errors !== undefined ? { tasks_errors } : {})), (output !== undefined ? { output } : {})), (error !== undefined ? { error } : {})), (retry_token !== undefined ? { retry_token } : {})), (function_published !== undefined
2737
- ? { function_published }
2738
- : {})), (profile_published !== undefined
2739
- ? { profile_published }
2740
- : {})), { created, function: function_, profile,
2741
- object }), (usage !== undefined ? { usage } : {})),
2742
- true,
2743
- ];
2744
- }
2745
- else {
2746
- return [a, false];
2747
- }
2748
- }
2749
- FunctionExecutionChunk.merged = merged;
2750
- })(FunctionExecutionChunk = Streaming.FunctionExecutionChunk || (Streaming.FunctionExecutionChunk = {}));
2751
2805
  })(Streaming = Response.Streaming || (Response.Streaming = {}));
2752
2806
  let Unary;
2753
2807
  (function (Unary) {
2754
- Unary.TaskSchema = z
2755
- .union([Task.FunctionSchema, Task.VectorCompletionSchema])
2756
- .describe("A task execution.");
2757
2808
  let Task;
2758
2809
  (function (Task) {
2759
2810
  Task.FunctionSchema = z
@@ -2761,8 +2812,15 @@ export var Function;
2761
2812
  index: Response.Task.IndexSchema,
2762
2813
  task_index: Response.Task.TaskIndexSchema,
2763
2814
  task_path: Response.Task.TaskPathSchema,
2815
+ tasks: z
2816
+ .array(Unary.TaskSchema)
2817
+ .meta({
2818
+ title: "TaskArray",
2819
+ recursive: true,
2820
+ })
2821
+ .describe("The tasks executed as part of the function execution."),
2764
2822
  }))
2765
- .describe("A chunk of a function execution task.");
2823
+ .describe("A function execution task.");
2766
2824
  Task.VectorCompletionSchema = Vector.Completions.Response.Unary.VectorCompletionSchema.extend({
2767
2825
  index: Response.Task.IndexSchema,
2768
2826
  task_index: Response.Task.TaskIndexSchema,
@@ -2770,6 +2828,9 @@ export var Function;
2770
2828
  error: ObjectiveAIErrorSchema.nullable().describe("When non-null, indicates that an error occurred during the vector completion task."),
2771
2829
  }).describe("A vector completion task.");
2772
2830
  })(Task = Unary.Task || (Unary.Task = {}));
2831
+ Unary.TaskSchema = z
2832
+ .union([Task.FunctionSchema, Task.VectorCompletionSchema])
2833
+ .describe("A task execution.");
2773
2834
  Unary.FunctionExecutionSchema = z
2774
2835
  .object({
2775
2836
  id: z
@@ -2829,21 +2890,8 @@ export var Function;
2829
2890
  (function (ComputeProfile) {
2830
2891
  let Request;
2831
2892
  (function (Request) {
2832
- Request.DatasetItemSchema = z
2833
- .object({
2834
- input: Function_1.InputSchema_,
2835
- target: DatasetItem.TargetSchema,
2836
- })
2837
- .describe("A Function input and its corresponding target output.");
2838
2893
  let DatasetItem;
2839
2894
  (function (DatasetItem) {
2840
- DatasetItem.TargetSchema = z
2841
- .union([
2842
- Target.ScalarSchema,
2843
- Target.VectorSchema,
2844
- Target.VectorWinnerSchema,
2845
- ])
2846
- .describe("The target output for a given function input.");
2847
2895
  let Target;
2848
2896
  (function (Target) {
2849
2897
  Target.ScalarSchema = z
@@ -2865,7 +2913,20 @@ export var Function;
2865
2913
  })
2866
2914
  .describe("A vector winner target output. The desired output is a vector where the highest value is at the specified index.");
2867
2915
  })(Target = DatasetItem.Target || (DatasetItem.Target = {}));
2916
+ DatasetItem.TargetSchema = z
2917
+ .discriminatedUnion("type", [
2918
+ Target.ScalarSchema,
2919
+ Target.VectorSchema,
2920
+ Target.VectorWinnerSchema,
2921
+ ])
2922
+ .describe("The target output for a given function input.");
2868
2923
  })(DatasetItem = Request.DatasetItem || (Request.DatasetItem = {}));
2924
+ Request.DatasetItemSchema = z
2925
+ .object({
2926
+ input: Function_1.InputSchema_,
2927
+ target: DatasetItem.TargetSchema,
2928
+ })
2929
+ .describe("A Function input and its corresponding target output.");
2869
2930
  Request.FunctionComputeProfileParamsBaseSchema = z
2870
2931
  .object({
2871
2932
  retry_token: z
@@ -2894,16 +2955,21 @@ export var Function;
2894
2955
  .describe("Base parameters for computing a function profile.");
2895
2956
  Request.FunctionComputeProfileParamsStreamingSchema = Request.FunctionComputeProfileParamsBaseSchema.extend({
2896
2957
  stream: Chat.Completions.Request.StreamTrueSchema,
2897
- }).describe("Parameters for computing a function profile and streaming the response.");
2958
+ })
2959
+ .describe("Parameters for computing a function profile and streaming the response.")
2960
+ .meta({ title: "FunctionComputeProfileParamsStreaming" });
2898
2961
  Request.FunctionComputeProfileParamsNonStreamingSchema = Request.FunctionComputeProfileParamsBaseSchema.extend({
2899
2962
  stream: Chat.Completions.Request.StreamFalseSchema.optional().nullable(),
2900
- }).describe("Parameters for computing a function profile with a unary response.");
2963
+ })
2964
+ .describe("Parameters for computing a function profile with a unary response.")
2965
+ .meta({ title: "FunctionComputeProfileParamsNonStreaming" });
2901
2966
  Request.FunctionComputeProfileParamsSchema = z
2902
2967
  .union([
2903
2968
  Request.FunctionComputeProfileParamsStreamingSchema,
2904
2969
  Request.FunctionComputeProfileParamsNonStreamingSchema,
2905
2970
  ])
2906
- .describe("Parameters for computing a function profile.");
2971
+ .describe("Parameters for computing a function profile.")
2972
+ .meta({ title: "FunctionComputeProfileParams" });
2907
2973
  })(Request = ComputeProfile.Request || (ComputeProfile.Request = {}));
2908
2974
  let Response;
2909
2975
  (function (Response) {
@@ -2928,20 +2994,6 @@ export var Function;
2928
2994
  .describe("Statistics about the fitting process used to compute the weights for the profile.");
2929
2995
  let Streaming;
2930
2996
  (function (Streaming) {
2931
- Streaming.FunctionExecutionChunkSchema = Executions.Response.Streaming.FunctionExecutionChunkSchema.extend({
2932
- index: z
2933
- .uint32()
2934
- .describe("The index of the function execution chunk in the list of executions."),
2935
- dataset: z
2936
- .uint32()
2937
- .describe("The index of the dataset item this function execution chunk corresponds to."),
2938
- n: z
2939
- .uint32()
2940
- .describe("The N index for this function execution chunk. There will be N function executions, and N comes from the request parameters."),
2941
- retry: z
2942
- .uint32()
2943
- .describe("The retry index for this function execution chunk. There may be multiple retries for a given dataset item and N index."),
2944
- }).describe("A chunk of a function execution ran during profile computation.");
2945
2997
  let FunctionExecutionChunk;
2946
2998
  (function (FunctionExecutionChunk) {
2947
2999
  function merged(a, b) {
@@ -2990,33 +3042,20 @@ export var Function;
2990
3042
  }
2991
3043
  FunctionExecutionChunk.mergedList = mergedList;
2992
3044
  })(FunctionExecutionChunk = Streaming.FunctionExecutionChunk || (Streaming.FunctionExecutionChunk = {}));
2993
- Streaming.FunctionComputeProfileChunkSchema = z
2994
- .object({
2995
- id: z
2996
- .string()
2997
- .describe("The unique identifier of the function profile computation chunk."),
2998
- executions: z
2999
- .array(Streaming.FunctionExecutionChunkSchema)
3000
- .describe("The function executions performed as part of computing the profile."),
3001
- executions_errors: z
3002
- .boolean()
3003
- .optional()
3004
- .describe("When true, indicates that one or more function executions encountered errors during profile computation."),
3005
- profile: z
3006
- .array(Function_1.ProfileVersionRequiredSchema)
3007
- .optional()
3008
- .describe("The computed function profile."),
3009
- fitting_stats: Response.FittingStatsSchema.optional(),
3010
- created: z
3045
+ Streaming.FunctionExecutionChunkSchema = Executions.Response.Streaming.FunctionExecutionChunkSchema.extend({
3046
+ index: z
3011
3047
  .uint32()
3012
- .describe("The UNIX timestamp (in seconds) when the function profile computation was created."),
3013
- function: z
3014
- .string()
3015
- .describe("The unique identifier of the function for which the profile is being computed."),
3016
- object: z.literal("function.compute.profile.chunk"),
3017
- usage: Vector.Completions.Response.UsageSchema.optional(),
3018
- })
3019
- .describe("A chunk of a function profile computation.");
3048
+ .describe("The index of the function execution chunk in the list of executions."),
3049
+ dataset: z
3050
+ .uint32()
3051
+ .describe("The index of the dataset item this function execution chunk corresponds to."),
3052
+ n: z
3053
+ .uint32()
3054
+ .describe("The N index for this function execution chunk. There will be N function executions, and N comes from the request parameters."),
3055
+ retry: z
3056
+ .uint32()
3057
+ .describe("The retry index for this function execution chunk. There may be multiple retries for a given dataset item and N index."),
3058
+ }).describe("A chunk of a function execution ran during profile computation.");
3020
3059
  let FunctionComputeProfileChunk;
3021
3060
  (function (FunctionComputeProfileChunk) {
3022
3061
  function merged(a, b) {
@@ -3048,6 +3087,33 @@ export var Function;
3048
3087
  }
3049
3088
  FunctionComputeProfileChunk.merged = merged;
3050
3089
  })(FunctionComputeProfileChunk = Streaming.FunctionComputeProfileChunk || (Streaming.FunctionComputeProfileChunk = {}));
3090
+ Streaming.FunctionComputeProfileChunkSchema = z
3091
+ .object({
3092
+ id: z
3093
+ .string()
3094
+ .describe("The unique identifier of the function profile computation chunk."),
3095
+ executions: z
3096
+ .array(Streaming.FunctionExecutionChunkSchema)
3097
+ .describe("The function executions performed as part of computing the profile."),
3098
+ executions_errors: z
3099
+ .boolean()
3100
+ .optional()
3101
+ .describe("When true, indicates that one or more function executions encountered errors during profile computation."),
3102
+ profile: z
3103
+ .array(Function_1.ProfileCommitRequiredSchema)
3104
+ .optional()
3105
+ .describe("The computed function profile."),
3106
+ fitting_stats: Response.FittingStatsSchema.optional(),
3107
+ created: z
3108
+ .uint32()
3109
+ .describe("The UNIX timestamp (in seconds) when the function profile computation was created."),
3110
+ function: z
3111
+ .string()
3112
+ .describe("The unique identifier of the function for which the profile is being computed."),
3113
+ object: z.literal("function.compute.profile.chunk"),
3114
+ usage: Vector.Completions.Response.UsageSchema.optional(),
3115
+ })
3116
+ .describe("A chunk of a function profile computation.");
3051
3117
  })(Streaming = Response.Streaming || (Response.Streaming = {}));
3052
3118
  let Unary;
3053
3119
  (function (Unary) {
@@ -3077,7 +3143,7 @@ export var Function;
3077
3143
  .boolean()
3078
3144
  .describe("When true, indicates that one or more function executions encountered errors during profile computation."),
3079
3145
  profile: z
3080
- .array(Function_1.ProfileVersionRequiredSchema)
3146
+ .array(Function_1.ProfileCommitRequiredSchema)
3081
3147
  .describe("The computed function profile."),
3082
3148
  fitting_stats: Response.FittingStatsSchema,
3083
3149
  created: z
@@ -3096,48 +3162,21 @@ export var Function;
3096
3162
  let Profile;
3097
3163
  (function (Profile) {
3098
3164
  Profile.ListItemSchema = z.object({
3099
- function_author: z
3165
+ owner: z
3166
+ .string()
3167
+ .describe("The owner of the GitHub repository containing the profile."),
3168
+ repository: z
3100
3169
  .string()
3101
- .describe("The author of the function the profile was published to."),
3102
- function_id: z
3170
+ .describe("The name of the GitHub repository containing the profile."),
3171
+ commit: z
3103
3172
  .string()
3104
- .describe("The unique identifier of the function the profile was published to."),
3105
- author: z.string().describe("The author of the profile."),
3106
- id: z.string().describe("The unique identifier of the profile."),
3107
- version: z.uint32().describe("The version of the profile."),
3173
+ .describe("The commit SHA of the GitHub repository containing the profile."),
3108
3174
  });
3109
3175
  async function list(openai, options) {
3110
3176
  const response = await openai.get("/functions/profiles", options);
3111
3177
  return response;
3112
3178
  }
3113
3179
  Profile.list = list;
3114
- Profile.RetrieveItemSchema = z.object({
3115
- created: z
3116
- .uint32()
3117
- .describe("The UNIX timestamp (in seconds) when the profile was created."),
3118
- shape: z
3119
- .string()
3120
- .describe("The shape of the profile. Unless Task Skip expressions work out favorably, profiles only work for functions with the same shape."),
3121
- function_author: z
3122
- .string()
3123
- .describe("The author of the function the profile was published to."),
3124
- function_id: z
3125
- .string()
3126
- .describe("The unique identifier of the function the profile was published to."),
3127
- author: z.string().describe("The author of the profile."),
3128
- id: z.string().describe("The unique identifier of the profile."),
3129
- version: z.uint32().describe("The version of the profile."),
3130
- profile: z
3131
- .array(Function.ProfileVersionRequiredSchema)
3132
- .describe("The function profile."),
3133
- });
3134
- async function retrieve(openai, function_author, function_id, author, id, version, options) {
3135
- const response = await openai.get(version !== null && version !== undefined
3136
- ? `/functions/${function_author}/${function_id}/profiles/${author}/${id}/${version}`
3137
- : `/functions/${function_author}/${function_id}/profiles/${author}/${id}`, options);
3138
- return response;
3139
- }
3140
- Profile.retrieve = retrieve;
3141
3180
  Profile.HistoricalUsageSchema = z.object({
3142
3181
  requests: z
3143
3182
  .uint32()
@@ -3152,85 +3191,102 @@ export var Function;
3152
3191
  .number()
3153
3192
  .describe("The total cost incurred by using this Profile."),
3154
3193
  });
3155
- async function retrieveUsage(openai, function_author, function_id, author, id, version, options) {
3156
- const response = await openai.get(version !== null && version !== undefined
3157
- ? `/functions/${function_author}/${function_id}/profiles/${author}/${id}/${version}/usage`
3158
- : `/functions/${function_author}/${function_id}/profiles/${author}/${id}/usage`, options);
3194
+ async function retrieveUsage(openai, powner, prepository, pcommit, options) {
3195
+ const response = await openai.get(pcommit !== null && pcommit !== undefined
3196
+ ? `/functions/profiles/${powner}/${prepository}/${pcommit}/usage`
3197
+ : `/functions/profiles/${powner}/${prepository}/usage`, options);
3159
3198
  return response;
3160
3199
  }
3161
3200
  Profile.retrieveUsage = retrieveUsage;
3162
3201
  })(Profile = Function_1.Profile || (Function_1.Profile = {}));
3163
- async function executeInline(openai, body, options) {
3202
+ async function executeInlineFunctionInlineProfile(openai, body, options) {
3164
3203
  var _a;
3165
3204
  const response = await openai.post("/functions", Object.assign({ body, stream: (_a = body.stream) !== null && _a !== void 0 ? _a : false }, options));
3166
3205
  return response;
3167
3206
  }
3168
- Function_1.executeInline = executeInline;
3169
- async function execute(openai, author, id, version, body, options) {
3207
+ Function_1.executeInlineFunctionInlineProfile = executeInlineFunctionInlineProfile;
3208
+ async function executeRemoteFunctionInlineProfile(openai, fowner, frepository, fcommit, body, options) {
3170
3209
  var _a;
3171
- const response = await openai.post(version !== null && version !== undefined
3172
- ? `/functions/${author}/${id}/${version}`
3173
- : `/functions/${author}/${id}`, Object.assign({ body, stream: (_a = body.stream) !== null && _a !== void 0 ? _a : false }, options));
3210
+ const response = await openai.post(fcommit !== null && fcommit !== undefined
3211
+ ? `/functions/${fowner}/${frepository}/${fcommit}`
3212
+ : `/functions/${fowner}/${frepository}`, Object.assign({ body, stream: (_a = body.stream) !== null && _a !== void 0 ? _a : false }, options));
3174
3213
  return response;
3175
3214
  }
3176
- Function_1.execute = execute;
3177
- async function publishFunction(openai, author, id, version, body, options) {
3215
+ Function_1.executeRemoteFunctionInlineProfile = executeRemoteFunctionInlineProfile;
3216
+ async function executeInlineFunctionRemoteProfile(openai, powner, prepository, pcommit, body, options) {
3178
3217
  var _a;
3179
- const response = await openai.post(`/functions/${author}/${id}/${version}/publish`, Object.assign({ body, stream: (_a = body.stream) !== null && _a !== void 0 ? _a : false }, options));
3218
+ const response = await openai.post(pcommit !== null && pcommit !== undefined
3219
+ ? `/functions/profiles/${powner}/${prepository}/${pcommit}`
3220
+ : `/functions/profiles/${powner}/${prepository}`, Object.assign({ body, stream: (_a = body.stream) !== null && _a !== void 0 ? _a : false }, options));
3180
3221
  return response;
3181
3222
  }
3182
- Function_1.publishFunction = publishFunction;
3183
- async function publishProfile(openai, function_author, function_id, body, options) {
3223
+ Function_1.executeInlineFunctionRemoteProfile = executeInlineFunctionRemoteProfile;
3224
+ async function executeRemoteFunctionRemoteProfile(openai, fowner, frepository, fcommit, powner, prepository, pcommit, body, options) {
3184
3225
  var _a;
3185
- const response = await openai.post(`/functions/${function_author}/${function_id}/profiles/publish`, Object.assign({ body, stream: (_a = body.stream) !== null && _a !== void 0 ? _a : false }, options));
3226
+ let url;
3227
+ if (fcommit !== null && fcommit !== undefined) {
3228
+ if (pcommit !== null && pcommit !== undefined) {
3229
+ url = `/functions/${fowner}/${frepository}/${fcommit}/profiles/${powner}/${prepository}/${pcommit}`;
3230
+ }
3231
+ else {
3232
+ url = `/functions/${fowner}/${frepository}/${fcommit}/profiles/${powner}/${prepository}`;
3233
+ }
3234
+ }
3235
+ else if (pcommit !== null && pcommit !== undefined) {
3236
+ url = `/functions/${fowner}/${frepository}/profiles/${powner}/${prepository}/${pcommit}`;
3237
+ }
3238
+ else {
3239
+ url = `/functions/${fowner}/${frepository}/profiles/${powner}/${prepository}`;
3240
+ }
3241
+ const response = await openai.post(url, Object.assign({ body, stream: (_a = body.stream) !== null && _a !== void 0 ? _a : false }, options));
3186
3242
  return response;
3187
3243
  }
3188
- Function_1.publishProfile = publishProfile;
3189
- async function computeProfile(openai, author, id, version, body, options) {
3244
+ Function_1.executeRemoteFunctionRemoteProfile = executeRemoteFunctionRemoteProfile;
3245
+ async function execute(openai, function_, profile, body, options) {
3246
+ if ("owner" in function_ && "repository" in function_) {
3247
+ if ("owner" in profile && "repository" in profile) {
3248
+ const requestBody = body;
3249
+ return executeRemoteFunctionRemoteProfile(openai, function_.owner, function_.repository, function_.commit, profile.owner, profile.repository, profile.commit, requestBody, options);
3250
+ }
3251
+ else {
3252
+ const requestBody = Object.assign(Object.assign({}, body), { profile });
3253
+ return executeRemoteFunctionInlineProfile(openai, function_.owner, function_.repository, function_.commit, requestBody, options);
3254
+ }
3255
+ }
3256
+ else if ("owner" in profile && "repository" in profile) {
3257
+ const requestBody = Object.assign(Object.assign({}, body), { function: function_ });
3258
+ return executeInlineFunctionRemoteProfile(openai, profile.owner, profile.repository, profile.commit, requestBody, options);
3259
+ }
3260
+ else {
3261
+ const requestBody = Object.assign(Object.assign({}, body), { function: function_, profile });
3262
+ return executeInlineFunctionInlineProfile(openai, requestBody, options);
3263
+ }
3264
+ }
3265
+ Function_1.execute = execute;
3266
+ async function computeProfile(openai, fowner, frepository, fcommit, body, options) {
3190
3267
  var _a;
3191
- const response = await openai.post(version !== null && version !== undefined
3192
- ? `/functions/${author}/${id}/${version}/profiles/compute`
3193
- : `/functions/${author}/${id}/profiles/compute`, Object.assign({ body, stream: (_a = body.stream) !== null && _a !== void 0 ? _a : false }, options));
3268
+ const response = await openai.post(fcommit !== null && fcommit !== undefined
3269
+ ? `/functions/${fowner}/${frepository}/${fcommit}/profiles/compute`
3270
+ : `/functions/${fowner}/${frepository}/profiles/compute`, Object.assign({ body, stream: (_a = body.stream) !== null && _a !== void 0 ? _a : false }, options));
3194
3271
  return response;
3195
3272
  }
3196
3273
  Function_1.computeProfile = computeProfile;
3197
3274
  Function_1.ListItemSchema = z.object({
3198
- author: z.string().describe("The author of the function."),
3199
- id: z.string().describe("The unique identifier of the function."),
3200
- version: z.uint32().describe("The version of the function."),
3275
+ owner: z
3276
+ .string()
3277
+ .describe("The owner of the GitHub repository containing the function."),
3278
+ repository: z
3279
+ .string()
3280
+ .describe("The name of the GitHub repository containing the function."),
3281
+ commit: z
3282
+ .string()
3283
+ .describe("The commit SHA of the GitHub repository containing the function."),
3201
3284
  });
3202
3285
  async function list(openai, options) {
3203
3286
  const response = await openai.get("/functions", options);
3204
3287
  return response;
3205
3288
  }
3206
3289
  Function_1.list = list;
3207
- Function_1.ScalarRetrieveItemSchema = Function_1.ScalarSchema.extend({
3208
- created: z
3209
- .uint32()
3210
- .describe("The UNIX timestamp (in seconds) when the function was created."),
3211
- shape: z
3212
- .string()
3213
- .describe("The shape of the function. Unless Task Skip expressions work out favorably, functions only work with profiles that have the same shape."),
3214
- });
3215
- Function_1.VectorRetrieveItemSchema = Function_1.VectorSchema.extend({
3216
- created: z
3217
- .uint32()
3218
- .describe("The UNIX timestamp (in seconds) when the function was created."),
3219
- shape: z
3220
- .string()
3221
- .describe("The shape of the function. Unless Task Skip expressions work out favorably, functions only work with profiles that have the same shape."),
3222
- });
3223
- Function_1.RetrieveItemSchema = z.discriminatedUnion("type", [
3224
- Function_1.ScalarRetrieveItemSchema,
3225
- Function_1.VectorRetrieveItemSchema,
3226
- ]);
3227
- async function retrieve(openai, author, id, version, options) {
3228
- const response = await openai.get(version !== null && version !== undefined
3229
- ? `/functions/${author}/${id}/${version}`
3230
- : `/functions/${author}/${id}`, options);
3231
- return response;
3232
- }
3233
- Function_1.retrieve = retrieve;
3234
3290
  Function_1.HistoricalUsageSchema = z.object({
3235
3291
  requests: z
3236
3292
  .uint32()
@@ -3245,14 +3301,17 @@ export var Function;
3245
3301
  .number()
3246
3302
  .describe("The total cost incurred by using this Function."),
3247
3303
  });
3248
- async function retrieveUsage(openai, author, id, version, options) {
3249
- const response = await openai.get(version !== null && version !== undefined
3250
- ? `/functions/${author}/${id}/${version}/usage`
3251
- : `/functions/${author}/${id}/usage`, options);
3304
+ async function retrieveUsage(openai, fowner, frepository, fcommit, options) {
3305
+ const response = await openai.get(fcommit !== null && fcommit !== undefined
3306
+ ? `/functions/${fowner}/${frepository}/${fcommit}/usage`
3307
+ : `/functions/${fowner}/${frepository}/usage`, options);
3252
3308
  return response;
3253
3309
  }
3254
3310
  Function_1.retrieveUsage = retrieveUsage;
3255
3311
  })(Function || (Function = {}));
3312
+ export const FunctionSchema = z
3313
+ .discriminatedUnion("type", [Function.ScalarSchema, Function.VectorSchema])
3314
+ .describe("A function.");
3256
3315
  export var Auth;
3257
3316
  (function (Auth) {
3258
3317
  Auth.ApiKeySchema = z.object({