objectiveai 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +993 -777
- package/dist/index.d.ts +3086 -3083
- package/dist/index.js +992 -776
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3,152 +3,121 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Auth = exports.
|
|
6
|
+
exports.Auth = exports.FunctionSchema = exports.Function = exports.Vector = exports.Chat = exports.Ensemble = exports.EnsembleSchema = exports.EnsembleBaseSchema = exports.EnsembleLlmWithFallbacksAndCountSchema = exports.EnsembleLlmSchema = exports.EnsembleLlmBaseWithFallbacksAndCountSchema = exports.EnsembleLlmBaseSchema = exports.EnsembleLlm = exports.VectorResponsesExpressionSchema = exports.VectorResponsesSchema = exports.VectorResponseExpressionSchema = exports.VectorResponseSchema = exports.ToolsExpressionSchema = exports.ToolsSchema = exports.ToolExpressionSchema = exports.ToolSchema = exports.Tool = exports.MessagesExpressionSchema = exports.MessagesSchema = exports.MessageExpressionSchema = exports.MessageSchema = exports.Message = exports.ObjectiveAIErrorSchema = exports.JsonValueExpressionSchema = exports.JsonValueSchema = exports.ExpressionSchema = void 0;
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
8
|
// Expressions
|
|
9
9
|
exports.ExpressionSchema = zod_1.default
|
|
10
10
|
.object({
|
|
11
11
|
$jmespath: zod_1.default.string().describe("A JMESPath expression."),
|
|
12
12
|
})
|
|
13
|
-
.describe("An expression which evaluates to a value.")
|
|
13
|
+
.describe("An expression which evaluates to a value.")
|
|
14
|
+
.meta({ title: "Expression" });
|
|
14
15
|
exports.JsonValueSchema = zod_1.default
|
|
15
16
|
.lazy(() => zod_1.default.union([
|
|
16
17
|
zod_1.default.null(),
|
|
17
18
|
zod_1.default.boolean(),
|
|
18
19
|
zod_1.default.number(),
|
|
19
20
|
zod_1.default.string(),
|
|
20
|
-
zod_1.default.array(exports.JsonValueSchema
|
|
21
|
-
|
|
21
|
+
zod_1.default.array(exports.JsonValueSchema.meta({
|
|
22
|
+
title: "JsonValue",
|
|
23
|
+
recursive: true,
|
|
24
|
+
})),
|
|
25
|
+
zod_1.default.record(zod_1.default.string(), exports.JsonValueSchema.meta({
|
|
26
|
+
title: "JsonValue",
|
|
27
|
+
recursive: true,
|
|
28
|
+
})),
|
|
22
29
|
]))
|
|
23
|
-
.describe("A JSON value.")
|
|
30
|
+
.describe("A JSON value.")
|
|
31
|
+
.meta({ title: "JsonValue" });
|
|
24
32
|
exports.JsonValueExpressionSchema = zod_1.default
|
|
25
33
|
.lazy(() => zod_1.default.union([
|
|
26
34
|
zod_1.default.null(),
|
|
27
35
|
zod_1.default.boolean(),
|
|
28
36
|
zod_1.default.number(),
|
|
29
37
|
zod_1.default.string(),
|
|
30
|
-
zod_1.default.array(exports.JsonValueExpressionSchema
|
|
31
|
-
|
|
38
|
+
zod_1.default.array(exports.JsonValueExpressionSchema.meta({
|
|
39
|
+
title: "JsonValueExpression",
|
|
40
|
+
recursive: true,
|
|
41
|
+
})),
|
|
42
|
+
zod_1.default.record(zod_1.default.string(), exports.JsonValueExpressionSchema.meta({
|
|
43
|
+
title: "JsonValueExpression",
|
|
44
|
+
recursive: true,
|
|
45
|
+
})),
|
|
32
46
|
exports.ExpressionSchema.describe("An expression which evaluates to a JSON value."),
|
|
33
47
|
]))
|
|
34
|
-
.describe(exports.JsonValueSchema.description)
|
|
48
|
+
.describe(exports.JsonValueSchema.description)
|
|
49
|
+
.meta({ title: "JsonValueExpression" });
|
|
35
50
|
// Errors
|
|
36
51
|
exports.ObjectiveAIErrorSchema = zod_1.default
|
|
37
52
|
.object({
|
|
38
53
|
code: zod_1.default.uint32().describe("The status code of the error."),
|
|
39
54
|
message: zod_1.default.any().describe("The message or details of the error."),
|
|
40
55
|
})
|
|
41
|
-
.describe("An error returned by the ObjectiveAI API.")
|
|
56
|
+
.describe("An error returned by the ObjectiveAI API.")
|
|
57
|
+
.meta({ title: "ObjectiveAIError" });
|
|
42
58
|
// Messages
|
|
43
|
-
exports.MessageSchema = zod_1.default
|
|
44
|
-
.discriminatedUnion("role", [
|
|
45
|
-
Message.DeveloperSchema,
|
|
46
|
-
Message.SystemSchema,
|
|
47
|
-
Message.UserSchema,
|
|
48
|
-
Message.ToolSchema,
|
|
49
|
-
Message.AssistantSchema,
|
|
50
|
-
])
|
|
51
|
-
.describe("A message exchanged in a chat conversation.");
|
|
52
|
-
exports.MessageExpressionSchema = zod_1.default
|
|
53
|
-
.union([
|
|
54
|
-
zod_1.default
|
|
55
|
-
.discriminatedUnion("role", [
|
|
56
|
-
Message.DeveloperExpressionSchema,
|
|
57
|
-
Message.SystemExpressionSchema,
|
|
58
|
-
Message.UserExpressionSchema,
|
|
59
|
-
Message.ToolExpressionSchema,
|
|
60
|
-
Message.AssistantExpressionSchema,
|
|
61
|
-
])
|
|
62
|
-
.describe(exports.MessageSchema.description),
|
|
63
|
-
exports.ExpressionSchema.describe("An expression which evaluates to a message."),
|
|
64
|
-
])
|
|
65
|
-
.describe(exports.MessageSchema.description);
|
|
66
59
|
var Message;
|
|
67
60
|
(function (Message) {
|
|
68
|
-
Message.SimpleContentPartSchema = zod_1.default
|
|
69
|
-
.object({
|
|
70
|
-
type: zod_1.default.literal("text"),
|
|
71
|
-
text: zod_1.default.string().describe("The text content."),
|
|
72
|
-
})
|
|
73
|
-
.describe("A simple text content part.");
|
|
74
|
-
Message.SimpleContentSchema = zod_1.default
|
|
75
|
-
.union([SimpleContent.TextSchema, SimpleContent.PartsSchema])
|
|
76
|
-
.describe("Simple content.");
|
|
77
|
-
Message.SimpleContentExpressionSchema = zod_1.default
|
|
78
|
-
.union([
|
|
79
|
-
SimpleContent.TextSchema,
|
|
80
|
-
SimpleContent.PartsExpressionSchema,
|
|
81
|
-
exports.ExpressionSchema.describe("An expression which evaluates to simple content."),
|
|
82
|
-
])
|
|
83
|
-
.describe(Message.SimpleContentSchema.description);
|
|
84
61
|
let SimpleContent;
|
|
85
62
|
(function (SimpleContent) {
|
|
86
|
-
SimpleContent.TextSchema = zod_1.default
|
|
63
|
+
SimpleContent.TextSchema = zod_1.default
|
|
64
|
+
.string()
|
|
65
|
+
.describe("Plain text content.")
|
|
66
|
+
.meta({ title: "SimpleContentText" });
|
|
87
67
|
SimpleContent.PartSchema = zod_1.default
|
|
88
68
|
.object({
|
|
89
69
|
type: zod_1.default.literal("text"),
|
|
90
70
|
text: zod_1.default.string().describe("The text content."),
|
|
91
71
|
})
|
|
92
|
-
.describe("A simple content part.")
|
|
72
|
+
.describe("A simple content part.")
|
|
73
|
+
.meta({ title: "SimpleContentPart" });
|
|
93
74
|
SimpleContent.PartExpressionSchema = zod_1.default
|
|
94
75
|
.union([
|
|
95
76
|
SimpleContent.PartSchema,
|
|
96
77
|
exports.ExpressionSchema.describe("An expression which evaluates to a simple content part."),
|
|
97
78
|
])
|
|
98
|
-
.describe(SimpleContent.PartSchema.description)
|
|
79
|
+
.describe(SimpleContent.PartSchema.description)
|
|
80
|
+
.meta({ title: "SimpleContentPartExpression" });
|
|
99
81
|
SimpleContent.PartsSchema = zod_1.default
|
|
100
82
|
.array(SimpleContent.PartSchema)
|
|
101
|
-
.describe("An array of simple content parts.")
|
|
83
|
+
.describe("An array of simple content parts.")
|
|
84
|
+
.meta({ title: "SimpleContentParts" });
|
|
102
85
|
SimpleContent.PartsExpressionSchema = zod_1.default
|
|
103
86
|
.array(SimpleContent.PartExpressionSchema)
|
|
104
|
-
.describe(SimpleContent.PartsSchema.description)
|
|
87
|
+
.describe(SimpleContent.PartsSchema.description)
|
|
88
|
+
.meta({ title: "SimpleContentPartExpressions" });
|
|
105
89
|
})(SimpleContent = Message.SimpleContent || (Message.SimpleContent = {}));
|
|
106
|
-
Message.
|
|
107
|
-
.union([
|
|
108
|
-
.describe("
|
|
109
|
-
|
|
90
|
+
Message.SimpleContentSchema = zod_1.default
|
|
91
|
+
.union([SimpleContent.TextSchema, SimpleContent.PartsSchema])
|
|
92
|
+
.describe("Simple content.")
|
|
93
|
+
.meta({ title: "SimpleContent" });
|
|
94
|
+
Message.SimpleContentExpressionSchema = zod_1.default
|
|
110
95
|
.union([
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
exports.ExpressionSchema.describe("An expression which evaluates to
|
|
96
|
+
SimpleContent.TextSchema,
|
|
97
|
+
SimpleContent.PartsExpressionSchema,
|
|
98
|
+
exports.ExpressionSchema.describe("An expression which evaluates to simple content."),
|
|
114
99
|
])
|
|
115
|
-
.describe(Message.
|
|
100
|
+
.describe(Message.SimpleContentSchema.description)
|
|
101
|
+
.meta({ title: "SimpleContentExpression" });
|
|
116
102
|
let RichContent;
|
|
117
103
|
(function (RichContent) {
|
|
118
|
-
RichContent.TextSchema = zod_1.default
|
|
119
|
-
|
|
120
|
-
.
|
|
121
|
-
|
|
122
|
-
Part.ImageUrlSchema,
|
|
123
|
-
Part.InputAudioSchema,
|
|
124
|
-
Part.VideoUrlSchema,
|
|
125
|
-
Part.FileSchema,
|
|
126
|
-
])
|
|
127
|
-
.describe("A rich content part.");
|
|
128
|
-
RichContent.PartExpressionSchema = zod_1.default
|
|
129
|
-
.union([
|
|
130
|
-
RichContent.PartSchema,
|
|
131
|
-
exports.ExpressionSchema.describe("An expression which evaluates to a rich content part."),
|
|
132
|
-
])
|
|
133
|
-
.describe(RichContent.PartSchema.description);
|
|
104
|
+
RichContent.TextSchema = zod_1.default
|
|
105
|
+
.string()
|
|
106
|
+
.describe("Plain text content.")
|
|
107
|
+
.meta({ title: "RichContentText" });
|
|
134
108
|
let Part;
|
|
135
109
|
(function (Part) {
|
|
136
|
-
Part.TextSchema = zod_1.default
|
|
137
|
-
.object({
|
|
138
|
-
type: zod_1.default.literal("text"),
|
|
139
|
-
text: Text.TextSchema,
|
|
140
|
-
})
|
|
141
|
-
.describe("A text rich content part.");
|
|
142
110
|
let Text;
|
|
143
111
|
(function (Text) {
|
|
144
112
|
Text.TextSchema = zod_1.default.string().describe("The text content.");
|
|
145
113
|
})(Text = Part.Text || (Part.Text = {}));
|
|
146
|
-
Part.
|
|
114
|
+
Part.TextSchema = zod_1.default
|
|
147
115
|
.object({
|
|
148
|
-
type: zod_1.default.literal("
|
|
149
|
-
|
|
116
|
+
type: zod_1.default.literal("text"),
|
|
117
|
+
text: Text.TextSchema,
|
|
150
118
|
})
|
|
151
|
-
.describe("
|
|
119
|
+
.describe("A text rich content part.")
|
|
120
|
+
.meta({ title: "TextRichContentPart" });
|
|
152
121
|
let ImageUrl;
|
|
153
122
|
(function (ImageUrl) {
|
|
154
123
|
ImageUrl.DetailSchema = zod_1.default
|
|
@@ -164,12 +133,13 @@ var Message;
|
|
|
164
133
|
})
|
|
165
134
|
.describe("The URL of the image and its optional detail level.");
|
|
166
135
|
})(ImageUrl = Part.ImageUrl || (Part.ImageUrl = {}));
|
|
167
|
-
Part.
|
|
136
|
+
Part.ImageUrlSchema = zod_1.default
|
|
168
137
|
.object({
|
|
169
|
-
type: zod_1.default.literal("
|
|
170
|
-
|
|
138
|
+
type: zod_1.default.literal("image_url"),
|
|
139
|
+
image_url: ImageUrl.DefinitionSchema,
|
|
171
140
|
})
|
|
172
|
-
.describe("An
|
|
141
|
+
.describe("An image rich content part.")
|
|
142
|
+
.meta({ title: "ImageRichContentPart" });
|
|
173
143
|
let InputAudio;
|
|
174
144
|
(function (InputAudio) {
|
|
175
145
|
InputAudio.FormatSchema = zod_1.default
|
|
@@ -185,12 +155,13 @@ var Message;
|
|
|
185
155
|
})
|
|
186
156
|
.describe("The audio data and its format.");
|
|
187
157
|
})(InputAudio = Part.InputAudio || (Part.InputAudio = {}));
|
|
188
|
-
Part.
|
|
158
|
+
Part.InputAudioSchema = zod_1.default
|
|
189
159
|
.object({
|
|
190
|
-
type: zod_1.default.
|
|
191
|
-
|
|
160
|
+
type: zod_1.default.literal("input_audio"),
|
|
161
|
+
input_audio: InputAudio.DefinitionSchema,
|
|
192
162
|
})
|
|
193
|
-
.describe("
|
|
163
|
+
.describe("An audio rich content part.")
|
|
164
|
+
.meta({ title: "AudioRichContentPart" });
|
|
194
165
|
let VideoUrl;
|
|
195
166
|
(function (VideoUrl) {
|
|
196
167
|
VideoUrl.UrlSchema = zod_1.default.string().describe("URL of the video.");
|
|
@@ -198,12 +169,13 @@ var Message;
|
|
|
198
169
|
url: VideoUrl.UrlSchema,
|
|
199
170
|
});
|
|
200
171
|
})(VideoUrl = Part.VideoUrl || (Part.VideoUrl = {}));
|
|
201
|
-
Part.
|
|
172
|
+
Part.VideoUrlSchema = zod_1.default
|
|
202
173
|
.object({
|
|
203
|
-
type: zod_1.default.
|
|
204
|
-
|
|
174
|
+
type: zod_1.default.enum(["video_url", "input_video"]),
|
|
175
|
+
video_url: VideoUrl.DefinitionSchema,
|
|
205
176
|
})
|
|
206
|
-
.describe("A
|
|
177
|
+
.describe("A video rich content part.")
|
|
178
|
+
.meta({ title: "VideoRichContentPart" });
|
|
207
179
|
let File;
|
|
208
180
|
(function (File) {
|
|
209
181
|
File.FileDataSchema = zod_1.default
|
|
@@ -227,202 +199,253 @@ var Message;
|
|
|
227
199
|
})
|
|
228
200
|
.describe("The file to be used as input, either as base64 data, an uploaded file ID, or a URL.");
|
|
229
201
|
})(File = Part.File || (Part.File = {}));
|
|
202
|
+
Part.FileSchema = zod_1.default
|
|
203
|
+
.object({
|
|
204
|
+
type: zod_1.default.literal("file"),
|
|
205
|
+
file: File.DefinitionSchema,
|
|
206
|
+
})
|
|
207
|
+
.describe("A file rich content part.")
|
|
208
|
+
.meta({ title: "FileRichContentPart" });
|
|
230
209
|
})(Part = RichContent.Part || (RichContent.Part = {}));
|
|
210
|
+
RichContent.PartSchema = zod_1.default
|
|
211
|
+
.discriminatedUnion("type", [
|
|
212
|
+
Part.TextSchema,
|
|
213
|
+
Part.ImageUrlSchema,
|
|
214
|
+
Part.InputAudioSchema,
|
|
215
|
+
Part.VideoUrlSchema,
|
|
216
|
+
Part.FileSchema,
|
|
217
|
+
])
|
|
218
|
+
.describe("A rich content part.")
|
|
219
|
+
.meta({ title: "RichContentPart" });
|
|
220
|
+
RichContent.PartExpressionSchema = zod_1.default
|
|
221
|
+
.union([
|
|
222
|
+
RichContent.PartSchema,
|
|
223
|
+
exports.ExpressionSchema.describe("An expression which evaluates to a rich content part."),
|
|
224
|
+
])
|
|
225
|
+
.describe(RichContent.PartSchema.description)
|
|
226
|
+
.meta({ title: "RichContentPartExpression" });
|
|
231
227
|
RichContent.PartsSchema = zod_1.default
|
|
232
228
|
.array(RichContent.PartSchema)
|
|
233
|
-
.describe("An array of rich content parts.")
|
|
229
|
+
.describe("An array of rich content parts.")
|
|
230
|
+
.meta({ title: "RichContentParts" });
|
|
234
231
|
RichContent.PartsExpressionSchema = zod_1.default
|
|
235
232
|
.array(RichContent.PartExpressionSchema)
|
|
236
|
-
.describe(RichContent.PartsSchema.description)
|
|
233
|
+
.describe(RichContent.PartsSchema.description)
|
|
234
|
+
.meta({ title: "RichContentPartExpressions" });
|
|
237
235
|
})(RichContent = Message.RichContent || (Message.RichContent = {}));
|
|
236
|
+
Message.RichContentSchema = zod_1.default
|
|
237
|
+
.union([RichContent.TextSchema, RichContent.PartsSchema])
|
|
238
|
+
.describe("Rich content.")
|
|
239
|
+
.meta({ title: "RichContent" });
|
|
240
|
+
Message.RichContentExpressionSchema = zod_1.default
|
|
241
|
+
.union([
|
|
242
|
+
RichContent.TextSchema,
|
|
243
|
+
RichContent.PartsExpressionSchema,
|
|
244
|
+
exports.ExpressionSchema.describe("An expression which evaluates to rich content."),
|
|
245
|
+
])
|
|
246
|
+
.describe(Message.RichContentSchema.description)
|
|
247
|
+
.meta({ title: "RichContentExpression" });
|
|
238
248
|
Message.NameSchema = zod_1.default
|
|
239
249
|
.string()
|
|
240
|
-
.describe("An optional name for the participant. Provides the model information to differentiate between participants of the same role.")
|
|
250
|
+
.describe("An optional name for the participant. Provides the model information to differentiate between participants of the same role.")
|
|
251
|
+
.meta({ title: "MessageName" });
|
|
241
252
|
Message.NameExpressionSchema = zod_1.default
|
|
242
253
|
.union([
|
|
243
254
|
Message.NameSchema,
|
|
244
255
|
exports.ExpressionSchema.describe("An expression which evaluates to a string."),
|
|
245
256
|
])
|
|
246
|
-
.describe(Message.NameSchema.description)
|
|
257
|
+
.describe(Message.NameSchema.description)
|
|
258
|
+
.meta({ title: "MessageNameExpression" });
|
|
247
259
|
Message.DeveloperSchema = zod_1.default
|
|
248
260
|
.object({
|
|
249
261
|
role: zod_1.default.literal("developer"),
|
|
250
262
|
content: Message.SimpleContentSchema,
|
|
251
263
|
name: Message.NameSchema.optional().nullable(),
|
|
252
264
|
})
|
|
253
|
-
.describe("Developer-provided instructions that the model should follow, regardless of messages sent by the user.")
|
|
265
|
+
.describe("Developer-provided instructions that the model should follow, regardless of messages sent by the user.")
|
|
266
|
+
.meta({ title: "DeveloperMessage" });
|
|
254
267
|
Message.DeveloperExpressionSchema = zod_1.default
|
|
255
268
|
.object({
|
|
256
269
|
role: zod_1.default.literal("developer"),
|
|
257
270
|
content: Message.SimpleContentExpressionSchema,
|
|
258
271
|
name: Message.NameExpressionSchema.optional().nullable(),
|
|
259
272
|
})
|
|
260
|
-
.describe(Message.DeveloperSchema.description)
|
|
273
|
+
.describe(Message.DeveloperSchema.description)
|
|
274
|
+
.meta({ title: "DeveloperMessageExpression" });
|
|
261
275
|
Message.SystemSchema = zod_1.default
|
|
262
276
|
.object({
|
|
263
277
|
role: zod_1.default.literal("system"),
|
|
264
278
|
content: Message.SimpleContentSchema,
|
|
265
279
|
name: Message.NameSchema.optional().nullable(),
|
|
266
280
|
})
|
|
267
|
-
.describe("Developer-provided instructions that the model should follow, regardless of messages sent by the user.")
|
|
281
|
+
.describe("Developer-provided instructions that the model should follow, regardless of messages sent by the user.")
|
|
282
|
+
.meta({ title: "SystemMessage" });
|
|
268
283
|
Message.SystemExpressionSchema = zod_1.default
|
|
269
284
|
.object({
|
|
270
285
|
role: zod_1.default.literal("system"),
|
|
271
286
|
content: Message.SimpleContentExpressionSchema,
|
|
272
287
|
name: Message.NameExpressionSchema.optional().nullable(),
|
|
273
288
|
})
|
|
274
|
-
.describe(Message.SystemSchema.description)
|
|
289
|
+
.describe(Message.SystemSchema.description)
|
|
290
|
+
.meta({ title: "SystemMessageExpression" });
|
|
275
291
|
Message.UserSchema = zod_1.default
|
|
276
292
|
.object({
|
|
277
293
|
role: zod_1.default.literal("user"),
|
|
278
294
|
content: Message.RichContentSchema,
|
|
279
295
|
name: Message.NameSchema.optional().nullable(),
|
|
280
296
|
})
|
|
281
|
-
.describe("Messages sent by an end user, containing prompts or additional context information.")
|
|
297
|
+
.describe("Messages sent by an end user, containing prompts or additional context information.")
|
|
298
|
+
.meta({ title: "UserMessage" });
|
|
282
299
|
Message.UserExpressionSchema = zod_1.default
|
|
283
300
|
.object({
|
|
284
301
|
role: zod_1.default.literal("user"),
|
|
285
302
|
content: Message.RichContentExpressionSchema,
|
|
286
303
|
name: Message.NameExpressionSchema.optional().nullable(),
|
|
287
304
|
})
|
|
288
|
-
.describe(Message.UserSchema.description)
|
|
289
|
-
|
|
290
|
-
.object({
|
|
291
|
-
role: zod_1.default.literal("tool"),
|
|
292
|
-
content: Message.RichContentSchema,
|
|
293
|
-
tool_call_id: Tool.ToolCallIdSchema,
|
|
294
|
-
})
|
|
295
|
-
.describe("Messages sent by tools in response to tool calls made by the assistant.");
|
|
296
|
-
Message.ToolExpressionSchema = zod_1.default
|
|
297
|
-
.object({
|
|
298
|
-
role: zod_1.default.literal("tool"),
|
|
299
|
-
content: Message.RichContentExpressionSchema,
|
|
300
|
-
tool_call_id: Tool.ToolCallIdExpressionSchema,
|
|
301
|
-
})
|
|
302
|
-
.describe(Message.ToolSchema.description);
|
|
305
|
+
.describe(Message.UserSchema.description)
|
|
306
|
+
.meta({ title: "UserMessageExpression" });
|
|
303
307
|
let Tool;
|
|
304
308
|
(function (Tool) {
|
|
305
309
|
Tool.ToolCallIdSchema = zod_1.default
|
|
306
310
|
.string()
|
|
307
|
-
.describe("The ID of the tool call that this message is responding to.")
|
|
311
|
+
.describe("The ID of the tool call that this message is responding to.")
|
|
312
|
+
.meta({ title: "ToolMessageToolCallId" });
|
|
308
313
|
Tool.ToolCallIdExpressionSchema = zod_1.default
|
|
309
314
|
.union([
|
|
310
315
|
Tool.ToolCallIdSchema,
|
|
311
316
|
exports.ExpressionSchema.describe("An expression which evaluates to a string."),
|
|
312
317
|
])
|
|
313
|
-
.describe(Tool.ToolCallIdSchema.description)
|
|
318
|
+
.describe(Tool.ToolCallIdSchema.description)
|
|
319
|
+
.meta({ title: "ToolMessageToolCallIdExpression" });
|
|
314
320
|
})(Tool = Message.Tool || (Message.Tool = {}));
|
|
315
|
-
Message.
|
|
321
|
+
Message.ToolSchema = zod_1.default
|
|
316
322
|
.object({
|
|
317
|
-
role: zod_1.default.literal("
|
|
318
|
-
content: Message.RichContentSchema
|
|
319
|
-
|
|
320
|
-
refusal: Assistant.RefusalSchema.optional().nullable(),
|
|
321
|
-
tool_calls: Assistant.ToolCallsSchema.optional().nullable(),
|
|
322
|
-
reasoning: Assistant.ReasoningSchema.optional().nullable(),
|
|
323
|
+
role: zod_1.default.literal("tool"),
|
|
324
|
+
content: Message.RichContentSchema,
|
|
325
|
+
tool_call_id: Tool.ToolCallIdSchema,
|
|
323
326
|
})
|
|
324
|
-
.describe("Messages sent by
|
|
325
|
-
|
|
327
|
+
.describe("Messages sent by tools in response to tool calls made by the assistant.")
|
|
328
|
+
.meta({ title: "ToolMessage" });
|
|
329
|
+
Message.ToolExpressionSchema = zod_1.default
|
|
326
330
|
.object({
|
|
327
|
-
role: zod_1.default.literal("
|
|
328
|
-
content: Message.RichContentExpressionSchema
|
|
329
|
-
|
|
330
|
-
refusal: Assistant.RefusalExpressionSchema.optional().nullable(),
|
|
331
|
-
tool_calls: Assistant.ToolCallsExpressionSchema.optional().nullable(),
|
|
332
|
-
reasoning: Assistant.ReasoningExpressionSchema.optional().nullable(),
|
|
331
|
+
role: zod_1.default.literal("tool"),
|
|
332
|
+
content: Message.RichContentExpressionSchema,
|
|
333
|
+
tool_call_id: Tool.ToolCallIdExpressionSchema,
|
|
333
334
|
})
|
|
334
|
-
.describe(Message.
|
|
335
|
+
.describe(Message.ToolSchema.description)
|
|
336
|
+
.meta({ title: "ToolMessageExpression" });
|
|
335
337
|
let Assistant;
|
|
336
338
|
(function (Assistant) {
|
|
337
339
|
Assistant.RefusalSchema = zod_1.default
|
|
338
340
|
.string()
|
|
339
|
-
.describe("The refusal message by the assistant.")
|
|
341
|
+
.describe("The refusal message by the assistant.")
|
|
342
|
+
.meta({ title: "AssistantMessageRefusal" });
|
|
340
343
|
Assistant.RefusalExpressionSchema = zod_1.default
|
|
341
344
|
.union([
|
|
342
345
|
Assistant.RefusalSchema,
|
|
343
346
|
exports.ExpressionSchema.describe("An expression which evaluates to a string."),
|
|
344
347
|
])
|
|
345
|
-
.describe(Assistant.RefusalSchema.description)
|
|
348
|
+
.describe(Assistant.RefusalSchema.description)
|
|
349
|
+
.meta({ title: "AssistantMessageRefusalExpression" });
|
|
346
350
|
Assistant.ReasoningSchema = zod_1.default
|
|
347
351
|
.string()
|
|
348
|
-
.describe("The reasoning provided by the assistant.")
|
|
352
|
+
.describe("The reasoning provided by the assistant.")
|
|
353
|
+
.meta({ title: "AssistantMessageReasoning" });
|
|
349
354
|
Assistant.ReasoningExpressionSchema = zod_1.default
|
|
350
355
|
.union([
|
|
351
356
|
Assistant.ReasoningSchema,
|
|
352
357
|
exports.ExpressionSchema.describe("An expression which evaluates to a string."),
|
|
353
358
|
])
|
|
354
|
-
.describe(Assistant.ReasoningSchema.description)
|
|
355
|
-
|
|
356
|
-
.union([ToolCall.FunctionSchema])
|
|
357
|
-
.describe("A tool call made by the assistant.");
|
|
358
|
-
Assistant.ToolCallExpressionSchema = zod_1.default
|
|
359
|
-
.union([
|
|
360
|
-
ToolCall.FunctionExpressionSchema,
|
|
361
|
-
exports.ExpressionSchema.describe("An expression which evaluates to a tool call."),
|
|
362
|
-
])
|
|
363
|
-
.describe(Assistant.ToolCallSchema.description);
|
|
359
|
+
.describe(Assistant.ReasoningSchema.description)
|
|
360
|
+
.meta({ title: "AssistantMessageReasoningExpression" });
|
|
364
361
|
let ToolCall;
|
|
365
362
|
(function (ToolCall) {
|
|
366
363
|
ToolCall.IdSchema = zod_1.default
|
|
367
364
|
.string()
|
|
368
|
-
.describe("The unique identifier for the tool call.")
|
|
365
|
+
.describe("The unique identifier for the tool call.")
|
|
366
|
+
.meta({ title: "AssistantMessageToolCallId" });
|
|
369
367
|
ToolCall.IdExpressionSchema = zod_1.default
|
|
370
368
|
.union([
|
|
371
369
|
ToolCall.IdSchema,
|
|
372
370
|
exports.ExpressionSchema.describe("An expression which evaluates to a string."),
|
|
373
371
|
])
|
|
374
|
-
.describe(ToolCall.IdSchema.description)
|
|
375
|
-
|
|
376
|
-
.object({
|
|
377
|
-
type: zod_1.default.literal("function"),
|
|
378
|
-
id: ToolCall.IdSchema,
|
|
379
|
-
function: Function.DefinitionSchema,
|
|
380
|
-
})
|
|
381
|
-
.describe("A function tool call made by the assistant.");
|
|
382
|
-
ToolCall.FunctionExpressionSchema = zod_1.default
|
|
383
|
-
.object({
|
|
384
|
-
type: zod_1.default.literal("function"),
|
|
385
|
-
id: ToolCall.IdExpressionSchema,
|
|
386
|
-
function: Function.DefinitionExpressionSchema,
|
|
387
|
-
})
|
|
388
|
-
.describe(ToolCall.FunctionSchema.description);
|
|
372
|
+
.describe(ToolCall.IdSchema.description)
|
|
373
|
+
.meta({ title: "AssistantMessageToolCallIdExpression" });
|
|
389
374
|
let Function;
|
|
390
375
|
(function (Function) {
|
|
391
376
|
Function.NameSchema = zod_1.default
|
|
392
377
|
.string()
|
|
393
|
-
.describe("The name of the function called.")
|
|
378
|
+
.describe("The name of the function called.")
|
|
379
|
+
.meta({ title: "AssistantMessageToolCallFunctionName" });
|
|
394
380
|
Function.NameExpressionSchema = zod_1.default
|
|
395
381
|
.union([
|
|
396
382
|
Function.NameSchema,
|
|
397
383
|
exports.ExpressionSchema.describe("An expression which evaluates to a string."),
|
|
398
384
|
])
|
|
399
|
-
.describe(Function.NameSchema.description)
|
|
385
|
+
.describe(Function.NameSchema.description)
|
|
386
|
+
.meta({ title: "AssistantMessageToolCallFunctionNameExpression" });
|
|
400
387
|
Function.ArgumentsSchema = zod_1.default
|
|
401
388
|
.string()
|
|
402
|
-
.describe("The arguments passed to the function.")
|
|
389
|
+
.describe("The arguments passed to the function.")
|
|
390
|
+
.meta({ title: "AssistantMessageToolCallFunctionArguments" });
|
|
403
391
|
Function.ArgumentsExpressionSchema = zod_1.default
|
|
404
392
|
.union([
|
|
405
393
|
Function.ArgumentsSchema,
|
|
406
394
|
exports.ExpressionSchema.describe("An expression which evaluates to a string."),
|
|
407
395
|
])
|
|
408
|
-
.describe(Function.ArgumentsSchema.description)
|
|
396
|
+
.describe(Function.ArgumentsSchema.description)
|
|
397
|
+
.meta({
|
|
398
|
+
title: "AssistantMessageToolCallFunctionArgumentsExpression",
|
|
399
|
+
});
|
|
409
400
|
Function.DefinitionSchema = zod_1.default
|
|
410
401
|
.object({
|
|
411
402
|
name: Function.NameSchema,
|
|
412
403
|
arguments: Function.ArgumentsSchema,
|
|
413
404
|
})
|
|
414
|
-
.describe("The name and arguments of the function called.")
|
|
405
|
+
.describe("The name and arguments of the function called.")
|
|
406
|
+
.meta({ title: "AssistantMessageToolCallFunctionDefinition" });
|
|
415
407
|
Function.DefinitionExpressionSchema = zod_1.default
|
|
416
408
|
.object({
|
|
417
409
|
name: Function.NameExpressionSchema,
|
|
418
410
|
arguments: Function.ArgumentsExpressionSchema,
|
|
419
411
|
})
|
|
420
|
-
.describe(Function.DefinitionSchema.description)
|
|
412
|
+
.describe(Function.DefinitionSchema.description)
|
|
413
|
+
.meta({
|
|
414
|
+
title: "AssistantMessageToolCallFunctionDefinitionExpression",
|
|
415
|
+
});
|
|
421
416
|
})(Function = ToolCall.Function || (ToolCall.Function = {}));
|
|
417
|
+
ToolCall.FunctionSchema = zod_1.default
|
|
418
|
+
.object({
|
|
419
|
+
type: zod_1.default.literal("function"),
|
|
420
|
+
id: ToolCall.IdSchema,
|
|
421
|
+
function: Function.DefinitionSchema,
|
|
422
|
+
})
|
|
423
|
+
.describe("A function tool call made by the assistant.")
|
|
424
|
+
.meta({ title: "AssistantMessageToolCallFunction" });
|
|
425
|
+
ToolCall.FunctionExpressionSchema = zod_1.default
|
|
426
|
+
.object({
|
|
427
|
+
type: zod_1.default.literal("function"),
|
|
428
|
+
id: ToolCall.IdExpressionSchema,
|
|
429
|
+
function: Function.DefinitionExpressionSchema,
|
|
430
|
+
})
|
|
431
|
+
.describe(ToolCall.FunctionSchema.description)
|
|
432
|
+
.meta({ title: "AssistantMessageToolCallFunctionExpression" });
|
|
422
433
|
})(ToolCall = Assistant.ToolCall || (Assistant.ToolCall = {}));
|
|
434
|
+
Assistant.ToolCallSchema = zod_1.default
|
|
435
|
+
.union([ToolCall.FunctionSchema])
|
|
436
|
+
.describe("A tool call made by the assistant.")
|
|
437
|
+
.meta({ title: "AssistantMessageToolCall" });
|
|
438
|
+
Assistant.ToolCallExpressionSchema = zod_1.default
|
|
439
|
+
.union([
|
|
440
|
+
ToolCall.FunctionExpressionSchema,
|
|
441
|
+
exports.ExpressionSchema.describe("An expression which evaluates to a tool call."),
|
|
442
|
+
])
|
|
443
|
+
.describe(Assistant.ToolCallSchema.description)
|
|
444
|
+
.meta({ title: "AssistantMessageToolCallExpression" });
|
|
423
445
|
Assistant.ToolCallsSchema = zod_1.default
|
|
424
446
|
.array(Assistant.ToolCallSchema)
|
|
425
|
-
.describe("Tool calls made by the assistant.")
|
|
447
|
+
.describe("Tool calls made by the assistant.")
|
|
448
|
+
.meta({ title: "AssistantMessageToolCalls" });
|
|
426
449
|
Assistant.ToolCallsExpressionSchema = zod_1.default
|
|
427
450
|
.union([
|
|
428
451
|
zod_1.default
|
|
@@ -430,78 +453,120 @@ var Message;
|
|
|
430
453
|
.describe(Assistant.ToolCallsSchema.description),
|
|
431
454
|
exports.ExpressionSchema.describe("An expression which evaluates to an array of tool calls."),
|
|
432
455
|
])
|
|
433
|
-
.describe(Assistant.ToolCallsSchema.description)
|
|
456
|
+
.describe(Assistant.ToolCallsSchema.description)
|
|
457
|
+
.meta({ title: "AssistantMessageToolCallsExpression" });
|
|
434
458
|
})(Assistant = Message.Assistant || (Message.Assistant = {}));
|
|
459
|
+
Message.AssistantSchema = zod_1.default
|
|
460
|
+
.object({
|
|
461
|
+
role: zod_1.default.literal("assistant"),
|
|
462
|
+
content: Message.RichContentSchema.optional().nullable(),
|
|
463
|
+
name: Message.NameSchema.optional().nullable(),
|
|
464
|
+
refusal: Assistant.RefusalSchema.optional().nullable(),
|
|
465
|
+
tool_calls: Assistant.ToolCallsSchema.optional().nullable(),
|
|
466
|
+
reasoning: Assistant.ReasoningSchema.optional().nullable(),
|
|
467
|
+
})
|
|
468
|
+
.describe("Messages sent by the model in response to user messages.")
|
|
469
|
+
.meta({ title: "AssistantMessage" });
|
|
470
|
+
Message.AssistantExpressionSchema = zod_1.default
|
|
471
|
+
.object({
|
|
472
|
+
role: zod_1.default.literal("assistant"),
|
|
473
|
+
content: Message.RichContentExpressionSchema.optional().nullable(),
|
|
474
|
+
name: Message.NameExpressionSchema.optional().nullable(),
|
|
475
|
+
refusal: Assistant.RefusalExpressionSchema.optional().nullable(),
|
|
476
|
+
tool_calls: Assistant.ToolCallsExpressionSchema.optional().nullable(),
|
|
477
|
+
reasoning: Assistant.ReasoningExpressionSchema.optional().nullable(),
|
|
478
|
+
})
|
|
479
|
+
.describe(Message.AssistantSchema.description)
|
|
480
|
+
.meta({ title: "AssistantMessageExpression" });
|
|
435
481
|
})(Message || (exports.Message = Message = {}));
|
|
482
|
+
exports.MessageSchema = zod_1.default
|
|
483
|
+
.discriminatedUnion("role", [
|
|
484
|
+
Message.DeveloperSchema,
|
|
485
|
+
Message.SystemSchema,
|
|
486
|
+
Message.UserSchema,
|
|
487
|
+
Message.ToolSchema,
|
|
488
|
+
Message.AssistantSchema,
|
|
489
|
+
])
|
|
490
|
+
.describe("A message exchanged in a chat conversation.")
|
|
491
|
+
.meta({ title: "Message" });
|
|
492
|
+
exports.MessageExpressionSchema = zod_1.default
|
|
493
|
+
.union([
|
|
494
|
+
zod_1.default
|
|
495
|
+
.discriminatedUnion("role", [
|
|
496
|
+
Message.DeveloperExpressionSchema,
|
|
497
|
+
Message.SystemExpressionSchema,
|
|
498
|
+
Message.UserExpressionSchema,
|
|
499
|
+
Message.ToolExpressionSchema,
|
|
500
|
+
Message.AssistantExpressionSchema,
|
|
501
|
+
])
|
|
502
|
+
.describe(exports.MessageSchema.description),
|
|
503
|
+
exports.ExpressionSchema.describe("An expression which evaluates to a message."),
|
|
504
|
+
])
|
|
505
|
+
.describe(exports.MessageSchema.description)
|
|
506
|
+
.meta({ title: "MessageExpression" });
|
|
436
507
|
exports.MessagesSchema = zod_1.default
|
|
437
508
|
.array(exports.MessageSchema)
|
|
438
|
-
.describe("A list of messages exchanged in a chat conversation.")
|
|
509
|
+
.describe("A list of messages exchanged in a chat conversation.")
|
|
510
|
+
.meta({ title: "Messages" });
|
|
439
511
|
exports.MessagesExpressionSchema = zod_1.default
|
|
440
512
|
.union([
|
|
441
|
-
zod_1.default
|
|
513
|
+
zod_1.default
|
|
514
|
+
.array(exports.MessageExpressionSchema)
|
|
515
|
+
.describe(exports.MessagesSchema.description)
|
|
516
|
+
.meta({ title: "MessageExpressions" }),
|
|
442
517
|
exports.ExpressionSchema.describe("An expression which evaluates to an array of messages."),
|
|
443
518
|
])
|
|
444
|
-
.describe(exports.MessagesSchema.description)
|
|
519
|
+
.describe(exports.MessagesSchema.description)
|
|
520
|
+
.meta({ title: "MessagesExpression" });
|
|
445
521
|
// Tools
|
|
446
|
-
exports.ToolSchema = zod_1.default
|
|
447
|
-
.union([Tool.FunctionSchema])
|
|
448
|
-
.describe("A tool that the assistant can call.");
|
|
449
|
-
exports.ToolExpressionSchema = zod_1.default
|
|
450
|
-
.union([
|
|
451
|
-
Tool.FunctionExpressionSchema,
|
|
452
|
-
exports.ExpressionSchema.describe("An expression which evaluates to a tool."),
|
|
453
|
-
])
|
|
454
|
-
.describe(exports.ToolSchema.description);
|
|
455
522
|
var Tool;
|
|
456
523
|
(function (Tool) {
|
|
457
|
-
Tool.FunctionSchema = zod_1.default
|
|
458
|
-
.object({
|
|
459
|
-
type: zod_1.default.literal("function"),
|
|
460
|
-
function: Function.DefinitionSchema,
|
|
461
|
-
})
|
|
462
|
-
.describe("A function tool that the assistant can call.");
|
|
463
|
-
Tool.FunctionExpressionSchema = zod_1.default
|
|
464
|
-
.object({
|
|
465
|
-
type: zod_1.default.literal("function"),
|
|
466
|
-
function: Function.DefinitionExpressionSchema,
|
|
467
|
-
})
|
|
468
|
-
.describe(Tool.FunctionSchema.description);
|
|
469
524
|
let Function;
|
|
470
525
|
(function (Function) {
|
|
471
|
-
Function.NameSchema = zod_1.default
|
|
526
|
+
Function.NameSchema = zod_1.default
|
|
527
|
+
.string()
|
|
528
|
+
.describe("The name of the function.")
|
|
529
|
+
.meta({ title: "FunctionToolName" });
|
|
472
530
|
Function.NameExpressionSchema = zod_1.default
|
|
473
531
|
.union([
|
|
474
532
|
Function.NameSchema,
|
|
475
533
|
exports.ExpressionSchema.describe("An expression which evaluates to a string."),
|
|
476
534
|
])
|
|
477
|
-
.describe(Function.NameSchema.description)
|
|
535
|
+
.describe(Function.NameSchema.description)
|
|
536
|
+
.meta({ title: "FunctionToolNameExpression" });
|
|
478
537
|
Function.DescriptionSchema = zod_1.default
|
|
479
538
|
.string()
|
|
480
|
-
.describe("The description of the function.")
|
|
539
|
+
.describe("The description of the function.")
|
|
540
|
+
.meta({ title: "FunctionToolDescription" });
|
|
481
541
|
Function.DescriptionExpressionSchema = zod_1.default
|
|
482
542
|
.union([
|
|
483
543
|
Function.DescriptionSchema,
|
|
484
544
|
exports.ExpressionSchema.describe("An expression which evaluates to a string."),
|
|
485
545
|
])
|
|
486
|
-
.describe(Function.DescriptionSchema.description)
|
|
546
|
+
.describe(Function.DescriptionSchema.description)
|
|
547
|
+
.meta({ title: "FunctionToolDescriptionExpression" });
|
|
487
548
|
Function.ParametersSchema = zod_1.default
|
|
488
549
|
.record(zod_1.default.string(), exports.JsonValueSchema)
|
|
489
|
-
.describe("The JSON schema defining the parameters of the function.")
|
|
550
|
+
.describe("The JSON schema defining the parameters of the function.")
|
|
551
|
+
.meta({ title: "FunctionToolParameters" });
|
|
490
552
|
Function.ParametersExpressionSchema = zod_1.default
|
|
491
553
|
.union([
|
|
492
554
|
zod_1.default.record(zod_1.default.string(), exports.JsonValueExpressionSchema),
|
|
493
555
|
exports.ExpressionSchema.describe("An expression which evaluates to a JSON schema object."),
|
|
494
556
|
])
|
|
495
|
-
.describe(Function.ParametersSchema.description)
|
|
557
|
+
.describe(Function.ParametersSchema.description)
|
|
558
|
+
.meta({ title: "FunctionToolParametersExpression" });
|
|
496
559
|
Function.StrictSchema = zod_1.default
|
|
497
560
|
.boolean()
|
|
498
|
-
.describe("Whether to enforce strict adherence to the parameter schema.")
|
|
561
|
+
.describe("Whether to enforce strict adherence to the parameter schema.")
|
|
562
|
+
.meta({ title: "FunctionToolStrict" });
|
|
499
563
|
Function.StrictExpressionSchema = zod_1.default
|
|
500
564
|
.union([
|
|
501
565
|
Function.StrictSchema,
|
|
502
566
|
exports.ExpressionSchema.describe("An expression which evaluates to a boolean."),
|
|
503
567
|
])
|
|
504
|
-
.describe(Function.StrictSchema.description)
|
|
568
|
+
.describe(Function.StrictSchema.description)
|
|
569
|
+
.meta({ title: "FunctionToolStrictExpression" });
|
|
505
570
|
Function.DefinitionSchema = zod_1.default
|
|
506
571
|
.object({
|
|
507
572
|
name: Function.NameSchema,
|
|
@@ -509,7 +574,8 @@ var Tool;
|
|
|
509
574
|
parameters: Function.ParametersSchema.optional().nullable(),
|
|
510
575
|
strict: Function.StrictSchema.optional().nullable(),
|
|
511
576
|
})
|
|
512
|
-
.describe("The definition of a function tool.")
|
|
577
|
+
.describe("The definition of a function tool.")
|
|
578
|
+
.meta({ title: "FunctionToolDefinition" });
|
|
513
579
|
Function.DefinitionExpressionSchema = zod_1.default
|
|
514
580
|
.object({
|
|
515
581
|
name: Function.NameExpressionSchema,
|
|
@@ -517,38 +583,214 @@ var Tool;
|
|
|
517
583
|
parameters: Function.ParametersExpressionSchema.optional().nullable(),
|
|
518
584
|
strict: Function.StrictExpressionSchema.optional().nullable(),
|
|
519
585
|
})
|
|
520
|
-
.describe(Function.DefinitionSchema.description)
|
|
586
|
+
.describe(Function.DefinitionSchema.description)
|
|
587
|
+
.meta({ title: "FunctionToolDefinitionExpression" });
|
|
521
588
|
})(Function = Tool.Function || (Tool.Function = {}));
|
|
589
|
+
Tool.FunctionSchema = zod_1.default
|
|
590
|
+
.object({
|
|
591
|
+
type: zod_1.default.literal("function"),
|
|
592
|
+
function: Function.DefinitionSchema,
|
|
593
|
+
})
|
|
594
|
+
.describe("A function tool that the assistant can call.")
|
|
595
|
+
.meta({ title: "FunctionTool" });
|
|
596
|
+
Tool.FunctionExpressionSchema = zod_1.default
|
|
597
|
+
.object({
|
|
598
|
+
type: zod_1.default.literal("function"),
|
|
599
|
+
function: Function.DefinitionExpressionSchema,
|
|
600
|
+
})
|
|
601
|
+
.describe(Tool.FunctionSchema.description)
|
|
602
|
+
.meta({ title: "FunctionToolExpression" });
|
|
522
603
|
})(Tool || (exports.Tool = Tool = {}));
|
|
604
|
+
exports.ToolSchema = zod_1.default
|
|
605
|
+
.union([Tool.FunctionSchema])
|
|
606
|
+
.describe("A tool that the assistant can call.")
|
|
607
|
+
.meta({ title: "Tool" });
|
|
608
|
+
exports.ToolExpressionSchema = zod_1.default
|
|
609
|
+
.union([
|
|
610
|
+
Tool.FunctionExpressionSchema,
|
|
611
|
+
exports.ExpressionSchema.describe("An expression which evaluates to a tool."),
|
|
612
|
+
])
|
|
613
|
+
.describe(exports.ToolSchema.description)
|
|
614
|
+
.meta({ title: "ToolExpression" });
|
|
523
615
|
exports.ToolsSchema = zod_1.default
|
|
524
616
|
.array(exports.ToolSchema)
|
|
525
|
-
.describe("A list of tools that the assistant can call.")
|
|
617
|
+
.describe("A list of tools that the assistant can call.")
|
|
618
|
+
.meta({ title: "Tools" });
|
|
526
619
|
exports.ToolsExpressionSchema = zod_1.default
|
|
527
620
|
.union([
|
|
528
|
-
zod_1.default
|
|
621
|
+
zod_1.default
|
|
622
|
+
.array(exports.ToolExpressionSchema)
|
|
623
|
+
.describe(exports.ToolsSchema.description)
|
|
624
|
+
.meta({ title: "ToolExpressions" }),
|
|
529
625
|
exports.ExpressionSchema.describe("An expression which evaluates to an array of tools."),
|
|
530
626
|
])
|
|
531
|
-
.describe(exports.ToolsSchema.description)
|
|
627
|
+
.describe(exports.ToolsSchema.description)
|
|
628
|
+
.meta({ title: "ToolsExpression" });
|
|
532
629
|
// Vector Responses
|
|
533
|
-
exports.VectorResponseSchema = Message.RichContentSchema.describe("A possible assistant response. The LLMs in the Ensemble may vote for this option.");
|
|
630
|
+
exports.VectorResponseSchema = Message.RichContentSchema.describe("A possible assistant response. The LLMs in the Ensemble may vote for this option.").meta({ title: "VectorResponse" });
|
|
534
631
|
exports.VectorResponseExpressionSchema = zod_1.default
|
|
535
632
|
.union([
|
|
536
633
|
exports.VectorResponseSchema,
|
|
537
634
|
exports.ExpressionSchema.describe("An expression which evaluates to a possible assistant response."),
|
|
538
635
|
])
|
|
539
|
-
.describe(exports.VectorResponseSchema.description)
|
|
636
|
+
.describe(exports.VectorResponseSchema.description)
|
|
637
|
+
.meta({ title: "VectorResponseExpression" });
|
|
540
638
|
exports.VectorResponsesSchema = zod_1.default
|
|
541
639
|
.array(exports.VectorResponseSchema)
|
|
542
|
-
.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.")
|
|
640
|
+
.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.")
|
|
641
|
+
.meta({ title: "VectorResponses" });
|
|
543
642
|
exports.VectorResponsesExpressionSchema = zod_1.default
|
|
544
643
|
.union([
|
|
545
644
|
zod_1.default
|
|
546
645
|
.array(exports.VectorResponseExpressionSchema)
|
|
547
|
-
.describe(exports.VectorResponsesSchema.description)
|
|
646
|
+
.describe(exports.VectorResponsesSchema.description)
|
|
647
|
+
.meta({ title: "VectorResponseExpressions" }),
|
|
548
648
|
exports.ExpressionSchema.describe("An expression which evaluates to an array of possible assistant responses."),
|
|
549
649
|
])
|
|
550
|
-
.describe(exports.VectorResponsesSchema.description)
|
|
650
|
+
.describe(exports.VectorResponsesSchema.description)
|
|
651
|
+
.meta({ title: "VectorResponsesExpression" });
|
|
551
652
|
// Ensemble LLM
|
|
653
|
+
var EnsembleLlm;
|
|
654
|
+
(function (EnsembleLlm) {
|
|
655
|
+
EnsembleLlm.OutputModeSchema = zod_1.default
|
|
656
|
+
.enum(["instruction", "json_schema", "tool_call"])
|
|
657
|
+
.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.');
|
|
658
|
+
EnsembleLlm.StopSchema = zod_1.default
|
|
659
|
+
.union([
|
|
660
|
+
zod_1.default
|
|
661
|
+
.string()
|
|
662
|
+
.describe("Generation will stop when this string is generated.")
|
|
663
|
+
.meta({ title: "StopString" }),
|
|
664
|
+
zod_1.default
|
|
665
|
+
.array(zod_1.default.string().meta({ title: "StopString" }))
|
|
666
|
+
.describe("Generation will stop when any of these strings are generated.")
|
|
667
|
+
.meta({ title: "StopStrings" }),
|
|
668
|
+
])
|
|
669
|
+
.describe("The assistant will stop when any of the provided strings are generated.")
|
|
670
|
+
.meta({ title: "Stop" });
|
|
671
|
+
let Provider;
|
|
672
|
+
(function (Provider) {
|
|
673
|
+
Provider.QuantizationSchema = zod_1.default
|
|
674
|
+
.enum([
|
|
675
|
+
"int4",
|
|
676
|
+
"int8",
|
|
677
|
+
"fp4",
|
|
678
|
+
"fp6",
|
|
679
|
+
"fp8",
|
|
680
|
+
"fp16",
|
|
681
|
+
"bf16",
|
|
682
|
+
"fp32",
|
|
683
|
+
"unknown",
|
|
684
|
+
])
|
|
685
|
+
.describe("An LLM quantization.")
|
|
686
|
+
.meta({ title: "ProviderQuantization" });
|
|
687
|
+
})(Provider = EnsembleLlm.Provider || (EnsembleLlm.Provider = {}));
|
|
688
|
+
EnsembleLlm.ProviderSchema = zod_1.default
|
|
689
|
+
.object({
|
|
690
|
+
allow_fallbacks: zod_1.default
|
|
691
|
+
.boolean()
|
|
692
|
+
.optional()
|
|
693
|
+
.nullable()
|
|
694
|
+
.describe("Whether to allow fallback providers if the preferred provider is unavailable."),
|
|
695
|
+
require_parameters: zod_1.default
|
|
696
|
+
.boolean()
|
|
697
|
+
.optional()
|
|
698
|
+
.nullable()
|
|
699
|
+
.describe("Whether to require that the provider supports all specified parameters."),
|
|
700
|
+
order: zod_1.default
|
|
701
|
+
.array(zod_1.default.string().meta({ title: "ProviderName" }))
|
|
702
|
+
.optional()
|
|
703
|
+
.nullable()
|
|
704
|
+
.describe("An ordered list of provider names to use when selecting a provider for this model."),
|
|
705
|
+
only: zod_1.default
|
|
706
|
+
.array(zod_1.default.string().meta({ title: "ProviderName" }))
|
|
707
|
+
.optional()
|
|
708
|
+
.nullable()
|
|
709
|
+
.describe("A list of provider names to restrict selection to when selecting a provider for this model."),
|
|
710
|
+
ignore: zod_1.default
|
|
711
|
+
.array(zod_1.default.string().meta({ title: "ProviderName" }))
|
|
712
|
+
.optional()
|
|
713
|
+
.nullable()
|
|
714
|
+
.describe("A list of provider names to ignore when selecting a provider for this model."),
|
|
715
|
+
quantizations: zod_1.default
|
|
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 Reasoning;
|
|
723
|
+
(function (Reasoning) {
|
|
724
|
+
Reasoning.EffortSchema = zod_1.default
|
|
725
|
+
.enum(["none", "minimal", "low", "medium", "high", "xhigh"])
|
|
726
|
+
.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.")
|
|
727
|
+
.meta({ title: "ReasoningEffort" });
|
|
728
|
+
Reasoning.SummaryVerbositySchema = zod_1.default
|
|
729
|
+
.enum(["auto", "concise", "detailed"])
|
|
730
|
+
.describe("Controls the verbosity of the reasoning summary for supported reasoning models.")
|
|
731
|
+
.meta({ title: "ReasoningSummaryVerbosity" });
|
|
732
|
+
})(Reasoning = EnsembleLlm.Reasoning || (EnsembleLlm.Reasoning = {}));
|
|
733
|
+
EnsembleLlm.ReasoningSchema = zod_1.default
|
|
734
|
+
.object({
|
|
735
|
+
enabled: zod_1.default
|
|
736
|
+
.boolean()
|
|
737
|
+
.optional()
|
|
738
|
+
.nullable()
|
|
739
|
+
.describe("Enables or disables reasoning for supported models."),
|
|
740
|
+
max_tokens: zod_1.default
|
|
741
|
+
.int()
|
|
742
|
+
.min(0)
|
|
743
|
+
.max(2147483647)
|
|
744
|
+
.optional()
|
|
745
|
+
.nullable()
|
|
746
|
+
.describe("The maximum number of tokens to use for reasoning in a response."),
|
|
747
|
+
effort: Reasoning.EffortSchema.optional().nullable(),
|
|
748
|
+
summary_verbosity: Reasoning.SummaryVerbositySchema.optional().nullable(),
|
|
749
|
+
})
|
|
750
|
+
.optional()
|
|
751
|
+
.nullable()
|
|
752
|
+
.describe("Options for controlling reasoning behavior of the model.");
|
|
753
|
+
EnsembleLlm.VerbositySchema = zod_1.default
|
|
754
|
+
.enum(["low", "medium", "high"])
|
|
755
|
+
.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.");
|
|
756
|
+
EnsembleLlm.ListItemSchema = zod_1.default.object({
|
|
757
|
+
id: zod_1.default.string().describe("The unique identifier for the Ensemble LLM."),
|
|
758
|
+
});
|
|
759
|
+
async function list(openai, options) {
|
|
760
|
+
const response = await openai.get("/ensemble_llms", options);
|
|
761
|
+
return response;
|
|
762
|
+
}
|
|
763
|
+
EnsembleLlm.list = list;
|
|
764
|
+
EnsembleLlm.RetrieveItemSchema = zod_1.default.lazy(() => exports.EnsembleLlmSchema.extend({
|
|
765
|
+
created: zod_1.default
|
|
766
|
+
.uint32()
|
|
767
|
+
.describe("The Unix timestamp (in seconds) when the Ensemble LLM was created."),
|
|
768
|
+
}));
|
|
769
|
+
async function retrieve(openai, id, options) {
|
|
770
|
+
const response = await openai.get(`/ensemble_llms/${id}`, options);
|
|
771
|
+
return response;
|
|
772
|
+
}
|
|
773
|
+
EnsembleLlm.retrieve = retrieve;
|
|
774
|
+
EnsembleLlm.HistoricalUsageSchema = zod_1.default.object({
|
|
775
|
+
requests: zod_1.default
|
|
776
|
+
.uint32()
|
|
777
|
+
.describe("The total number of requests made to this Ensemble LLM."),
|
|
778
|
+
completion_tokens: zod_1.default
|
|
779
|
+
.uint32()
|
|
780
|
+
.describe("The total number of completion tokens generated by this Ensemble LLM."),
|
|
781
|
+
prompt_tokens: zod_1.default
|
|
782
|
+
.uint32()
|
|
783
|
+
.describe("The total number of prompt tokens sent to this Ensemble LLM."),
|
|
784
|
+
total_cost: zod_1.default
|
|
785
|
+
.number()
|
|
786
|
+
.describe("The total cost incurred by using this Ensemble LLM."),
|
|
787
|
+
});
|
|
788
|
+
async function retrieveUsage(openai, id, options) {
|
|
789
|
+
const response = await openai.get(`/ensemble_llms/${id}/usage`, options);
|
|
790
|
+
return response;
|
|
791
|
+
}
|
|
792
|
+
EnsembleLlm.retrieveUsage = retrieveUsage;
|
|
793
|
+
})(EnsembleLlm || (exports.EnsembleLlm = EnsembleLlm = {}));
|
|
552
794
|
exports.EnsembleLlmBaseSchema = zod_1.default
|
|
553
795
|
.object({
|
|
554
796
|
model: zod_1.default.string().describe("The full ID of the LLM to use."),
|
|
@@ -662,155 +904,20 @@ exports.EnsembleLlmBaseWithFallbacksAndCountSchema = exports.EnsembleLlmBaseSche
|
|
|
662
904
|
fallbacks: zod_1.default
|
|
663
905
|
.array(exports.EnsembleLlmBaseSchema)
|
|
664
906
|
.optional()
|
|
665
|
-
.nullable()
|
|
666
|
-
.describe("A list of fallback LLMs to use if the primary LLM fails."),
|
|
667
|
-
}).describe("An LLM to be used within an Ensemble, including optional fallbacks and count.");
|
|
668
|
-
exports.EnsembleLlmSchema = exports.EnsembleLlmBaseSchema.extend({
|
|
669
|
-
id: zod_1.default.string().describe("The unique identifier for the Ensemble LLM."),
|
|
670
|
-
}).describe("An LLM to be used within an Ensemble or standalone with Chat Completions, including its unique identifier.");
|
|
671
|
-
exports.EnsembleLlmWithFallbacksAndCountSchema = exports.EnsembleLlmSchema.extend({
|
|
672
|
-
count: exports.EnsembleLlmBaseWithFallbacksAndCountSchema.shape.count,
|
|
673
|
-
fallbacks: zod_1.default
|
|
674
|
-
.array(exports.EnsembleLlmSchema)
|
|
675
|
-
.optional()
|
|
676
|
-
.nullable()
|
|
677
|
-
.describe(exports.EnsembleLlmBaseWithFallbacksAndCountSchema.shape.fallbacks.description),
|
|
678
|
-
}).describe("An LLM to be used within an Ensemble, including its unique identifier, optional fallbacks, and count.");
|
|
679
|
-
var EnsembleLlm;
|
|
680
|
-
(function (EnsembleLlm) {
|
|
681
|
-
EnsembleLlm.OutputModeSchema = zod_1.default
|
|
682
|
-
.enum(["instruction", "json_schema", "tool_call"])
|
|
683
|
-
.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.');
|
|
684
|
-
EnsembleLlm.StopSchema = zod_1.default
|
|
685
|
-
.union([
|
|
686
|
-
zod_1.default
|
|
687
|
-
.string()
|
|
688
|
-
.describe("Generation will stop when this string is generated."),
|
|
689
|
-
zod_1.default
|
|
690
|
-
.array(zod_1.default.string())
|
|
691
|
-
.describe("Generation will stop when any of these strings are generated."),
|
|
692
|
-
])
|
|
693
|
-
.describe("The assistant will stop when any of the provided strings are generated.");
|
|
694
|
-
EnsembleLlm.ProviderSchema = zod_1.default
|
|
695
|
-
.object({
|
|
696
|
-
allow_fallbacks: zod_1.default
|
|
697
|
-
.boolean()
|
|
698
|
-
.optional()
|
|
699
|
-
.nullable()
|
|
700
|
-
.describe("Whether to allow fallback providers if the preferred provider is unavailable."),
|
|
701
|
-
require_parameters: zod_1.default
|
|
702
|
-
.boolean()
|
|
703
|
-
.optional()
|
|
704
|
-
.nullable()
|
|
705
|
-
.describe("Whether to require that the provider supports all specified parameters."),
|
|
706
|
-
order: zod_1.default
|
|
707
|
-
.array(zod_1.default.string())
|
|
708
|
-
.optional()
|
|
709
|
-
.nullable()
|
|
710
|
-
.describe("An ordered list of provider names to use when selecting a provider for this model."),
|
|
711
|
-
only: zod_1.default
|
|
712
|
-
.array(zod_1.default.string())
|
|
713
|
-
.optional()
|
|
714
|
-
.nullable()
|
|
715
|
-
.describe("A list of provider names to restrict selection to when selecting a provider for this model."),
|
|
716
|
-
ignore: zod_1.default
|
|
717
|
-
.array(zod_1.default.string())
|
|
718
|
-
.optional()
|
|
719
|
-
.nullable()
|
|
720
|
-
.describe("A list of provider names to ignore when selecting a provider for this model."),
|
|
721
|
-
quantizations: zod_1.default
|
|
722
|
-
.array(Provider.QuantizationSchema)
|
|
723
|
-
.optional()
|
|
724
|
-
.nullable()
|
|
725
|
-
.describe("Specifies the quantizations to allow when selecting providers for this model."),
|
|
726
|
-
})
|
|
727
|
-
.describe("Options for selecting the upstream provider of this model.");
|
|
728
|
-
let Provider;
|
|
729
|
-
(function (Provider) {
|
|
730
|
-
Provider.QuantizationSchema = zod_1.default
|
|
731
|
-
.enum([
|
|
732
|
-
"int4",
|
|
733
|
-
"int8",
|
|
734
|
-
"fp4",
|
|
735
|
-
"fp6",
|
|
736
|
-
"fp8",
|
|
737
|
-
"fp16",
|
|
738
|
-
"bf16",
|
|
739
|
-
"fp32",
|
|
740
|
-
"unknown",
|
|
741
|
-
])
|
|
742
|
-
.describe("An LLM quantization.");
|
|
743
|
-
})(Provider = EnsembleLlm.Provider || (EnsembleLlm.Provider = {}));
|
|
744
|
-
EnsembleLlm.ReasoningSchema = zod_1.default
|
|
745
|
-
.object({
|
|
746
|
-
enabled: zod_1.default
|
|
747
|
-
.boolean()
|
|
748
|
-
.optional()
|
|
749
|
-
.nullable()
|
|
750
|
-
.describe("Enables or disables reasoning for supported models."),
|
|
751
|
-
max_tokens: zod_1.default
|
|
752
|
-
.int()
|
|
753
|
-
.min(0)
|
|
754
|
-
.max(2147483647)
|
|
755
|
-
.optional()
|
|
756
|
-
.nullable()
|
|
757
|
-
.describe("The maximum number of tokens to use for reasoning in a response."),
|
|
758
|
-
effort: Reasoning.EffortSchema.optional().nullable(),
|
|
759
|
-
summary_verbosity: Reasoning.SummaryVerbositySchema.optional().nullable(),
|
|
760
|
-
})
|
|
907
|
+
.nullable()
|
|
908
|
+
.describe("A list of fallback LLMs to use if the primary LLM fails."),
|
|
909
|
+
}).describe("An LLM to be used within an Ensemble, including optional fallbacks and count.");
|
|
910
|
+
exports.EnsembleLlmSchema = exports.EnsembleLlmBaseSchema.extend({
|
|
911
|
+
id: zod_1.default.string().describe("The unique identifier for the Ensemble LLM."),
|
|
912
|
+
}).describe("An LLM to be used within an Ensemble or standalone with Chat Completions, including its unique identifier.");
|
|
913
|
+
exports.EnsembleLlmWithFallbacksAndCountSchema = exports.EnsembleLlmSchema.extend({
|
|
914
|
+
count: exports.EnsembleLlmBaseWithFallbacksAndCountSchema.shape.count,
|
|
915
|
+
fallbacks: zod_1.default
|
|
916
|
+
.array(exports.EnsembleLlmSchema)
|
|
761
917
|
.optional()
|
|
762
918
|
.nullable()
|
|
763
|
-
.describe(
|
|
764
|
-
|
|
765
|
-
(function (Reasoning) {
|
|
766
|
-
Reasoning.EffortSchema = zod_1.default
|
|
767
|
-
.enum(["none", "minimal", "low", "medium", "high", "xhigh"])
|
|
768
|
-
.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.");
|
|
769
|
-
Reasoning.SummaryVerbositySchema = zod_1.default
|
|
770
|
-
.enum(["auto", "concise", "detailed"])
|
|
771
|
-
.describe("Controls the verbosity of the reasoning summary for supported reasoning models.");
|
|
772
|
-
})(Reasoning = EnsembleLlm.Reasoning || (EnsembleLlm.Reasoning = {}));
|
|
773
|
-
EnsembleLlm.VerbositySchema = zod_1.default
|
|
774
|
-
.enum(["low", "medium", "high"])
|
|
775
|
-
.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.");
|
|
776
|
-
EnsembleLlm.ListItemSchema = zod_1.default.object({
|
|
777
|
-
id: zod_1.default.string().describe("The unique identifier for the Ensemble LLM."),
|
|
778
|
-
});
|
|
779
|
-
async function list(openai, options) {
|
|
780
|
-
const response = await openai.get("/ensemble_llms", options);
|
|
781
|
-
return response;
|
|
782
|
-
}
|
|
783
|
-
EnsembleLlm.list = list;
|
|
784
|
-
EnsembleLlm.RetrieveItemSchema = exports.EnsembleLlmSchema.extend({
|
|
785
|
-
created: zod_1.default
|
|
786
|
-
.uint32()
|
|
787
|
-
.describe("The Unix timestamp (in seconds) when the Ensemble LLM was created."),
|
|
788
|
-
});
|
|
789
|
-
async function retrieve(openai, id, options) {
|
|
790
|
-
const response = await openai.get(`/ensemble_llms/${id}`, options);
|
|
791
|
-
return response;
|
|
792
|
-
}
|
|
793
|
-
EnsembleLlm.retrieve = retrieve;
|
|
794
|
-
EnsembleLlm.HistoricalUsageSchema = zod_1.default.object({
|
|
795
|
-
requests: zod_1.default
|
|
796
|
-
.uint32()
|
|
797
|
-
.describe("The total number of requests made to this Ensemble LLM."),
|
|
798
|
-
completion_tokens: zod_1.default
|
|
799
|
-
.uint32()
|
|
800
|
-
.describe("The total number of completion tokens generated by this Ensemble LLM."),
|
|
801
|
-
prompt_tokens: zod_1.default
|
|
802
|
-
.uint32()
|
|
803
|
-
.describe("The total number of prompt tokens sent to this Ensemble LLM."),
|
|
804
|
-
total_cost: zod_1.default
|
|
805
|
-
.number()
|
|
806
|
-
.describe("The total cost incurred by using this Ensemble LLM."),
|
|
807
|
-
});
|
|
808
|
-
async function retrieveUsage(openai, id, options) {
|
|
809
|
-
const response = await openai.get(`/ensemble_llms/${id}/usage`, options);
|
|
810
|
-
return response;
|
|
811
|
-
}
|
|
812
|
-
EnsembleLlm.retrieveUsage = retrieveUsage;
|
|
813
|
-
})(EnsembleLlm || (exports.EnsembleLlm = EnsembleLlm = {}));
|
|
919
|
+
.describe(exports.EnsembleLlmBaseWithFallbacksAndCountSchema.shape.fallbacks.description),
|
|
920
|
+
}).describe("An LLM to be used within an Ensemble, including its unique identifier, optional fallbacks, and count.");
|
|
814
921
|
// Ensemble
|
|
815
922
|
exports.EnsembleBaseSchema = zod_1.default
|
|
816
923
|
.object({
|
|
@@ -874,38 +981,6 @@ var Chat;
|
|
|
874
981
|
(function (Completions) {
|
|
875
982
|
let Request;
|
|
876
983
|
(function (Request) {
|
|
877
|
-
Request.ProviderSchema = zod_1.default
|
|
878
|
-
.object({
|
|
879
|
-
data_collection: Provider.DataCollectionSchema.optional().nullable(),
|
|
880
|
-
zdr: zod_1.default
|
|
881
|
-
.boolean()
|
|
882
|
-
.optional()
|
|
883
|
-
.nullable()
|
|
884
|
-
.describe("Whether to enforce Zero Data Retention (ZDR) policies when selecting providers."),
|
|
885
|
-
sort: Provider.SortSchema.optional().nullable(),
|
|
886
|
-
max_price: Provider.MaxPriceSchema.optional().nullable(),
|
|
887
|
-
preferred_min_throughput: zod_1.default
|
|
888
|
-
.number()
|
|
889
|
-
.optional()
|
|
890
|
-
.nullable()
|
|
891
|
-
.describe("Preferred minimum throughput for the provider."),
|
|
892
|
-
preferred_max_latency: zod_1.default
|
|
893
|
-
.number()
|
|
894
|
-
.optional()
|
|
895
|
-
.nullable()
|
|
896
|
-
.describe("Preferred maximum latency for the provider."),
|
|
897
|
-
min_throughput: zod_1.default
|
|
898
|
-
.number()
|
|
899
|
-
.optional()
|
|
900
|
-
.nullable()
|
|
901
|
-
.describe("Minimum throughput for the provider."),
|
|
902
|
-
max_latency: zod_1.default
|
|
903
|
-
.number()
|
|
904
|
-
.optional()
|
|
905
|
-
.nullable()
|
|
906
|
-
.describe("Maximum latency for the provider."),
|
|
907
|
-
})
|
|
908
|
-
.describe("Options for selecting the upstream provider of this completion.");
|
|
909
984
|
let Provider;
|
|
910
985
|
(function (Provider) {
|
|
911
986
|
Provider.DataCollectionSchema = zod_1.default
|
|
@@ -942,36 +1017,55 @@ var Chat;
|
|
|
942
1017
|
.describe("Maximum price per request."),
|
|
943
1018
|
});
|
|
944
1019
|
})(Provider = Request.Provider || (Request.Provider = {}));
|
|
1020
|
+
Request.ProviderSchema = zod_1.default
|
|
1021
|
+
.object({
|
|
1022
|
+
data_collection: Provider.DataCollectionSchema.optional().nullable(),
|
|
1023
|
+
zdr: zod_1.default
|
|
1024
|
+
.boolean()
|
|
1025
|
+
.optional()
|
|
1026
|
+
.nullable()
|
|
1027
|
+
.describe("Whether to enforce Zero Data Retention (ZDR) policies when selecting providers."),
|
|
1028
|
+
sort: Provider.SortSchema.optional().nullable(),
|
|
1029
|
+
max_price: Provider.MaxPriceSchema.optional().nullable(),
|
|
1030
|
+
preferred_min_throughput: zod_1.default
|
|
1031
|
+
.number()
|
|
1032
|
+
.optional()
|
|
1033
|
+
.nullable()
|
|
1034
|
+
.describe("Preferred minimum throughput for the provider."),
|
|
1035
|
+
preferred_max_latency: zod_1.default
|
|
1036
|
+
.number()
|
|
1037
|
+
.optional()
|
|
1038
|
+
.nullable()
|
|
1039
|
+
.describe("Preferred maximum latency for the provider."),
|
|
1040
|
+
min_throughput: zod_1.default
|
|
1041
|
+
.number()
|
|
1042
|
+
.optional()
|
|
1043
|
+
.nullable()
|
|
1044
|
+
.describe("Minimum throughput for the provider."),
|
|
1045
|
+
max_latency: zod_1.default
|
|
1046
|
+
.number()
|
|
1047
|
+
.optional()
|
|
1048
|
+
.nullable()
|
|
1049
|
+
.describe("Maximum latency for the provider."),
|
|
1050
|
+
})
|
|
1051
|
+
.describe("Options for selecting the upstream provider of this completion.");
|
|
945
1052
|
Request.ModelSchema = zod_1.default
|
|
946
1053
|
.union([zod_1.default.string(), exports.EnsembleLlmBaseSchema])
|
|
947
1054
|
.describe("The Ensemble LLM to use for this completion. May be a unique ID or an inline definition.");
|
|
948
|
-
Request.ResponseFormatSchema = zod_1.default
|
|
949
|
-
.union([
|
|
950
|
-
ResponseFormat.TextSchema,
|
|
951
|
-
ResponseFormat.JsonObjectSchema,
|
|
952
|
-
ResponseFormat.JsonSchemaSchema,
|
|
953
|
-
ResponseFormat.GrammarSchema,
|
|
954
|
-
ResponseFormat.PythonSchema,
|
|
955
|
-
])
|
|
956
|
-
.describe("The desired format of the model's response.");
|
|
957
1055
|
let ResponseFormat;
|
|
958
1056
|
(function (ResponseFormat) {
|
|
959
1057
|
ResponseFormat.TextSchema = zod_1.default
|
|
960
1058
|
.object({
|
|
961
1059
|
type: zod_1.default.literal("text"),
|
|
962
1060
|
})
|
|
963
|
-
.describe("The response will be arbitrary text.")
|
|
1061
|
+
.describe("The response will be arbitrary text.")
|
|
1062
|
+
.meta({ title: "ResponseFormatText" });
|
|
964
1063
|
ResponseFormat.JsonObjectSchema = zod_1.default
|
|
965
1064
|
.object({
|
|
966
1065
|
type: zod_1.default.literal("json_object"),
|
|
967
1066
|
})
|
|
968
|
-
.describe("The response will be a JSON object.")
|
|
969
|
-
|
|
970
|
-
.object({
|
|
971
|
-
type: zod_1.default.literal("json_schema"),
|
|
972
|
-
json_schema: JsonSchema.JsonSchemaSchema,
|
|
973
|
-
})
|
|
974
|
-
.describe("The response will conform to the provided JSON schema.");
|
|
1067
|
+
.describe("The response will be a JSON object.")
|
|
1068
|
+
.meta({ title: "ResponseFormatJsonObject" });
|
|
975
1069
|
let JsonSchema;
|
|
976
1070
|
(function (JsonSchema) {
|
|
977
1071
|
JsonSchema.JsonSchemaSchema = zod_1.default
|
|
@@ -992,8 +1086,16 @@ var Chat;
|
|
|
992
1086
|
.nullable()
|
|
993
1087
|
.describe("Whether to enforce strict adherence to the JSON schema."),
|
|
994
1088
|
})
|
|
995
|
-
.describe("A JSON schema definition for constraining model output.")
|
|
1089
|
+
.describe("A JSON schema definition for constraining model output.")
|
|
1090
|
+
.meta({ title: "ResponseFormatJsonSchemaJsonSchema" });
|
|
996
1091
|
})(JsonSchema = ResponseFormat.JsonSchema || (ResponseFormat.JsonSchema = {}));
|
|
1092
|
+
ResponseFormat.JsonSchemaSchema = zod_1.default
|
|
1093
|
+
.object({
|
|
1094
|
+
type: zod_1.default.literal("json_schema"),
|
|
1095
|
+
json_schema: JsonSchema.JsonSchemaSchema,
|
|
1096
|
+
})
|
|
1097
|
+
.describe("The response will conform to the provided JSON schema.")
|
|
1098
|
+
.meta({ title: "ResponseFormatJsonSchema" });
|
|
997
1099
|
ResponseFormat.GrammarSchema = zod_1.default
|
|
998
1100
|
.object({
|
|
999
1101
|
type: zod_1.default.literal("grammar"),
|
|
@@ -1001,50 +1103,56 @@ var Chat;
|
|
|
1001
1103
|
.string()
|
|
1002
1104
|
.describe("The grammar definition to constrain the response."),
|
|
1003
1105
|
})
|
|
1004
|
-
.describe("The response will conform to the provided grammar definition.")
|
|
1106
|
+
.describe("The response will conform to the provided grammar definition.")
|
|
1107
|
+
.meta({ title: "ResponseFormatGrammar" });
|
|
1005
1108
|
ResponseFormat.PythonSchema = zod_1.default
|
|
1006
1109
|
.object({
|
|
1007
1110
|
type: zod_1.default.literal("python"),
|
|
1008
1111
|
})
|
|
1009
|
-
.describe("The response will be Python code.")
|
|
1112
|
+
.describe("The response will be Python code.")
|
|
1113
|
+
.meta({ title: "ResponseFormatPython" });
|
|
1010
1114
|
})(ResponseFormat = Request.ResponseFormat || (Request.ResponseFormat = {}));
|
|
1011
|
-
Request.
|
|
1115
|
+
Request.ResponseFormatSchema = zod_1.default
|
|
1012
1116
|
.union([
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1117
|
+
ResponseFormat.TextSchema,
|
|
1118
|
+
ResponseFormat.JsonObjectSchema,
|
|
1119
|
+
ResponseFormat.JsonSchemaSchema,
|
|
1120
|
+
ResponseFormat.GrammarSchema,
|
|
1121
|
+
ResponseFormat.PythonSchema,
|
|
1017
1122
|
])
|
|
1018
|
-
.describe("
|
|
1123
|
+
.describe("The desired format of the model's response.")
|
|
1124
|
+
.meta({ title: "ResponseFormat" });
|
|
1019
1125
|
let ToolChoice;
|
|
1020
1126
|
(function (ToolChoice) {
|
|
1021
|
-
ToolChoice.FunctionSchema = zod_1.default
|
|
1022
|
-
.object({
|
|
1023
|
-
type: zod_1.default.literal("function"),
|
|
1024
|
-
function: Function.FunctionSchema,
|
|
1025
|
-
})
|
|
1026
|
-
.describe("Specify a function for the assistant to call.");
|
|
1027
1127
|
let Function;
|
|
1028
1128
|
(function (Function) {
|
|
1029
|
-
Function.FunctionSchema = zod_1.default
|
|
1129
|
+
Function.FunctionSchema = zod_1.default
|
|
1130
|
+
.object({
|
|
1030
1131
|
name: zod_1.default
|
|
1031
1132
|
.string()
|
|
1032
1133
|
.describe("The name of the function the assistant will call."),
|
|
1033
|
-
})
|
|
1134
|
+
})
|
|
1135
|
+
.meta({ title: "ToolChoiceFunctionFunction" });
|
|
1034
1136
|
})(Function = ToolChoice.Function || (ToolChoice.Function = {}));
|
|
1137
|
+
ToolChoice.FunctionSchema = zod_1.default
|
|
1138
|
+
.object({
|
|
1139
|
+
type: zod_1.default.literal("function"),
|
|
1140
|
+
function: Function.FunctionSchema,
|
|
1141
|
+
})
|
|
1142
|
+
.describe("Specify a function for the assistant to call.")
|
|
1143
|
+
.meta({ title: "ToolChoiceFunction" });
|
|
1035
1144
|
})(ToolChoice = Request.ToolChoice || (Request.ToolChoice = {}));
|
|
1036
|
-
Request.
|
|
1037
|
-
.
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
.
|
|
1145
|
+
Request.ToolChoiceSchema = zod_1.default
|
|
1146
|
+
.union([
|
|
1147
|
+
zod_1.default.literal("none"),
|
|
1148
|
+
zod_1.default.literal("auto"),
|
|
1149
|
+
zod_1.default.literal("required"),
|
|
1150
|
+
ToolChoice.FunctionSchema,
|
|
1151
|
+
])
|
|
1152
|
+
.describe("Specifies tool call behavior for the assistant.")
|
|
1153
|
+
.meta({ title: "ToolChoice" });
|
|
1042
1154
|
let Prediction;
|
|
1043
1155
|
(function (Prediction) {
|
|
1044
|
-
Prediction.ContentSchema = zod_1.default.union([
|
|
1045
|
-
zod_1.default.string(),
|
|
1046
|
-
zod_1.default.array(Content.PartSchema),
|
|
1047
|
-
]);
|
|
1048
1156
|
let Content;
|
|
1049
1157
|
(function (Content) {
|
|
1050
1158
|
Content.PartSchema = zod_1.default
|
|
@@ -1052,9 +1160,20 @@ var Chat;
|
|
|
1052
1160
|
type: zod_1.default.literal("text"),
|
|
1053
1161
|
text: zod_1.default.string(),
|
|
1054
1162
|
})
|
|
1055
|
-
.describe("A part of the predicted content.")
|
|
1163
|
+
.describe("A part of the predicted content.")
|
|
1164
|
+
.meta({ title: "PredictionContentPart" });
|
|
1056
1165
|
})(Content = Prediction.Content || (Prediction.Content = {}));
|
|
1166
|
+
Prediction.ContentSchema = zod_1.default.union([
|
|
1167
|
+
zod_1.default.string().meta({ title: "PredictionContentText" }),
|
|
1168
|
+
zod_1.default.array(Content.PartSchema).meta({ title: "PredictionContentParts" }),
|
|
1169
|
+
]);
|
|
1057
1170
|
})(Prediction = Request.Prediction || (Request.Prediction = {}));
|
|
1171
|
+
Request.PredictionSchema = zod_1.default
|
|
1172
|
+
.object({
|
|
1173
|
+
type: zod_1.default.literal("content"),
|
|
1174
|
+
content: Prediction.ContentSchema,
|
|
1175
|
+
})
|
|
1176
|
+
.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.");
|
|
1058
1177
|
Request.SeedSchema = zod_1.default
|
|
1059
1178
|
.bigint()
|
|
1060
1179
|
.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.");
|
|
@@ -1104,53 +1223,30 @@ var Chat;
|
|
|
1104
1223
|
.describe("Whether to stream the response as a series of chunks.");
|
|
1105
1224
|
Request.ChatCompletionCreateParamsStreamingSchema = Request.ChatCompletionCreateParamsBaseSchema.extend({
|
|
1106
1225
|
stream: Request.StreamTrueSchema,
|
|
1107
|
-
})
|
|
1226
|
+
})
|
|
1227
|
+
.describe("Parameters for creating a streaming chat completion.")
|
|
1228
|
+
.meta({ title: "ChatCompletionCreateParamsStreaming" });
|
|
1108
1229
|
Request.StreamFalseSchema = zod_1.default
|
|
1109
1230
|
.literal(false)
|
|
1110
1231
|
.describe("Whether to stream the response as a series of chunks.");
|
|
1111
1232
|
Request.ChatCompletionCreateParamsNonStreamingSchema = Request.ChatCompletionCreateParamsBaseSchema.extend({
|
|
1112
1233
|
stream: Request.StreamFalseSchema.optional().nullable(),
|
|
1113
|
-
})
|
|
1234
|
+
})
|
|
1235
|
+
.describe("Parameters for creating a unary chat completion.")
|
|
1236
|
+
.meta({ title: "ChatCompletionCreateParamsNonStreaming" });
|
|
1114
1237
|
Request.ChatCompletionCreateParamsSchema = zod_1.default
|
|
1115
1238
|
.union([
|
|
1116
1239
|
Request.ChatCompletionCreateParamsStreamingSchema,
|
|
1117
1240
|
Request.ChatCompletionCreateParamsNonStreamingSchema,
|
|
1118
1241
|
])
|
|
1119
|
-
.describe("Parameters for creating a chat completion.")
|
|
1242
|
+
.describe("Parameters for creating a chat completion.")
|
|
1243
|
+
.meta({ title: "ChatCompletionCreateParams" });
|
|
1120
1244
|
})(Request = Completions.Request || (Completions.Request = {}));
|
|
1121
1245
|
let Response;
|
|
1122
1246
|
(function (Response) {
|
|
1123
1247
|
Response.FinishReasonSchema = zod_1.default
|
|
1124
1248
|
.enum(["stop", "length", "tool_calls", "content_filter", "error"])
|
|
1125
1249
|
.describe("The reason why the assistant ceased to generate further tokens.");
|
|
1126
|
-
Response.UsageSchema = zod_1.default
|
|
1127
|
-
.object({
|
|
1128
|
-
completion_tokens: zod_1.default
|
|
1129
|
-
.uint32()
|
|
1130
|
-
.describe("The number of tokens generated in the completion."),
|
|
1131
|
-
prompt_tokens: zod_1.default
|
|
1132
|
-
.uint32()
|
|
1133
|
-
.describe("The number of tokens in the prompt."),
|
|
1134
|
-
total_tokens: zod_1.default
|
|
1135
|
-
.uint32()
|
|
1136
|
-
.describe("The total number of tokens used in the prompt or generated in the completion."),
|
|
1137
|
-
completion_tokens_details: Usage.CompletionTokensDetailsSchema.optional(),
|
|
1138
|
-
prompt_tokens_details: Usage.PromptTokensDetailsSchema.optional(),
|
|
1139
|
-
cost: zod_1.default
|
|
1140
|
-
.number()
|
|
1141
|
-
.describe("The cost in credits incurred for this completion."),
|
|
1142
|
-
cost_details: Usage.CostDetailsSchema.optional(),
|
|
1143
|
-
total_cost: zod_1.default
|
|
1144
|
-
.number()
|
|
1145
|
-
.describe("The total cost in credits incurred including upstream costs."),
|
|
1146
|
-
cost_multiplier: zod_1.default
|
|
1147
|
-
.number()
|
|
1148
|
-
.describe("The cost multiplier applied to upstream costs for computing ObjectiveAI costs."),
|
|
1149
|
-
is_byok: zod_1.default
|
|
1150
|
-
.boolean()
|
|
1151
|
-
.describe("Whether the completion used a BYOK (Bring Your Own Key) API Key."),
|
|
1152
|
-
})
|
|
1153
|
-
.describe("Token and cost usage statistics for the completion.");
|
|
1154
1250
|
let Usage;
|
|
1155
1251
|
(function (Usage) {
|
|
1156
1252
|
Usage.CompletionTokensDetailsSchema = zod_1.default
|
|
@@ -1206,20 +1302,34 @@ var Chat;
|
|
|
1206
1302
|
})
|
|
1207
1303
|
.describe("Detailed breakdown of upstream costs incurred.");
|
|
1208
1304
|
})(Usage = Response.Usage || (Response.Usage = {}));
|
|
1209
|
-
Response.
|
|
1305
|
+
Response.UsageSchema = zod_1.default
|
|
1210
1306
|
.object({
|
|
1211
|
-
|
|
1212
|
-
.
|
|
1213
|
-
.
|
|
1214
|
-
|
|
1215
|
-
.
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
.
|
|
1219
|
-
.
|
|
1220
|
-
|
|
1307
|
+
completion_tokens: zod_1.default
|
|
1308
|
+
.uint32()
|
|
1309
|
+
.describe("The number of tokens generated in the completion."),
|
|
1310
|
+
prompt_tokens: zod_1.default
|
|
1311
|
+
.uint32()
|
|
1312
|
+
.describe("The number of tokens in the prompt."),
|
|
1313
|
+
total_tokens: zod_1.default
|
|
1314
|
+
.uint32()
|
|
1315
|
+
.describe("The total number of tokens used in the prompt or generated in the completion."),
|
|
1316
|
+
completion_tokens_details: Usage.CompletionTokensDetailsSchema.optional(),
|
|
1317
|
+
prompt_tokens_details: Usage.PromptTokensDetailsSchema.optional(),
|
|
1318
|
+
cost: zod_1.default
|
|
1319
|
+
.number()
|
|
1320
|
+
.describe("The cost in credits incurred for this completion."),
|
|
1321
|
+
cost_details: Usage.CostDetailsSchema.optional(),
|
|
1322
|
+
total_cost: zod_1.default
|
|
1323
|
+
.number()
|
|
1324
|
+
.describe("The total cost in credits incurred including upstream costs."),
|
|
1325
|
+
cost_multiplier: zod_1.default
|
|
1326
|
+
.number()
|
|
1327
|
+
.describe("The cost multiplier applied to upstream costs for computing ObjectiveAI costs."),
|
|
1328
|
+
is_byok: zod_1.default
|
|
1329
|
+
.boolean()
|
|
1330
|
+
.describe("Whether the completion used a BYOK (Bring Your Own Key) API Key."),
|
|
1221
1331
|
})
|
|
1222
|
-
.describe("
|
|
1332
|
+
.describe("Token and cost usage statistics for the completion.");
|
|
1223
1333
|
let Logprobs;
|
|
1224
1334
|
(function (Logprobs) {
|
|
1225
1335
|
function merged(a, b) {
|
|
@@ -1233,24 +1343,6 @@ var Chat;
|
|
|
1233
1343
|
}
|
|
1234
1344
|
}
|
|
1235
1345
|
Logprobs.merged = merged;
|
|
1236
|
-
Logprobs.LogprobSchema = zod_1.default
|
|
1237
|
-
.object({
|
|
1238
|
-
token: zod_1.default
|
|
1239
|
-
.string()
|
|
1240
|
-
.describe("The token string which was selected by the sampler."),
|
|
1241
|
-
bytes: zod_1.default
|
|
1242
|
-
.array(zod_1.default.uint32())
|
|
1243
|
-
.optional()
|
|
1244
|
-
.nullable()
|
|
1245
|
-
.describe("The byte representation of the token which was selected by the sampler."),
|
|
1246
|
-
logprob: zod_1.default
|
|
1247
|
-
.number()
|
|
1248
|
-
.describe("The log probability of the token which was selected by the sampler."),
|
|
1249
|
-
top_logprobs: zod_1.default
|
|
1250
|
-
.array(Logprob.TopLogprobSchema)
|
|
1251
|
-
.describe("The log probabilities of the top tokens for this position."),
|
|
1252
|
-
})
|
|
1253
|
-
.describe("The token which was selected by the sampler for this position as well as the logprobabilities of the top options.");
|
|
1254
1346
|
let Logprob;
|
|
1255
1347
|
(function (Logprob) {
|
|
1256
1348
|
function mergedList(a, b) {
|
|
@@ -1281,13 +1373,42 @@ var Chat;
|
|
|
1281
1373
|
})
|
|
1282
1374
|
.describe("The log probability of a token in the list of top tokens.");
|
|
1283
1375
|
})(Logprob = Logprobs.Logprob || (Logprobs.Logprob = {}));
|
|
1376
|
+
Logprobs.LogprobSchema = zod_1.default
|
|
1377
|
+
.object({
|
|
1378
|
+
token: zod_1.default
|
|
1379
|
+
.string()
|
|
1380
|
+
.describe("The token string which was selected by the sampler."),
|
|
1381
|
+
bytes: zod_1.default
|
|
1382
|
+
.array(zod_1.default.uint32())
|
|
1383
|
+
.optional()
|
|
1384
|
+
.nullable()
|
|
1385
|
+
.describe("The byte representation of the token which was selected by the sampler."),
|
|
1386
|
+
logprob: zod_1.default
|
|
1387
|
+
.number()
|
|
1388
|
+
.describe("The log probability of the token which was selected by the sampler."),
|
|
1389
|
+
top_logprobs: zod_1.default
|
|
1390
|
+
.array(Logprob.TopLogprobSchema)
|
|
1391
|
+
.describe("The log probabilities of the top tokens for this position."),
|
|
1392
|
+
})
|
|
1393
|
+
.describe("The token which was selected by the sampler for this position as well as the logprobabilities of the top options.");
|
|
1284
1394
|
})(Logprobs = Response.Logprobs || (Response.Logprobs = {}));
|
|
1395
|
+
Response.LogprobsSchema = zod_1.default
|
|
1396
|
+
.object({
|
|
1397
|
+
content: zod_1.default
|
|
1398
|
+
.array(Logprobs.LogprobSchema)
|
|
1399
|
+
.optional()
|
|
1400
|
+
.nullable()
|
|
1401
|
+
.describe("The log probabilities of the tokens in the content."),
|
|
1402
|
+
refusal: zod_1.default
|
|
1403
|
+
.array(Logprobs.LogprobSchema)
|
|
1404
|
+
.optional()
|
|
1405
|
+
.nullable()
|
|
1406
|
+
.describe("The log probabilities of the tokens in the refusal."),
|
|
1407
|
+
})
|
|
1408
|
+
.describe("The log probabilities of the tokens generated by the model.");
|
|
1285
1409
|
Response.RoleSchema = zod_1.default
|
|
1286
1410
|
.enum(["assistant"])
|
|
1287
1411
|
.describe("The role of the message author.");
|
|
1288
|
-
Response.ImageSchema = zod_1.default
|
|
1289
|
-
.union([Image.ImageUrlSchema])
|
|
1290
|
-
.describe("An image generated by the model.");
|
|
1291
1412
|
let Image;
|
|
1292
1413
|
(function (Image) {
|
|
1293
1414
|
function mergedList(a, b) {
|
|
@@ -1309,11 +1430,11 @@ var Chat;
|
|
|
1309
1430
|
}),
|
|
1310
1431
|
});
|
|
1311
1432
|
})(Image = Response.Image || (Response.Image = {}));
|
|
1433
|
+
Response.ImageSchema = zod_1.default
|
|
1434
|
+
.union([Image.ImageUrlSchema])
|
|
1435
|
+
.describe("An image generated by the model.");
|
|
1312
1436
|
let Streaming;
|
|
1313
1437
|
(function (Streaming) {
|
|
1314
|
-
Streaming.ToolCallSchema = zod_1.default
|
|
1315
|
-
.union([ToolCall.FunctionSchema])
|
|
1316
|
-
.describe("A tool call made by the assistant.");
|
|
1317
1438
|
let ToolCall;
|
|
1318
1439
|
(function (ToolCall) {
|
|
1319
1440
|
function merged(a, b) {
|
|
@@ -1345,19 +1466,6 @@ var Chat;
|
|
|
1345
1466
|
return merged ? [merged, true] : [a, false];
|
|
1346
1467
|
}
|
|
1347
1468
|
ToolCall.mergedList = mergedList;
|
|
1348
|
-
ToolCall.FunctionSchema = zod_1.default
|
|
1349
|
-
.object({
|
|
1350
|
-
index: zod_1.default
|
|
1351
|
-
.uint32()
|
|
1352
|
-
.describe("The index of the tool call in the sequence of tool calls."),
|
|
1353
|
-
type: zod_1.default.literal("function").optional(),
|
|
1354
|
-
id: zod_1.default
|
|
1355
|
-
.string()
|
|
1356
|
-
.optional()
|
|
1357
|
-
.describe("The unique identifier of the function tool."),
|
|
1358
|
-
function: Function.DefinitionSchema.optional(),
|
|
1359
|
-
})
|
|
1360
|
-
.describe("A function tool call made by the assistant.");
|
|
1361
1469
|
let Function;
|
|
1362
1470
|
(function (Function) {
|
|
1363
1471
|
function merged(a, b) {
|
|
@@ -1376,13 +1484,6 @@ var Chat;
|
|
|
1376
1484
|
}
|
|
1377
1485
|
}
|
|
1378
1486
|
Function.merged = merged;
|
|
1379
|
-
Function.DefinitionSchema = zod_1.default.object({
|
|
1380
|
-
name: zod_1.default.string().optional().describe("The name of the function."),
|
|
1381
|
-
arguments: zod_1.default
|
|
1382
|
-
.string()
|
|
1383
|
-
.optional()
|
|
1384
|
-
.describe("The arguments passed to the function."),
|
|
1385
|
-
});
|
|
1386
1487
|
let Definition;
|
|
1387
1488
|
(function (Definition) {
|
|
1388
1489
|
function merged(a, b) {
|
|
@@ -1402,8 +1503,31 @@ var Chat;
|
|
|
1402
1503
|
}
|
|
1403
1504
|
Definition.merged = merged;
|
|
1404
1505
|
})(Definition = Function.Definition || (Function.Definition = {}));
|
|
1506
|
+
Function.DefinitionSchema = zod_1.default.object({
|
|
1507
|
+
name: zod_1.default.string().optional().describe("The name of the function."),
|
|
1508
|
+
arguments: zod_1.default
|
|
1509
|
+
.string()
|
|
1510
|
+
.optional()
|
|
1511
|
+
.describe("The arguments passed to the function."),
|
|
1512
|
+
});
|
|
1405
1513
|
})(Function = ToolCall.Function || (ToolCall.Function = {}));
|
|
1514
|
+
ToolCall.FunctionSchema = zod_1.default
|
|
1515
|
+
.object({
|
|
1516
|
+
index: zod_1.default
|
|
1517
|
+
.uint32()
|
|
1518
|
+
.describe("The index of the tool call in the sequence of tool calls."),
|
|
1519
|
+
type: zod_1.default.literal("function").optional(),
|
|
1520
|
+
id: zod_1.default
|
|
1521
|
+
.string()
|
|
1522
|
+
.optional()
|
|
1523
|
+
.describe("The unique identifier of the function tool."),
|
|
1524
|
+
function: Function.DefinitionSchema.optional(),
|
|
1525
|
+
})
|
|
1526
|
+
.describe("A function tool call made by the assistant.");
|
|
1406
1527
|
})(ToolCall = Streaming.ToolCall || (Streaming.ToolCall = {}));
|
|
1528
|
+
Streaming.ToolCallSchema = zod_1.default
|
|
1529
|
+
.union([ToolCall.FunctionSchema])
|
|
1530
|
+
.describe("A tool call made by the assistant.");
|
|
1407
1531
|
Streaming.DeltaSchema = zod_1.default
|
|
1408
1532
|
.object({
|
|
1409
1533
|
content: zod_1.default
|
|
@@ -1582,20 +1706,8 @@ var Chat;
|
|
|
1582
1706
|
})(Streaming = Response.Streaming || (Response.Streaming = {}));
|
|
1583
1707
|
let Unary;
|
|
1584
1708
|
(function (Unary) {
|
|
1585
|
-
Unary.ToolCallSchema = zod_1.default
|
|
1586
|
-
.union([ToolCall.FunctionSchema])
|
|
1587
|
-
.describe(Streaming.ToolCallSchema.description);
|
|
1588
1709
|
let ToolCall;
|
|
1589
1710
|
(function (ToolCall) {
|
|
1590
|
-
ToolCall.FunctionSchema = zod_1.default
|
|
1591
|
-
.object({
|
|
1592
|
-
type: zod_1.default.literal("function"),
|
|
1593
|
-
id: zod_1.default
|
|
1594
|
-
.string()
|
|
1595
|
-
.describe(Streaming.ToolCall.FunctionSchema.shape.id.description),
|
|
1596
|
-
function: Function.DefinitionSchema,
|
|
1597
|
-
})
|
|
1598
|
-
.describe(Streaming.ToolCall.FunctionSchema.description);
|
|
1599
1711
|
let Function;
|
|
1600
1712
|
(function (Function) {
|
|
1601
1713
|
Function.DefinitionSchema = zod_1.default.object({
|
|
@@ -1609,7 +1721,19 @@ var Chat;
|
|
|
1609
1721
|
.description),
|
|
1610
1722
|
});
|
|
1611
1723
|
})(Function = ToolCall.Function || (ToolCall.Function = {}));
|
|
1724
|
+
ToolCall.FunctionSchema = zod_1.default
|
|
1725
|
+
.object({
|
|
1726
|
+
type: zod_1.default.literal("function"),
|
|
1727
|
+
id: zod_1.default
|
|
1728
|
+
.string()
|
|
1729
|
+
.describe(Streaming.ToolCall.FunctionSchema.shape.id.description),
|
|
1730
|
+
function: Function.DefinitionSchema,
|
|
1731
|
+
})
|
|
1732
|
+
.describe(Streaming.ToolCall.FunctionSchema.description);
|
|
1612
1733
|
})(ToolCall = Unary.ToolCall || (Unary.ToolCall = {}));
|
|
1734
|
+
Unary.ToolCallSchema = zod_1.default
|
|
1735
|
+
.union([ToolCall.FunctionSchema])
|
|
1736
|
+
.describe(Streaming.ToolCallSchema.description);
|
|
1613
1737
|
Unary.MessageSchema = zod_1.default
|
|
1614
1738
|
.object({
|
|
1615
1739
|
content: zod_1.default
|
|
@@ -1721,19 +1845,43 @@ var Vector;
|
|
|
1721
1845
|
.describe("Base parameters for creating a vector completion.");
|
|
1722
1846
|
Request.VectorCompletionCreateParamsStreamingSchema = Request.VectorCompletionCreateParamsBaseSchema.extend({
|
|
1723
1847
|
stream: Chat.Completions.Request.StreamTrueSchema,
|
|
1724
|
-
})
|
|
1848
|
+
})
|
|
1849
|
+
.describe("Parameters for creating a streaming vector completion.")
|
|
1850
|
+
.meta({ title: "VectorCompletionCreateParamsStreaming" });
|
|
1725
1851
|
Request.VectorCompletionCreateParamsNonStreamingSchema = Request.VectorCompletionCreateParamsBaseSchema.extend({
|
|
1726
1852
|
stream: Chat.Completions.Request.StreamFalseSchema.optional().nullable(),
|
|
1727
|
-
})
|
|
1853
|
+
})
|
|
1854
|
+
.describe("Parameters for creating a unary vector completion.")
|
|
1855
|
+
.meta({ title: "VectorCompletionCreateParamsNonStreaming" });
|
|
1728
1856
|
Request.VectorCompletionCreateParamsSchema = zod_1.default
|
|
1729
1857
|
.union([
|
|
1730
1858
|
Request.VectorCompletionCreateParamsStreamingSchema,
|
|
1731
1859
|
Request.VectorCompletionCreateParamsNonStreamingSchema,
|
|
1732
1860
|
])
|
|
1733
|
-
.describe("Parameters for creating a vector completion.")
|
|
1861
|
+
.describe("Parameters for creating a vector completion.")
|
|
1862
|
+
.meta({ title: "VectorCompletionCreateParams" });
|
|
1734
1863
|
})(Request = Completions.Request || (Completions.Request = {}));
|
|
1735
1864
|
let Response;
|
|
1736
1865
|
(function (Response) {
|
|
1866
|
+
let Vote;
|
|
1867
|
+
(function (Vote) {
|
|
1868
|
+
function mergedList(a, b) {
|
|
1869
|
+
let merged = undefined;
|
|
1870
|
+
for (const vote of b) {
|
|
1871
|
+
const existingIndex = a.findIndex(({ flat_ensemble_index }) => flat_ensemble_index === vote.flat_ensemble_index);
|
|
1872
|
+
if (existingIndex === -1) {
|
|
1873
|
+
if (merged === undefined) {
|
|
1874
|
+
merged = [...a, vote];
|
|
1875
|
+
}
|
|
1876
|
+
else {
|
|
1877
|
+
merged.push(vote);
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
return merged ? [merged, true] : [a, false];
|
|
1882
|
+
}
|
|
1883
|
+
Vote.mergedList = mergedList;
|
|
1884
|
+
})(Vote = Response.Vote || (Response.Vote = {}));
|
|
1737
1885
|
Response.VoteSchema = zod_1.default
|
|
1738
1886
|
.object({
|
|
1739
1887
|
model: zod_1.default
|
|
@@ -1755,25 +1903,42 @@ var Vector;
|
|
|
1755
1903
|
.describe("Whether this vote came from a previous Vector Completion which was retried."),
|
|
1756
1904
|
})
|
|
1757
1905
|
.describe("A vote from an Ensemble LLM within a Vector Completion.");
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
else {
|
|
1769
|
-
merged.push(vote);
|
|
1906
|
+
Response.VotesSchema = zod_1.default
|
|
1907
|
+
.array(Response.VoteSchema)
|
|
1908
|
+
.describe("The list of votes for responses in the request from the Ensemble LLMs within the provided Ensemble.");
|
|
1909
|
+
let Scores;
|
|
1910
|
+
(function (Scores) {
|
|
1911
|
+
function merged(a, b) {
|
|
1912
|
+
if (a.length === b.length) {
|
|
1913
|
+
for (let i = 0; i < a.length; i++) {
|
|
1914
|
+
if (a[i] !== b[i]) {
|
|
1915
|
+
return [b, true];
|
|
1770
1916
|
}
|
|
1771
1917
|
}
|
|
1918
|
+
return [a, false];
|
|
1919
|
+
}
|
|
1920
|
+
else {
|
|
1921
|
+
return [b, true];
|
|
1772
1922
|
}
|
|
1773
|
-
return merged ? [merged, true] : [a, false];
|
|
1774
1923
|
}
|
|
1775
|
-
|
|
1776
|
-
})(
|
|
1924
|
+
Scores.merged = merged;
|
|
1925
|
+
})(Scores = Response.Scores || (Response.Scores = {}));
|
|
1926
|
+
Response.ScoresSchema = zod_1.default
|
|
1927
|
+
.array(zod_1.default.number())
|
|
1928
|
+
.describe("The scores for each response in the request, aggregated from the votes of the Ensemble LLMs.");
|
|
1929
|
+
let Weights;
|
|
1930
|
+
(function (Weights) {
|
|
1931
|
+
function merged(a, b) {
|
|
1932
|
+
return Scores.merged(a, b);
|
|
1933
|
+
}
|
|
1934
|
+
Weights.merged = merged;
|
|
1935
|
+
})(Weights = Response.Weights || (Response.Weights = {}));
|
|
1936
|
+
Response.WeightsSchema = zod_1.default
|
|
1937
|
+
.array(zod_1.default.number())
|
|
1938
|
+
.describe("The weights assigned to each response in the request, aggregated from the votes of the Ensemble LLMs.");
|
|
1939
|
+
Response.EnsembleSchema = zod_1.default
|
|
1940
|
+
.string()
|
|
1941
|
+
.describe("The unique identifier of the Ensemble used for this vector completion.");
|
|
1777
1942
|
Response.UsageSchema = zod_1.default
|
|
1778
1943
|
.object({
|
|
1779
1944
|
completion_tokens: zod_1.default
|
|
@@ -1796,26 +1961,8 @@ var Vector;
|
|
|
1796
1961
|
.describe("The total cost in credits incurred including upstream costs."),
|
|
1797
1962
|
})
|
|
1798
1963
|
.describe("Token and cost usage statistics for the completion.");
|
|
1799
|
-
Response.VotesSchema = zod_1.default
|
|
1800
|
-
.array(Response.VoteSchema)
|
|
1801
|
-
.describe("The list of votes for responses in the request from the Ensemble LLMs within the provided Ensemble.");
|
|
1802
|
-
Response.ScoresSchema = zod_1.default
|
|
1803
|
-
.array(zod_1.default.number())
|
|
1804
|
-
.describe("The scores for each response in the request, aggregated from the votes of the Ensemble LLMs.");
|
|
1805
|
-
Response.WeightsSchema = zod_1.default
|
|
1806
|
-
.array(zod_1.default.number())
|
|
1807
|
-
.describe("The weights assigned to each response in the request, aggregated from the votes of the Ensemble LLMs.");
|
|
1808
|
-
Response.EnsembleSchema = zod_1.default
|
|
1809
|
-
.string()
|
|
1810
|
-
.describe("The unique identifier of the Ensemble used for this vector completion.");
|
|
1811
1964
|
let Streaming;
|
|
1812
1965
|
(function (Streaming) {
|
|
1813
|
-
Streaming.ChatCompletionChunkSchema = Chat.Completions.Response.Streaming.ChatCompletionChunkSchema.extend({
|
|
1814
|
-
index: zod_1.default
|
|
1815
|
-
.uint32()
|
|
1816
|
-
.describe("The index of the completion amongst all chat completions."),
|
|
1817
|
-
error: exports.ObjectiveAIErrorSchema.optional().describe("An error encountered during the generation of this chat completion."),
|
|
1818
|
-
}).describe("A chat completion chunk generated in the pursuit of a vector completion.");
|
|
1819
1966
|
let ChatCompletionChunk;
|
|
1820
1967
|
(function (ChatCompletionChunk) {
|
|
1821
1968
|
function merged(a, b) {
|
|
@@ -1859,25 +2006,12 @@ var Vector;
|
|
|
1859
2006
|
}
|
|
1860
2007
|
ChatCompletionChunk.mergedList = mergedList;
|
|
1861
2008
|
})(ChatCompletionChunk = Streaming.ChatCompletionChunk || (Streaming.ChatCompletionChunk = {}));
|
|
1862
|
-
Streaming.
|
|
1863
|
-
.
|
|
1864
|
-
id: zod_1.default
|
|
1865
|
-
.string()
|
|
1866
|
-
.describe("The unique identifier of the vector completion."),
|
|
1867
|
-
completions: zod_1.default
|
|
1868
|
-
.array(Streaming.ChatCompletionChunkSchema)
|
|
1869
|
-
.describe("The list of chat completion chunks created for this vector completion."),
|
|
1870
|
-
votes: Response.VotesSchema,
|
|
1871
|
-
scores: Response.ScoresSchema,
|
|
1872
|
-
weights: Response.WeightsSchema,
|
|
1873
|
-
created: zod_1.default
|
|
2009
|
+
Streaming.ChatCompletionChunkSchema = Chat.Completions.Response.Streaming.ChatCompletionChunkSchema.extend({
|
|
2010
|
+
index: zod_1.default
|
|
1874
2011
|
.uint32()
|
|
1875
|
-
.describe("The
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
usage: Response.UsageSchema.optional(),
|
|
1879
|
-
})
|
|
1880
|
-
.describe("A chunk in a streaming vector completion response.");
|
|
2012
|
+
.describe("The index of the completion amongst all chat completions."),
|
|
2013
|
+
error: exports.ObjectiveAIErrorSchema.optional().describe("An error encountered during the generation of this chat completion."),
|
|
2014
|
+
}).describe("A chat completion chunk generated in the pursuit of a vector completion.");
|
|
1881
2015
|
let VectorCompletionChunk;
|
|
1882
2016
|
(function (VectorCompletionChunk) {
|
|
1883
2017
|
function merged(a, b) {
|
|
@@ -1913,30 +2047,25 @@ var Vector;
|
|
|
1913
2047
|
}
|
|
1914
2048
|
VectorCompletionChunk.merged = merged;
|
|
1915
2049
|
})(VectorCompletionChunk = Streaming.VectorCompletionChunk || (Streaming.VectorCompletionChunk = {}));
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
function merged(a, b) {
|
|
1936
|
-
return Scores.merged(a, b);
|
|
1937
|
-
}
|
|
1938
|
-
Weights.merged = merged;
|
|
1939
|
-
})(Weights = Streaming.Weights || (Streaming.Weights = {}));
|
|
2050
|
+
Streaming.VectorCompletionChunkSchema = zod_1.default
|
|
2051
|
+
.object({
|
|
2052
|
+
id: zod_1.default
|
|
2053
|
+
.string()
|
|
2054
|
+
.describe("The unique identifier of the vector completion."),
|
|
2055
|
+
completions: zod_1.default
|
|
2056
|
+
.array(Streaming.ChatCompletionChunkSchema)
|
|
2057
|
+
.describe("The list of chat completion chunks created for this vector completion."),
|
|
2058
|
+
votes: Response.VotesSchema,
|
|
2059
|
+
scores: Response.ScoresSchema,
|
|
2060
|
+
weights: Response.WeightsSchema,
|
|
2061
|
+
created: zod_1.default
|
|
2062
|
+
.uint32()
|
|
2063
|
+
.describe("The Unix timestamp (in seconds) when the vector completion was created."),
|
|
2064
|
+
ensemble: Response.EnsembleSchema,
|
|
2065
|
+
object: zod_1.default.literal("vector.completion.chunk"),
|
|
2066
|
+
usage: Response.UsageSchema.optional(),
|
|
2067
|
+
})
|
|
2068
|
+
.describe("A chunk in a streaming vector completion response.");
|
|
1940
2069
|
})(Streaming = Response.Streaming || (Response.Streaming = {}));
|
|
1941
2070
|
let Unary;
|
|
1942
2071
|
(function (Unary) {
|
|
@@ -1975,10 +2104,7 @@ var Vector;
|
|
|
1975
2104
|
Completions.create = create;
|
|
1976
2105
|
})(Completions = Vector.Completions || (Vector.Completions = {}));
|
|
1977
2106
|
})(Vector || (exports.Vector = Vector = {}));
|
|
1978
|
-
// Function
|
|
1979
|
-
exports.FunctionSchema = zod_1.default
|
|
1980
|
-
.discriminatedUnion("type", [Function.ScalarSchema, Function.VectorSchema])
|
|
1981
|
-
.describe("A function.");
|
|
2107
|
+
// Function
|
|
1982
2108
|
var Function;
|
|
1983
2109
|
(function (Function_1) {
|
|
1984
2110
|
Function_1.VectorCompletionProfileSchema = zod_1.default
|
|
@@ -2000,7 +2126,10 @@ var Function;
|
|
|
2000
2126
|
id: zod_1.default.string().describe("The unique identifier of the profile."),
|
|
2001
2127
|
version: zod_1.default.uint32().describe("The version of the profile."),
|
|
2002
2128
|
}),
|
|
2003
|
-
zod_1.default.lazy(() => zod_1.default.array(Function_1.ProfileVersionRequiredSchema)
|
|
2129
|
+
zod_1.default.lazy(() => zod_1.default.array(Function_1.ProfileVersionRequiredSchema).meta({
|
|
2130
|
+
title: "ProfileVersionRequiredArray",
|
|
2131
|
+
recursive: true,
|
|
2132
|
+
})),
|
|
2004
2133
|
])
|
|
2005
2134
|
.describe("A function profile where remote profiles must specify a version.");
|
|
2006
2135
|
Function_1.FunctionProfileVersionOptionalSchema = zod_1.default
|
|
@@ -2020,7 +2149,12 @@ var Function;
|
|
|
2020
2149
|
.nullable()
|
|
2021
2150
|
.describe("The version of the profile."),
|
|
2022
2151
|
}),
|
|
2023
|
-
zod_1.default
|
|
2152
|
+
zod_1.default
|
|
2153
|
+
.lazy(() => zod_1.default.array(Function_1.ProfileVersionOptionalSchema))
|
|
2154
|
+
.meta({
|
|
2155
|
+
title: "ProfileVersionOptionalArray",
|
|
2156
|
+
recursive: true,
|
|
2157
|
+
}),
|
|
2024
2158
|
])
|
|
2025
2159
|
.describe("A function profile where remote profiles may omit a version.");
|
|
2026
2160
|
Function_1.ProfileVersionRequiredSchema = zod_1.default
|
|
@@ -2060,7 +2194,10 @@ var Function;
|
|
|
2060
2194
|
.nullable()
|
|
2061
2195
|
.describe("The description of the object input."),
|
|
2062
2196
|
properties: zod_1.default
|
|
2063
|
-
.record(zod_1.default.string(), Function_1.InputSchemaSchema
|
|
2197
|
+
.record(zod_1.default.string(), Function_1.InputSchemaSchema.meta({
|
|
2198
|
+
title: "InputSchema",
|
|
2199
|
+
recursive: true,
|
|
2200
|
+
}))
|
|
2064
2201
|
.describe("The properties of the object input."),
|
|
2065
2202
|
required: zod_1.default
|
|
2066
2203
|
.array(zod_1.default.string())
|
|
@@ -2087,7 +2224,10 @@ var Function;
|
|
|
2087
2224
|
.optional()
|
|
2088
2225
|
.nullable()
|
|
2089
2226
|
.describe("The maximum number of items in the array input."),
|
|
2090
|
-
items: Function_1.InputSchemaSchema.describe("The schema of the items in the array input.")
|
|
2227
|
+
items: Function_1.InputSchemaSchema.describe("The schema of the items in the array input.").meta({
|
|
2228
|
+
title: "InputSchema",
|
|
2229
|
+
recursive: true,
|
|
2230
|
+
}),
|
|
2091
2231
|
})
|
|
2092
2232
|
.describe("An array input schema.");
|
|
2093
2233
|
InputSchema.StringSchema = zod_1.default
|
|
@@ -2199,8 +2339,14 @@ var Function;
|
|
|
2199
2339
|
Function_1.InputSchema_ = zod_1.default
|
|
2200
2340
|
.lazy(() => zod_1.default.union([
|
|
2201
2341
|
Message.RichContent.PartSchema,
|
|
2202
|
-
zod_1.default.record(zod_1.default.string(), Function_1.InputSchema_
|
|
2203
|
-
|
|
2342
|
+
zod_1.default.record(zod_1.default.string(), Function_1.InputSchema_.meta({
|
|
2343
|
+
title: "Input",
|
|
2344
|
+
recursive: true,
|
|
2345
|
+
})),
|
|
2346
|
+
zod_1.default.array(Function_1.InputSchema_.meta({
|
|
2347
|
+
title: "Input",
|
|
2348
|
+
recursive: true,
|
|
2349
|
+
})),
|
|
2204
2350
|
zod_1.default.string(),
|
|
2205
2351
|
zod_1.default.number(),
|
|
2206
2352
|
zod_1.default.boolean(),
|
|
@@ -2209,8 +2355,14 @@ var Function;
|
|
|
2209
2355
|
Function_1.InputExpressionSchema = zod_1.default.lazy(() => zod_1.default
|
|
2210
2356
|
.union([
|
|
2211
2357
|
Message.RichContent.PartSchema,
|
|
2212
|
-
zod_1.default.record(zod_1.default.string(), Function_1.InputExpressionSchema
|
|
2213
|
-
|
|
2358
|
+
zod_1.default.record(zod_1.default.string(), Function_1.InputExpressionSchema.meta({
|
|
2359
|
+
title: "InputExpression",
|
|
2360
|
+
recursive: true,
|
|
2361
|
+
})),
|
|
2362
|
+
zod_1.default.array(Function_1.InputExpressionSchema.meta({
|
|
2363
|
+
title: "InputExpression",
|
|
2364
|
+
recursive: true,
|
|
2365
|
+
})),
|
|
2214
2366
|
zod_1.default.string(),
|
|
2215
2367
|
zod_1.default.number(),
|
|
2216
2368
|
zod_1.default.boolean(),
|
|
@@ -2225,13 +2377,6 @@ var Function;
|
|
|
2225
2377
|
.describe("A list of expressions which each evaluate to a 1D array of Inputs."),
|
|
2226
2378
|
])
|
|
2227
2379
|
.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.");
|
|
2228
|
-
Function_1.TaskExpressionSchema = zod_1.default
|
|
2229
|
-
.discriminatedUnion("type", [
|
|
2230
|
-
TaskExpression.ScalarFunctionSchema,
|
|
2231
|
-
TaskExpression.VectorFunctionSchema,
|
|
2232
|
-
TaskExpression.VectorCompletionSchema,
|
|
2233
|
-
])
|
|
2234
|
-
.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.");
|
|
2235
2380
|
let TaskExpression;
|
|
2236
2381
|
(function (TaskExpression) {
|
|
2237
2382
|
TaskExpression.SkipSchema = exports.ExpressionSchema.describe("An expression which evaluates to a boolean indicating whether to skip this task.");
|
|
@@ -2285,6 +2430,13 @@ var Function;
|
|
|
2285
2430
|
})
|
|
2286
2431
|
.describe("A vector completion task.");
|
|
2287
2432
|
})(TaskExpression = Function_1.TaskExpression || (Function_1.TaskExpression = {}));
|
|
2433
|
+
Function_1.TaskExpressionSchema = zod_1.default
|
|
2434
|
+
.discriminatedUnion("type", [
|
|
2435
|
+
TaskExpression.ScalarFunctionSchema,
|
|
2436
|
+
TaskExpression.VectorFunctionSchema,
|
|
2437
|
+
TaskExpression.VectorCompletionSchema,
|
|
2438
|
+
])
|
|
2439
|
+
.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.");
|
|
2288
2440
|
Function_1.TaskExpressionsSchema = zod_1.default
|
|
2289
2441
|
.array(Function_1.TaskExpressionSchema)
|
|
2290
2442
|
.describe("The list of tasks to be executed as part of the function.");
|
|
@@ -2307,7 +2459,8 @@ var Function;
|
|
|
2307
2459
|
tasks: Function_1.TaskExpressionsSchema,
|
|
2308
2460
|
output: exports.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."),
|
|
2309
2461
|
})
|
|
2310
|
-
.describe("A scalar function.")
|
|
2462
|
+
.describe("A scalar function.")
|
|
2463
|
+
.meta({ title: "ScalarFunction" });
|
|
2311
2464
|
Function_1.VectorSchema = zod_1.default
|
|
2312
2465
|
.object({
|
|
2313
2466
|
type: zod_1.default.literal("vector.function"),
|
|
@@ -2333,7 +2486,8 @@ var Function;
|
|
|
2333
2486
|
])
|
|
2334
2487
|
.describe("The length of the output vector."),
|
|
2335
2488
|
})
|
|
2336
|
-
.describe("A vector function.")
|
|
2489
|
+
.describe("A vector function.")
|
|
2490
|
+
.meta({ title: "VectorFunction" });
|
|
2337
2491
|
let Executions;
|
|
2338
2492
|
(function (Executions) {
|
|
2339
2493
|
let Request;
|
|
@@ -2355,37 +2509,47 @@ var Function;
|
|
|
2355
2509
|
.describe("Base parameters for executing a function.");
|
|
2356
2510
|
// Execute Inline Function
|
|
2357
2511
|
Request.FunctionExecutionParamsExecuteInlineBaseSchema = Request.FunctionExecutionParamsBaseSchema.extend({
|
|
2358
|
-
function: exports.FunctionSchema,
|
|
2512
|
+
function: zod_1.default.lazy(() => exports.FunctionSchema),
|
|
2359
2513
|
profile: Function_1.FunctionProfileVersionOptionalSchema,
|
|
2360
2514
|
}).describe("Base parameters for executing an inline function.");
|
|
2361
2515
|
Request.FunctionExecutionParamsExecuteInlineStreamingSchema = Request.FunctionExecutionParamsExecuteInlineBaseSchema.extend({
|
|
2362
2516
|
stream: Chat.Completions.Request.StreamTrueSchema,
|
|
2363
|
-
})
|
|
2517
|
+
})
|
|
2518
|
+
.describe("Parameters for executing an inline function and streaming the response.")
|
|
2519
|
+
.meta({ title: "FunctionExecutionParamsExecuteInlineStreaming" });
|
|
2364
2520
|
Request.FunctionExecutionParamsExecuteInlineNonStreamingSchema = Request.FunctionExecutionParamsExecuteInlineBaseSchema.extend({
|
|
2365
2521
|
stream: Chat.Completions.Request.StreamFalseSchema.optional().nullable(),
|
|
2366
|
-
})
|
|
2522
|
+
})
|
|
2523
|
+
.describe("Parameters for executing an inline function with a unary response.")
|
|
2524
|
+
.meta({ title: "FunctionExecutionParamsExecuteInlineNonStreaming" });
|
|
2367
2525
|
Request.FunctionExecutionParamsExecuteInlineSchema = zod_1.default
|
|
2368
2526
|
.union([
|
|
2369
2527
|
Request.FunctionExecutionParamsExecuteInlineStreamingSchema,
|
|
2370
2528
|
Request.FunctionExecutionParamsExecuteInlineNonStreamingSchema,
|
|
2371
2529
|
])
|
|
2372
|
-
.describe("Parameters for executing an inline function.")
|
|
2530
|
+
.describe("Parameters for executing an inline function.")
|
|
2531
|
+
.meta({ title: "FunctionExecutionParamsExecuteInline" });
|
|
2373
2532
|
// Execute Published Function
|
|
2374
2533
|
Request.FunctionExecutionParamsExecuteBaseSchema = Request.FunctionExecutionParamsBaseSchema.extend({
|
|
2375
2534
|
profile: Function_1.FunctionProfileVersionOptionalSchema.optional().nullable(),
|
|
2376
2535
|
}).describe("Base parameters for executing a remote published function.");
|
|
2377
2536
|
Request.FunctionExecutionParamsExecuteStreamingSchema = Request.FunctionExecutionParamsExecuteBaseSchema.extend({
|
|
2378
2537
|
stream: Chat.Completions.Request.StreamTrueSchema,
|
|
2379
|
-
})
|
|
2538
|
+
})
|
|
2539
|
+
.describe("Parameters for executing a remote published function and streaming the response.")
|
|
2540
|
+
.meta({ title: "FunctionExecutionParamsExecuteStreaming" });
|
|
2380
2541
|
Request.FunctionExecutionParamsExecuteNonStreamingSchema = Request.FunctionExecutionParamsExecuteBaseSchema.extend({
|
|
2381
2542
|
stream: Chat.Completions.Request.StreamFalseSchema.optional().nullable(),
|
|
2382
|
-
})
|
|
2543
|
+
})
|
|
2544
|
+
.describe("Parameters for executing a remote published function with a unary response.")
|
|
2545
|
+
.meta({ title: "FunctionExecutionParamsExecuteNonStreaming" });
|
|
2383
2546
|
Request.FunctionExecutionParamsExecuteSchema = zod_1.default
|
|
2384
2547
|
.union([
|
|
2385
2548
|
Request.FunctionExecutionParamsExecuteStreamingSchema,
|
|
2386
2549
|
Request.FunctionExecutionParamsExecuteNonStreamingSchema,
|
|
2387
2550
|
])
|
|
2388
|
-
.describe("Parameters for executing a remote published function.")
|
|
2551
|
+
.describe("Parameters for executing a remote published function.")
|
|
2552
|
+
.meta({ title: "FunctionExecutionParamsExecute" });
|
|
2389
2553
|
// Publish Scalar Function
|
|
2390
2554
|
Request.FunctionExecutionParamsPublishScalarFunctionBaseSchema = Request.FunctionExecutionParamsBaseSchema.extend({
|
|
2391
2555
|
function: Function_1.ScalarSchema,
|
|
@@ -2424,16 +2588,25 @@ var Function;
|
|
|
2424
2588
|
}).describe("Base parameters for executing and publishing an inline scalar function.");
|
|
2425
2589
|
Request.FunctionExecutionParamsPublishScalarFunctionStreamingSchema = Request.FunctionExecutionParamsPublishScalarFunctionBaseSchema.extend({
|
|
2426
2590
|
stream: Chat.Completions.Request.StreamTrueSchema,
|
|
2427
|
-
})
|
|
2591
|
+
})
|
|
2592
|
+
.describe("Parameters for executing and publishing an inline scalar function and streaming the response.")
|
|
2593
|
+
.meta({
|
|
2594
|
+
title: "FunctionExecutionParamsPublishScalarFunctionStreaming",
|
|
2595
|
+
});
|
|
2428
2596
|
Request.FunctionExecutionParamsPublishScalarFunctionNonStreamingSchema = Request.FunctionExecutionParamsPublishScalarFunctionBaseSchema.extend({
|
|
2429
2597
|
stream: Chat.Completions.Request.StreamFalseSchema.optional().nullable(),
|
|
2430
|
-
})
|
|
2598
|
+
})
|
|
2599
|
+
.describe("Parameters for executing and publishing an inline scalar function with a unary response.")
|
|
2600
|
+
.meta({
|
|
2601
|
+
title: "FunctionExecutionParamsPublishScalarFunctionNonStreaming",
|
|
2602
|
+
});
|
|
2431
2603
|
Request.FunctionExecutionParamsPublishScalarFunctionSchema = zod_1.default
|
|
2432
2604
|
.union([
|
|
2433
2605
|
Request.FunctionExecutionParamsPublishScalarFunctionStreamingSchema,
|
|
2434
2606
|
Request.FunctionExecutionParamsPublishScalarFunctionNonStreamingSchema,
|
|
2435
2607
|
])
|
|
2436
|
-
.describe("Parameters for executing and publishing an inline scalar function.")
|
|
2608
|
+
.describe("Parameters for executing and publishing an inline scalar function.")
|
|
2609
|
+
.meta({ title: "FunctionExecutionParamsPublishScalarFunction" });
|
|
2437
2610
|
// Publish Vector Function
|
|
2438
2611
|
Request.FunctionExecutionParamsPublishVectorFunctionBaseSchema = Request.FunctionExecutionParamsBaseSchema.extend({
|
|
2439
2612
|
function: Function_1.VectorSchema,
|
|
@@ -2478,35 +2651,47 @@ var Function;
|
|
|
2478
2651
|
}).describe("Base parameters for executing and publishing an inline vector function.");
|
|
2479
2652
|
Request.FunctionExecutionParamsPublishVectorFunctionStreamingSchema = Request.FunctionExecutionParamsPublishVectorFunctionBaseSchema.extend({
|
|
2480
2653
|
stream: Chat.Completions.Request.StreamTrueSchema,
|
|
2481
|
-
})
|
|
2654
|
+
})
|
|
2655
|
+
.describe("Parameters for executing and publishing an inline vector function and streaming the response.")
|
|
2656
|
+
.meta({
|
|
2657
|
+
title: "FunctionExecutionParamsPublishVectorFunctionStreaming",
|
|
2658
|
+
});
|
|
2482
2659
|
Request.FunctionExecutionParamsPublishVectorFunctionNonStreamingSchema = Request.FunctionExecutionParamsPublishVectorFunctionBaseSchema.extend({
|
|
2483
2660
|
stream: Chat.Completions.Request.StreamFalseSchema.optional().nullable(),
|
|
2484
|
-
})
|
|
2661
|
+
})
|
|
2662
|
+
.describe("Parameters for executing and publishing an inline vector function with a unary response.")
|
|
2663
|
+
.meta({
|
|
2664
|
+
title: "FunctionExecutionParamsPublishVectorFunctionNonStreaming",
|
|
2665
|
+
});
|
|
2485
2666
|
Request.FunctionExecutionParamsPublishVectorFunctionSchema = zod_1.default
|
|
2486
2667
|
.union([
|
|
2487
2668
|
Request.FunctionExecutionParamsPublishVectorFunctionStreamingSchema,
|
|
2488
2669
|
Request.FunctionExecutionParamsPublishVectorFunctionNonStreamingSchema,
|
|
2489
2670
|
])
|
|
2490
|
-
.describe("Parameters for executing and publishing an inline vector function.")
|
|
2671
|
+
.describe("Parameters for executing and publishing an inline vector function.")
|
|
2672
|
+
.meta({ title: "FunctionExecutionParamsPublishVectorFunction" });
|
|
2491
2673
|
// Publish Function
|
|
2492
2674
|
Request.FunctionExecutionParamsPublishFunctionStreamingSchema = zod_1.default
|
|
2493
2675
|
.union([
|
|
2494
2676
|
Request.FunctionExecutionParamsPublishScalarFunctionStreamingSchema,
|
|
2495
2677
|
Request.FunctionExecutionParamsPublishVectorFunctionStreamingSchema,
|
|
2496
2678
|
])
|
|
2497
|
-
.describe("Parameters for executing and publishing an inline function and streaming the response.")
|
|
2679
|
+
.describe("Parameters for executing and publishing an inline function and streaming the response.")
|
|
2680
|
+
.meta({ title: "FunctionExecutionParamsPublishFunctionStreaming" });
|
|
2498
2681
|
Request.FunctionExecutionParamsPublishFunctionNonStreamingSchema = zod_1.default
|
|
2499
2682
|
.union([
|
|
2500
2683
|
Request.FunctionExecutionParamsPublishScalarFunctionNonStreamingSchema,
|
|
2501
2684
|
Request.FunctionExecutionParamsPublishVectorFunctionNonStreamingSchema,
|
|
2502
2685
|
])
|
|
2503
|
-
.describe("Parameters for executing and publishing an inline function with a unary response.")
|
|
2686
|
+
.describe("Parameters for executing and publishing an inline function with a unary response.")
|
|
2687
|
+
.meta({ title: "FunctionExecutionParamsPublishFunctionNonStreaming" });
|
|
2504
2688
|
Request.FunctionExecutionParamsPublishFunctionSchema = zod_1.default
|
|
2505
2689
|
.union([
|
|
2506
2690
|
Request.FunctionExecutionParamsPublishScalarFunctionSchema,
|
|
2507
2691
|
Request.FunctionExecutionParamsPublishVectorFunctionSchema,
|
|
2508
2692
|
])
|
|
2509
|
-
.describe("Parameters for executing and publishing an inline function.")
|
|
2693
|
+
.describe("Parameters for executing and publishing an inline function.")
|
|
2694
|
+
.meta({ title: "FunctionExecutionParamsPublishFunction" });
|
|
2510
2695
|
// Publish Profile
|
|
2511
2696
|
Request.FunctionExecutionParamsPublishProfileBaseSchema = Request.FunctionExecutionParamsBaseSchema.extend({
|
|
2512
2697
|
profile: zod_1.default
|
|
@@ -2533,16 +2718,21 @@ var Function;
|
|
|
2533
2718
|
}).describe("Base parameters for executing a remote published function and publishing a profile.");
|
|
2534
2719
|
Request.FunctionExecutionParamsPublishProfileStreamingSchema = Request.FunctionExecutionParamsPublishProfileBaseSchema.extend({
|
|
2535
2720
|
stream: Chat.Completions.Request.StreamTrueSchema,
|
|
2536
|
-
})
|
|
2721
|
+
})
|
|
2722
|
+
.describe("Parameters for executing a remote published function, publishing a profile, and streaming the response.")
|
|
2723
|
+
.meta({ title: "FunctionExecutionParamsPublishProfileStreaming" });
|
|
2537
2724
|
Request.FunctionExecutionParamsPublishProfileNonStreamingSchema = Request.FunctionExecutionParamsPublishProfileBaseSchema.extend({
|
|
2538
2725
|
stream: Chat.Completions.Request.StreamFalseSchema.optional().nullable(),
|
|
2539
|
-
})
|
|
2726
|
+
})
|
|
2727
|
+
.describe("Parameters for executing a remote published function and publishing a profile with a unary response.")
|
|
2728
|
+
.meta({ title: "FunctionExecutionParamsPublishProfileNonStreaming" });
|
|
2540
2729
|
Request.FunctionExecutionParamsPublishProfileSchema = zod_1.default
|
|
2541
2730
|
.union([
|
|
2542
2731
|
Request.FunctionExecutionParamsPublishProfileStreamingSchema,
|
|
2543
2732
|
Request.FunctionExecutionParamsPublishProfileNonStreamingSchema,
|
|
2544
2733
|
])
|
|
2545
|
-
.describe("Parameters for executing a remote published function and publishing a profile.")
|
|
2734
|
+
.describe("Parameters for executing a remote published function and publishing a profile.")
|
|
2735
|
+
.meta({ title: "FunctionExecutionParamsPublishProfile" });
|
|
2546
2736
|
})(Request = Executions.Request || (Executions.Request = {}));
|
|
2547
2737
|
let Response;
|
|
2548
2738
|
(function (Response) {
|
|
@@ -2560,9 +2750,6 @@ var Function;
|
|
|
2560
2750
|
})(Task = Response.Task || (Response.Task = {}));
|
|
2561
2751
|
let Streaming;
|
|
2562
2752
|
(function (Streaming) {
|
|
2563
|
-
Streaming.TaskChunkSchema = zod_1.default
|
|
2564
|
-
.union([TaskChunk.FunctionSchema, TaskChunk.VectorCompletionSchema])
|
|
2565
|
-
.describe("A chunk of a task execution.");
|
|
2566
2753
|
let TaskChunk;
|
|
2567
2754
|
(function (TaskChunk) {
|
|
2568
2755
|
function merged(a, b) {
|
|
@@ -2599,13 +2786,6 @@ var Function;
|
|
|
2599
2786
|
return merged ? [merged, true] : [a, false];
|
|
2600
2787
|
}
|
|
2601
2788
|
TaskChunk.mergedList = mergedList;
|
|
2602
|
-
TaskChunk.FunctionSchema = zod_1.default
|
|
2603
|
-
.lazy(() => Streaming.FunctionExecutionChunkSchema.extend({
|
|
2604
|
-
index: Task.IndexSchema,
|
|
2605
|
-
task_index: Task.TaskIndexSchema,
|
|
2606
|
-
task_path: Task.TaskPathSchema,
|
|
2607
|
-
}))
|
|
2608
|
-
.describe("A chunk of a function execution task.");
|
|
2609
2789
|
let Function;
|
|
2610
2790
|
(function (Function) {
|
|
2611
2791
|
function merged(a, b) {
|
|
@@ -2627,12 +2807,20 @@ var Function;
|
|
|
2627
2807
|
}
|
|
2628
2808
|
Function.merged = merged;
|
|
2629
2809
|
})(Function = TaskChunk.Function || (TaskChunk.Function = {}));
|
|
2630
|
-
TaskChunk.
|
|
2810
|
+
TaskChunk.FunctionSchema = zod_1.default
|
|
2811
|
+
.lazy(() => Streaming.FunctionExecutionChunkSchema.extend({
|
|
2631
2812
|
index: Task.IndexSchema,
|
|
2632
2813
|
task_index: Task.TaskIndexSchema,
|
|
2633
2814
|
task_path: Task.TaskPathSchema,
|
|
2634
|
-
|
|
2635
|
-
|
|
2815
|
+
tasks: zod_1.default
|
|
2816
|
+
.array(Streaming.TaskChunkSchema)
|
|
2817
|
+
.meta({
|
|
2818
|
+
title: "TaskChunkArray",
|
|
2819
|
+
recursive: true,
|
|
2820
|
+
})
|
|
2821
|
+
.describe("The tasks executed as part of the function execution."),
|
|
2822
|
+
}))
|
|
2823
|
+
.describe("A chunk of a function execution task.");
|
|
2636
2824
|
let VectorCompletion;
|
|
2637
2825
|
(function (VectorCompletion) {
|
|
2638
2826
|
function merged(a, b) {
|
|
@@ -2655,7 +2843,57 @@ var Function;
|
|
|
2655
2843
|
}
|
|
2656
2844
|
VectorCompletion.merged = merged;
|
|
2657
2845
|
})(VectorCompletion = TaskChunk.VectorCompletion || (TaskChunk.VectorCompletion = {}));
|
|
2846
|
+
TaskChunk.VectorCompletionSchema = Vector.Completions.Response.Streaming.VectorCompletionChunkSchema.extend({
|
|
2847
|
+
index: Task.IndexSchema,
|
|
2848
|
+
task_index: Task.TaskIndexSchema,
|
|
2849
|
+
task_path: Task.TaskPathSchema,
|
|
2850
|
+
error: exports.ObjectiveAIErrorSchema.optional().describe("When present, indicates that an error occurred during the vector completion task."),
|
|
2851
|
+
}).describe("A chunk of a vector completion task.");
|
|
2658
2852
|
})(TaskChunk = Streaming.TaskChunk || (Streaming.TaskChunk = {}));
|
|
2853
|
+
Streaming.TaskChunkSchema = zod_1.default
|
|
2854
|
+
.union([TaskChunk.FunctionSchema, TaskChunk.VectorCompletionSchema])
|
|
2855
|
+
.describe("A chunk of a task execution.");
|
|
2856
|
+
let FunctionExecutionChunk;
|
|
2857
|
+
(function (FunctionExecutionChunk) {
|
|
2858
|
+
function merged(a, b) {
|
|
2859
|
+
const id = a.id;
|
|
2860
|
+
const [tasks, tasksChanged] = TaskChunk.mergedList(a.tasks, b.tasks);
|
|
2861
|
+
const [tasks_errors, tasks_errorsChanged] = merge(a.tasks_errors, b.tasks_errors);
|
|
2862
|
+
const [output, outputChanged] = merge(a.output, b.output);
|
|
2863
|
+
const [error, errorChanged] = merge(a.error, b.error);
|
|
2864
|
+
const [retry_token, retry_tokenChanged] = merge(a.retry_token, b.retry_token);
|
|
2865
|
+
const [function_published, function_publishedChanged] = merge(a.function_published, b.function_published);
|
|
2866
|
+
const [profile_published, profile_publishedChanged] = merge(a.profile_published, b.profile_published);
|
|
2867
|
+
const created = a.created;
|
|
2868
|
+
const function_ = a.function;
|
|
2869
|
+
const profile = a.profile;
|
|
2870
|
+
const object = a.object;
|
|
2871
|
+
const [usage, usageChanged] = merge(a.usage, b.usage);
|
|
2872
|
+
if (tasksChanged ||
|
|
2873
|
+
tasks_errorsChanged ||
|
|
2874
|
+
outputChanged ||
|
|
2875
|
+
errorChanged ||
|
|
2876
|
+
retry_tokenChanged ||
|
|
2877
|
+
function_publishedChanged ||
|
|
2878
|
+
profile_publishedChanged ||
|
|
2879
|
+
usageChanged) {
|
|
2880
|
+
return [
|
|
2881
|
+
Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ id,
|
|
2882
|
+
tasks }, (tasks_errors !== undefined ? { tasks_errors } : {})), (output !== undefined ? { output } : {})), (error !== undefined ? { error } : {})), (retry_token !== undefined ? { retry_token } : {})), (function_published !== undefined
|
|
2883
|
+
? { function_published }
|
|
2884
|
+
: {})), (profile_published !== undefined
|
|
2885
|
+
? { profile_published }
|
|
2886
|
+
: {})), { created, function: function_, profile,
|
|
2887
|
+
object }), (usage !== undefined ? { usage } : {})),
|
|
2888
|
+
true,
|
|
2889
|
+
];
|
|
2890
|
+
}
|
|
2891
|
+
else {
|
|
2892
|
+
return [a, false];
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
FunctionExecutionChunk.merged = merged;
|
|
2896
|
+
})(FunctionExecutionChunk = Streaming.FunctionExecutionChunk || (Streaming.FunctionExecutionChunk = {}));
|
|
2659
2897
|
Streaming.FunctionExecutionChunkSchema = zod_1.default
|
|
2660
2898
|
.object({
|
|
2661
2899
|
id: zod_1.default
|
|
@@ -2713,53 +2951,9 @@ var Function;
|
|
|
2713
2951
|
usage: Vector.Completions.Response.UsageSchema.optional(),
|
|
2714
2952
|
})
|
|
2715
2953
|
.describe("A chunk of a function execution.");
|
|
2716
|
-
let FunctionExecutionChunk;
|
|
2717
|
-
(function (FunctionExecutionChunk) {
|
|
2718
|
-
function merged(a, b) {
|
|
2719
|
-
const id = a.id;
|
|
2720
|
-
const [tasks, tasksChanged] = TaskChunk.mergedList(a.tasks, b.tasks);
|
|
2721
|
-
const [tasks_errors, tasks_errorsChanged] = merge(a.tasks_errors, b.tasks_errors);
|
|
2722
|
-
const [output, outputChanged] = merge(a.output, b.output);
|
|
2723
|
-
const [error, errorChanged] = merge(a.error, b.error);
|
|
2724
|
-
const [retry_token, retry_tokenChanged] = merge(a.retry_token, b.retry_token);
|
|
2725
|
-
const [function_published, function_publishedChanged] = merge(a.function_published, b.function_published);
|
|
2726
|
-
const [profile_published, profile_publishedChanged] = merge(a.profile_published, b.profile_published);
|
|
2727
|
-
const created = a.created;
|
|
2728
|
-
const function_ = a.function;
|
|
2729
|
-
const profile = a.profile;
|
|
2730
|
-
const object = a.object;
|
|
2731
|
-
const [usage, usageChanged] = merge(a.usage, b.usage);
|
|
2732
|
-
if (tasksChanged ||
|
|
2733
|
-
tasks_errorsChanged ||
|
|
2734
|
-
outputChanged ||
|
|
2735
|
-
errorChanged ||
|
|
2736
|
-
retry_tokenChanged ||
|
|
2737
|
-
function_publishedChanged ||
|
|
2738
|
-
profile_publishedChanged ||
|
|
2739
|
-
usageChanged) {
|
|
2740
|
-
return [
|
|
2741
|
-
Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ id,
|
|
2742
|
-
tasks }, (tasks_errors !== undefined ? { tasks_errors } : {})), (output !== undefined ? { output } : {})), (error !== undefined ? { error } : {})), (retry_token !== undefined ? { retry_token } : {})), (function_published !== undefined
|
|
2743
|
-
? { function_published }
|
|
2744
|
-
: {})), (profile_published !== undefined
|
|
2745
|
-
? { profile_published }
|
|
2746
|
-
: {})), { created, function: function_, profile,
|
|
2747
|
-
object }), (usage !== undefined ? { usage } : {})),
|
|
2748
|
-
true,
|
|
2749
|
-
];
|
|
2750
|
-
}
|
|
2751
|
-
else {
|
|
2752
|
-
return [a, false];
|
|
2753
|
-
}
|
|
2754
|
-
}
|
|
2755
|
-
FunctionExecutionChunk.merged = merged;
|
|
2756
|
-
})(FunctionExecutionChunk = Streaming.FunctionExecutionChunk || (Streaming.FunctionExecutionChunk = {}));
|
|
2757
2954
|
})(Streaming = Response.Streaming || (Response.Streaming = {}));
|
|
2758
2955
|
let Unary;
|
|
2759
2956
|
(function (Unary) {
|
|
2760
|
-
Unary.TaskSchema = zod_1.default
|
|
2761
|
-
.union([Task.FunctionSchema, Task.VectorCompletionSchema])
|
|
2762
|
-
.describe("A task execution.");
|
|
2763
2957
|
let Task;
|
|
2764
2958
|
(function (Task) {
|
|
2765
2959
|
Task.FunctionSchema = zod_1.default
|
|
@@ -2767,8 +2961,15 @@ var Function;
|
|
|
2767
2961
|
index: Response.Task.IndexSchema,
|
|
2768
2962
|
task_index: Response.Task.TaskIndexSchema,
|
|
2769
2963
|
task_path: Response.Task.TaskPathSchema,
|
|
2964
|
+
tasks: zod_1.default
|
|
2965
|
+
.array(Unary.TaskSchema)
|
|
2966
|
+
.meta({
|
|
2967
|
+
title: "TaskArray",
|
|
2968
|
+
recursive: true,
|
|
2969
|
+
})
|
|
2970
|
+
.describe("The tasks executed as part of the function execution."),
|
|
2770
2971
|
}))
|
|
2771
|
-
.describe("A
|
|
2972
|
+
.describe("A function execution task.");
|
|
2772
2973
|
Task.VectorCompletionSchema = Vector.Completions.Response.Unary.VectorCompletionSchema.extend({
|
|
2773
2974
|
index: Response.Task.IndexSchema,
|
|
2774
2975
|
task_index: Response.Task.TaskIndexSchema,
|
|
@@ -2776,6 +2977,9 @@ var Function;
|
|
|
2776
2977
|
error: exports.ObjectiveAIErrorSchema.nullable().describe("When non-null, indicates that an error occurred during the vector completion task."),
|
|
2777
2978
|
}).describe("A vector completion task.");
|
|
2778
2979
|
})(Task = Unary.Task || (Unary.Task = {}));
|
|
2980
|
+
Unary.TaskSchema = zod_1.default
|
|
2981
|
+
.union([Task.FunctionSchema, Task.VectorCompletionSchema])
|
|
2982
|
+
.describe("A task execution.");
|
|
2779
2983
|
Unary.FunctionExecutionSchema = zod_1.default
|
|
2780
2984
|
.object({
|
|
2781
2985
|
id: zod_1.default
|
|
@@ -2835,21 +3039,8 @@ var Function;
|
|
|
2835
3039
|
(function (ComputeProfile) {
|
|
2836
3040
|
let Request;
|
|
2837
3041
|
(function (Request) {
|
|
2838
|
-
Request.DatasetItemSchema = zod_1.default
|
|
2839
|
-
.object({
|
|
2840
|
-
input: Function_1.InputSchema_,
|
|
2841
|
-
target: DatasetItem.TargetSchema,
|
|
2842
|
-
})
|
|
2843
|
-
.describe("A Function input and its corresponding target output.");
|
|
2844
3042
|
let DatasetItem;
|
|
2845
3043
|
(function (DatasetItem) {
|
|
2846
|
-
DatasetItem.TargetSchema = zod_1.default
|
|
2847
|
-
.union([
|
|
2848
|
-
Target.ScalarSchema,
|
|
2849
|
-
Target.VectorSchema,
|
|
2850
|
-
Target.VectorWinnerSchema,
|
|
2851
|
-
])
|
|
2852
|
-
.describe("The target output for a given function input.");
|
|
2853
3044
|
let Target;
|
|
2854
3045
|
(function (Target) {
|
|
2855
3046
|
Target.ScalarSchema = zod_1.default
|
|
@@ -2871,7 +3062,20 @@ var Function;
|
|
|
2871
3062
|
})
|
|
2872
3063
|
.describe("A vector winner target output. The desired output is a vector where the highest value is at the specified index.");
|
|
2873
3064
|
})(Target = DatasetItem.Target || (DatasetItem.Target = {}));
|
|
3065
|
+
DatasetItem.TargetSchema = zod_1.default
|
|
3066
|
+
.discriminatedUnion("type", [
|
|
3067
|
+
Target.ScalarSchema,
|
|
3068
|
+
Target.VectorSchema,
|
|
3069
|
+
Target.VectorWinnerSchema,
|
|
3070
|
+
])
|
|
3071
|
+
.describe("The target output for a given function input.");
|
|
2874
3072
|
})(DatasetItem = Request.DatasetItem || (Request.DatasetItem = {}));
|
|
3073
|
+
Request.DatasetItemSchema = zod_1.default
|
|
3074
|
+
.object({
|
|
3075
|
+
input: Function_1.InputSchema_,
|
|
3076
|
+
target: DatasetItem.TargetSchema,
|
|
3077
|
+
})
|
|
3078
|
+
.describe("A Function input and its corresponding target output.");
|
|
2875
3079
|
Request.FunctionComputeProfileParamsBaseSchema = zod_1.default
|
|
2876
3080
|
.object({
|
|
2877
3081
|
retry_token: zod_1.default
|
|
@@ -2900,16 +3104,21 @@ var Function;
|
|
|
2900
3104
|
.describe("Base parameters for computing a function profile.");
|
|
2901
3105
|
Request.FunctionComputeProfileParamsStreamingSchema = Request.FunctionComputeProfileParamsBaseSchema.extend({
|
|
2902
3106
|
stream: Chat.Completions.Request.StreamTrueSchema,
|
|
2903
|
-
})
|
|
3107
|
+
})
|
|
3108
|
+
.describe("Parameters for computing a function profile and streaming the response.")
|
|
3109
|
+
.meta({ title: "FunctionComputeProfileParamsStreaming" });
|
|
2904
3110
|
Request.FunctionComputeProfileParamsNonStreamingSchema = Request.FunctionComputeProfileParamsBaseSchema.extend({
|
|
2905
3111
|
stream: Chat.Completions.Request.StreamFalseSchema.optional().nullable(),
|
|
2906
|
-
})
|
|
3112
|
+
})
|
|
3113
|
+
.describe("Parameters for computing a function profile with a unary response.")
|
|
3114
|
+
.meta({ title: "FunctionComputeProfileParamsNonStreaming" });
|
|
2907
3115
|
Request.FunctionComputeProfileParamsSchema = zod_1.default
|
|
2908
3116
|
.union([
|
|
2909
3117
|
Request.FunctionComputeProfileParamsStreamingSchema,
|
|
2910
3118
|
Request.FunctionComputeProfileParamsNonStreamingSchema,
|
|
2911
3119
|
])
|
|
2912
|
-
.describe("Parameters for computing a function profile.")
|
|
3120
|
+
.describe("Parameters for computing a function profile.")
|
|
3121
|
+
.meta({ title: "FunctionComputeProfileParams" });
|
|
2913
3122
|
})(Request = ComputeProfile.Request || (ComputeProfile.Request = {}));
|
|
2914
3123
|
let Response;
|
|
2915
3124
|
(function (Response) {
|
|
@@ -2934,20 +3143,6 @@ var Function;
|
|
|
2934
3143
|
.describe("Statistics about the fitting process used to compute the weights for the profile.");
|
|
2935
3144
|
let Streaming;
|
|
2936
3145
|
(function (Streaming) {
|
|
2937
|
-
Streaming.FunctionExecutionChunkSchema = Executions.Response.Streaming.FunctionExecutionChunkSchema.extend({
|
|
2938
|
-
index: zod_1.default
|
|
2939
|
-
.uint32()
|
|
2940
|
-
.describe("The index of the function execution chunk in the list of executions."),
|
|
2941
|
-
dataset: zod_1.default
|
|
2942
|
-
.uint32()
|
|
2943
|
-
.describe("The index of the dataset item this function execution chunk corresponds to."),
|
|
2944
|
-
n: zod_1.default
|
|
2945
|
-
.uint32()
|
|
2946
|
-
.describe("The N index for this function execution chunk. There will be N function executions, and N comes from the request parameters."),
|
|
2947
|
-
retry: zod_1.default
|
|
2948
|
-
.uint32()
|
|
2949
|
-
.describe("The retry index for this function execution chunk. There may be multiple retries for a given dataset item and N index."),
|
|
2950
|
-
}).describe("A chunk of a function execution ran during profile computation.");
|
|
2951
3146
|
let FunctionExecutionChunk;
|
|
2952
3147
|
(function (FunctionExecutionChunk) {
|
|
2953
3148
|
function merged(a, b) {
|
|
@@ -2996,33 +3191,20 @@ var Function;
|
|
|
2996
3191
|
}
|
|
2997
3192
|
FunctionExecutionChunk.mergedList = mergedList;
|
|
2998
3193
|
})(FunctionExecutionChunk = Streaming.FunctionExecutionChunk || (Streaming.FunctionExecutionChunk = {}));
|
|
2999
|
-
Streaming.
|
|
3000
|
-
.
|
|
3001
|
-
id: zod_1.default
|
|
3002
|
-
.string()
|
|
3003
|
-
.describe("The unique identifier of the function profile computation chunk."),
|
|
3004
|
-
executions: zod_1.default
|
|
3005
|
-
.array(Streaming.FunctionExecutionChunkSchema)
|
|
3006
|
-
.describe("The function executions performed as part of computing the profile."),
|
|
3007
|
-
executions_errors: zod_1.default
|
|
3008
|
-
.boolean()
|
|
3009
|
-
.optional()
|
|
3010
|
-
.describe("When true, indicates that one or more function executions encountered errors during profile computation."),
|
|
3011
|
-
profile: zod_1.default
|
|
3012
|
-
.array(Function_1.ProfileVersionRequiredSchema)
|
|
3013
|
-
.optional()
|
|
3014
|
-
.describe("The computed function profile."),
|
|
3015
|
-
fitting_stats: Response.FittingStatsSchema.optional(),
|
|
3016
|
-
created: zod_1.default
|
|
3194
|
+
Streaming.FunctionExecutionChunkSchema = Executions.Response.Streaming.FunctionExecutionChunkSchema.extend({
|
|
3195
|
+
index: zod_1.default
|
|
3017
3196
|
.uint32()
|
|
3018
|
-
.describe("The
|
|
3019
|
-
|
|
3020
|
-
.
|
|
3021
|
-
.describe("The
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3197
|
+
.describe("The index of the function execution chunk in the list of executions."),
|
|
3198
|
+
dataset: zod_1.default
|
|
3199
|
+
.uint32()
|
|
3200
|
+
.describe("The index of the dataset item this function execution chunk corresponds to."),
|
|
3201
|
+
n: zod_1.default
|
|
3202
|
+
.uint32()
|
|
3203
|
+
.describe("The N index for this function execution chunk. There will be N function executions, and N comes from the request parameters."),
|
|
3204
|
+
retry: zod_1.default
|
|
3205
|
+
.uint32()
|
|
3206
|
+
.describe("The retry index for this function execution chunk. There may be multiple retries for a given dataset item and N index."),
|
|
3207
|
+
}).describe("A chunk of a function execution ran during profile computation.");
|
|
3026
3208
|
let FunctionComputeProfileChunk;
|
|
3027
3209
|
(function (FunctionComputeProfileChunk) {
|
|
3028
3210
|
function merged(a, b) {
|
|
@@ -3054,6 +3236,33 @@ var Function;
|
|
|
3054
3236
|
}
|
|
3055
3237
|
FunctionComputeProfileChunk.merged = merged;
|
|
3056
3238
|
})(FunctionComputeProfileChunk = Streaming.FunctionComputeProfileChunk || (Streaming.FunctionComputeProfileChunk = {}));
|
|
3239
|
+
Streaming.FunctionComputeProfileChunkSchema = zod_1.default
|
|
3240
|
+
.object({
|
|
3241
|
+
id: zod_1.default
|
|
3242
|
+
.string()
|
|
3243
|
+
.describe("The unique identifier of the function profile computation chunk."),
|
|
3244
|
+
executions: zod_1.default
|
|
3245
|
+
.array(Streaming.FunctionExecutionChunkSchema)
|
|
3246
|
+
.describe("The function executions performed as part of computing the profile."),
|
|
3247
|
+
executions_errors: zod_1.default
|
|
3248
|
+
.boolean()
|
|
3249
|
+
.optional()
|
|
3250
|
+
.describe("When true, indicates that one or more function executions encountered errors during profile computation."),
|
|
3251
|
+
profile: zod_1.default
|
|
3252
|
+
.array(Function_1.ProfileVersionRequiredSchema)
|
|
3253
|
+
.optional()
|
|
3254
|
+
.describe("The computed function profile."),
|
|
3255
|
+
fitting_stats: Response.FittingStatsSchema.optional(),
|
|
3256
|
+
created: zod_1.default
|
|
3257
|
+
.uint32()
|
|
3258
|
+
.describe("The UNIX timestamp (in seconds) when the function profile computation was created."),
|
|
3259
|
+
function: zod_1.default
|
|
3260
|
+
.string()
|
|
3261
|
+
.describe("The unique identifier of the function for which the profile is being computed."),
|
|
3262
|
+
object: zod_1.default.literal("function.compute.profile.chunk"),
|
|
3263
|
+
usage: Vector.Completions.Response.UsageSchema.optional(),
|
|
3264
|
+
})
|
|
3265
|
+
.describe("A chunk of a function profile computation.");
|
|
3057
3266
|
})(Streaming = Response.Streaming || (Response.Streaming = {}));
|
|
3058
3267
|
let Unary;
|
|
3059
3268
|
(function (Unary) {
|
|
@@ -3217,7 +3426,9 @@ var Function;
|
|
|
3217
3426
|
shape: zod_1.default
|
|
3218
3427
|
.string()
|
|
3219
3428
|
.describe("The shape of the function. Unless Task Skip expressions work out favorably, functions only work with profiles that have the same shape."),
|
|
3220
|
-
})
|
|
3429
|
+
})
|
|
3430
|
+
.describe("A retrieved scalar function.")
|
|
3431
|
+
.meta({ title: "RetrievedScalarFunction" });
|
|
3221
3432
|
Function_1.VectorRetrieveItemSchema = Function_1.VectorSchema.extend({
|
|
3222
3433
|
created: zod_1.default
|
|
3223
3434
|
.uint32()
|
|
@@ -3225,7 +3436,9 @@ var Function;
|
|
|
3225
3436
|
shape: zod_1.default
|
|
3226
3437
|
.string()
|
|
3227
3438
|
.describe("The shape of the function. Unless Task Skip expressions work out favorably, functions only work with profiles that have the same shape."),
|
|
3228
|
-
})
|
|
3439
|
+
})
|
|
3440
|
+
.describe("A retrieved vector function.")
|
|
3441
|
+
.meta({ title: "RetrievedVectorFunction" });
|
|
3229
3442
|
Function_1.RetrieveItemSchema = zod_1.default.discriminatedUnion("type", [
|
|
3230
3443
|
Function_1.ScalarRetrieveItemSchema,
|
|
3231
3444
|
Function_1.VectorRetrieveItemSchema,
|
|
@@ -3259,6 +3472,9 @@ var Function;
|
|
|
3259
3472
|
}
|
|
3260
3473
|
Function_1.retrieveUsage = retrieveUsage;
|
|
3261
3474
|
})(Function || (exports.Function = Function = {}));
|
|
3475
|
+
exports.FunctionSchema = zod_1.default
|
|
3476
|
+
.discriminatedUnion("type", [Function.ScalarSchema, Function.VectorSchema])
|
|
3477
|
+
.describe("A function.");
|
|
3262
3478
|
var Auth;
|
|
3263
3479
|
(function (Auth) {
|
|
3264
3480
|
Auth.ApiKeySchema = zod_1.default.object({
|