File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed
Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,36 @@ local cjson = require("cjson")
22local types
33types = require (" tableshape" ).types
44local empty = (types [" nil" ] + types .literal (cjson .null )):describe (" nullable" )
5+ local input_content_item = types .one_of ({
6+ types .partial ({
7+ type = " input_text" ,
8+ text = types .string
9+ }),
10+ types .partial ({
11+ type = " input_image" ,
12+ image_url = types .string
13+ }),
14+ types .partial ({
15+ type = " input_file" ,
16+ file_id = types .string
17+ }),
18+ types .partial ({
19+ type = " input_file" ,
20+ file_url = types .string
21+ }),
22+ types .partial ({
23+ type = " input_file" ,
24+ file_data = types .string ,
25+ filename = types .string
26+ })
27+ })
528local input_format = types .string + types .array_of (types .partial ({
629 role = types .one_of ({
730 " system" ,
831 " user" ,
932 " assistant"
1033 }),
11- content = types .string
34+ content = types .string + types . array_of ( input_content_item )
1235}))
1336local content_item = types .one_of ({
1437 types .partial ({
Original file line number Diff line number Diff line change @@ -3,10 +3,19 @@ import types from require "tableshape"
33
44empty = ( types. nil + types. literal( cjson. null)) \ describe " nullable"
55
6+ -- Schema for validating input content items (text, images, etc.)
7+ input_content_item = types. one_of {
8+ types. partial { type : " input_text" , text : types. string }
9+ types. partial { type : " input_image" , image_url : types. string } -- URL or base64 data URI (e.g. "data:image/jpeg;base64,...")
10+ types. partial { type : " input_file" , file_id : types. string } -- uploaded file reference
11+ types. partial { type : " input_file" , file_url : types. string } -- external URL (PDFs)
12+ types. partial { type : " input_file" , file_data : types. string, filename : types. string } -- base64 encoded
13+ }
14+
615-- Schema for validating input parameter which can be string or array of messages
716input_format = types. string + types. array_of types. partial {
817 role : types. one_of { " system" , " user" , " assistant" }
9- content : types. string
18+ content : types. string + types . array_of ( input_content_item )
1019}
1120
1221-- Schema for validating response content items
You can’t perform that action at this time.
0 commit comments