Closed joaopegoraro closed 2 months ago
Currently the responseFormat on createStream is just a Map<String, String>, but if we want to pass the json_schema like the example from here, we can't, since json_schema must be an object, like so:
responseFormat
createStream
Map<String, String>
json_schema
{ "type": "json_schema", "json_schema": { "name": "math_response", "schema": { "type": "object", "properties": { "steps": { "type": "array", "items": { "type": "object", "properties": { "explanation": {"type": "string"}, "output": {"type": "string"} }, "required": ["explanation", "output"], "additionalProperties": false } }, "final_answer": {"type": "string"} }, "required": ["steps", "final_answer"], "additionalProperties": false }, "strict": true } }
It should be of type Map<String, dynamic> to allow usage of this feature
Map<String, dynamic>
Any updates on this? seems reasonable for me
openai_dart just added support for Structured Outputs: https://pub.dev/packages/openai_dart/changelog#041
Currently the
responseFormat
oncreateStream
is just aMap<String, String>
, but if we want to pass thejson_schema
like the example from here, we can't, sincejson_schema
must be an object, like so:It should be of type
Map<String, dynamic>
to allow usage of this feature