File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -6184,6 +6184,38 @@ async def test_text_output_json_schema():
61846184 assert agent .output_json_schema () == snapshot ({'type' : 'string' })
61856185
61866186
6187+ async def test_auto_output_json_schema ():
6188+ agent = Agent ('test' , output_type = bool )
6189+ assert agent .output_json_schema () == snapshot (
6190+ {
6191+ 'type' : 'object' ,
6192+ 'properties' : {
6193+ 'result' : {
6194+ 'anyOf' : [
6195+ {
6196+ 'type' : 'object' ,
6197+ 'properties' : {
6198+ 'kind' : {'type' : 'string' , 'const' : 'final_result' },
6199+ 'data' : {
6200+ 'properties' : {'response' : {'type' : 'boolean' }},
6201+ 'required' : ['response' ],
6202+ 'type' : 'object' ,
6203+ },
6204+ },
6205+ 'required' : ['kind' , 'data' ],
6206+ 'additionalProperties' : False ,
6207+ 'title' : 'final_result' ,
6208+ 'description' : 'The final response which ends this conversation' ,
6209+ }
6210+ ]
6211+ }
6212+ },
6213+ 'required' : ['result' ],
6214+ 'additionalProperties' : False ,
6215+ }
6216+ )
6217+
6218+
61876219async def test_tool_output_json_schema ():
61886220 agent = Agent (
61896221 'test' ,
You can’t perform that action at this time.
0 commit comments