forked from lastmile-ai/aiconfig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaiconfig.schema.json
417 lines (417 loc) · 14.3 KB
/
aiconfig.schema.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
{
"description": "AIConfig schema, latest version. For older versions, see AIConfigV*.",
"type": "object",
"additionalProperties": {},
"properties": {
"name": {
"description": "Friendly name descriptor for the AIConfig. Could default to the filename if not specified.",
"type": "string"
},
"description": {
"description": "Description of the AIConfig.\nIf you have a collection of different AIConfigs, this may be used for dynamic prompt routing.",
"type": "string"
},
"schema_version": {
"$ref": "#/definitions/SchemaVersion",
"description": "The version of the AIConfig schema."
},
"metadata": {
"description": "Root-level metadata that applies to the entire AIConfig.",
"type": "object",
"additionalProperties": {},
"properties": {
"parameters": {
"description": "Parameter definitions that are accessible to all prompts in this AIConfig.\nThese parameters can be referenced in the prompts using {{param_name}} handlebars syntax.\nFor more information, see https://handlebarsjs.com/guide/#basic-usage.",
"type": "object",
"additionalProperties": {}
},
"models": {
"description": "Globally defined model settings. Any prompts that use these models will have these settings applied by default,\nunless they override them with their own model settings.",
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": {}
}
},
"default_model": {
"description": "Default model to use for prompts that do not specify a model.",
"type": "string"
},
"model_parsers": {
"description": "Model ID to ModelParser ID mapping.\nThis is useful if you want to use a custom ModelParser for a model, or if a single ModelParser can handle multiple models.",
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
},
"prompts": {
"description": "Array of prompts that make up the AIConfig.",
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"description": "A unique identifier for the prompt. This is used to reference the prompt in other parts of the AIConfig (such as other prompts)",
"type": "string"
},
"input": {
"$ref": "#/definitions/PromptInput",
"description": "The prompt string, or a more complex prompt object."
},
"metadata": {
"type": "object",
"additionalProperties": {},
"properties": {
"parameters": {
"description": "Parameter definitions that are accessible to this prompt.\nThese parameters can be referenced in the prompt using {{param_name}} handlebars syntax.\nFor more information, see https://handlebarsjs.com/guide/#basic-usage.",
"type": "object",
"additionalProperties": {}
},
"model": {
"description": "Model name/settings that apply to this prompt.\nThese settings override any global model settings that may have been defined in the AIConfig metadata.\nIf this is a string, it is assumed to be the model name.\nIf this is undefined, the default model specified in the default_model property will be used for this Prompt.",
"anyOf": [
{
"type": "object",
"properties": {
"name": {
"description": "The ID of the model to use.",
"type": "string"
},
"settings": {
"description": "Model inference settings that apply to this prompt.",
"type": "object",
"additionalProperties": {}
}
},
"required": [
"name"
]
},
{
"type": "string"
}
]
},
"tags": {
"description": "Tags for this prompt. Tags must be unique, and must not contain commas.",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"outputs": {
"description": "Execution, display, or stream outputs.",
"type": "array",
"items": {
"$ref": "#/definitions/Output"
}
}
},
"required": [
"input",
"name"
]
}
}
},
"required": [
"metadata",
"name",
"prompts",
"schema_version"
],
"definitions": {
"SchemaVersion": {
"anyOf": [
{
"type": "object",
"properties": {
"major": {
"type": "number"
},
"minor": {
"type": "number"
}
},
"required": [
"major",
"minor"
]
},
{
"enum": [
"latest",
"v1"
],
"type": "string"
}
]
},
"PromptInput": {
"anyOf": [
{
"type": "object",
"additionalProperties": {},
"properties": {
"attachments": {
"description": "Attachments can be used to pass in multiple inputs of varying MIME types (ex: image, audio)",
"type": "array",
"items": {
"type": "object",
"properties": {
"data": {
"description": "The data representing the attachment",
"anyOf": [
{
"type": "object",
"additionalProperties": {}
},
{
"$ref": "#/definitions/JSONArray"
},
{
"description": "This represents the attachment data that is stored as a string, but we use\nboth the `kind` field here and the `mime_type` in Attachment to convert\nthe string into the input format we want.",
"type": "object",
"properties": {
"kind": {
"enum": [
"base64",
"file_uri"
],
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"kind",
"value"
]
},
{
"type": [
"null",
"string",
"number",
"boolean"
]
}
]
},
"mime_type": {
"description": "The MIME type of the result. If not specified, the MIME type will be\nassumed to be text/plain",
"type": "string"
},
"metadata": {
"description": "Attachment metadata",
"type": "object",
"additionalProperties": {}
}
},
"required": [
"data"
]
}
},
"data": {
"$ref": "#/definitions/JSONValue",
"description": "Input to the model. This can represent a single input, or multiple inputs.\nThe structure of the data object is up to the ModelParser."
}
}
},
{
"type": "string"
}
]
},
"JSONValue": {
"anyOf": [
{
"type": "object",
"additionalProperties": {}
},
{
"$ref": "#/definitions/JSONArray"
},
{
"type": [
"null",
"string",
"number",
"boolean"
]
}
]
},
"JSONArray": {
"type": "array",
"items": {
"$ref": "#/definitions/JSONValue"
}
},
"Output": {
"description": "Model inference result.",
"anyOf": [
{
"description": "Result of executing a prompt.",
"type": "object",
"properties": {
"output_type": {
"description": "Type of output.",
"type": "string",
"const": "execute_result"
},
"execution_count": {
"description": "A result's prompt number.",
"type": "number"
},
"data": {
"description": "The result of executing the prompt.",
"anyOf": [
{
"type": "object",
"additionalProperties": {}
},
{
"$ref": "#/definitions/JSONArray"
},
{
"description": "This represents the output content that is storied as a string, but we use\nboth the `kind` field here and the `mime_type` in ExecuteResult to convert\nthe string into the output format we want.",
"type": "object",
"properties": {
"kind": {
"enum": [
"base64",
"file_uri"
],
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"kind",
"value"
]
},
{
"description": "The following is based off of ChatCompletionMessageToolCall\nfrom openai/types/chat and is used for general tool calls.",
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "tool_calls"
},
"value": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {},
"properties": {
"id": {
"description": "Note: the `id` field is non-optional in OpenAI but we're keeping\nit optional for practical purposes. See:\nhttps://github.com/lastmile-ai/aiconfig/pull/636#discussion_r1437087325",
"type": "string"
},
"type": {
"type": "string",
"const": "function"
},
"function": {
"description": "The function that the model called.",
"type": "object",
"properties": {
"arguments": {
"description": "The arguments to call the function with, as generated by the model in JSON\nformat. Note that the model does not always generate valid JSON, and may\nhallucinate parameters not defined by your function schema. Validate the\narguments in your code before calling your function.",
"type": "string"
},
"name": {
"description": "The name of the function to call.",
"type": "string"
}
},
"required": [
"arguments",
"name"
]
}
},
"required": [
"function",
"type"
]
}
}
},
"required": [
"kind",
"value"
]
},
{
"type": [
"null",
"string",
"number",
"boolean"
]
}
]
},
"mime_type": {
"description": "The MIME type of the result. If not specified, the MIME type will be assumed to be plain text.",
"type": "string"
},
"metadata": {
"description": "Output metadata.",
"type": "object",
"additionalProperties": {}
}
},
"required": [
"data",
"output_type"
]
},
{
"description": "Output of an error that occurred during inference.",
"type": "object",
"properties": {
"output_type": {
"description": "Type of output.",
"type": "string",
"const": "error"
},
"ename": {
"description": "The name of the error.",
"type": "string"
},
"evalue": {
"description": "The value, or message, of the error.",
"type": "string"
},
"traceback": {
"description": "The error's traceback, represented as an array of strings.",
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"ename",
"evalue",
"output_type",
"traceback"
]
}
]
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}