structuredOutput method
Implementation
@override
Future<DVJsonObject> structuredOutput(
String prompt,
DVJsonObject schema,
) async {
final payload = await postJson(
endpoint('/v1/chat/completions'),
<String, Object?>{
..._completionsBody(prompt),
'response_format': <String, Object?>{
'type': 'json_schema',
'json_schema': <String, Object?>{
'name': 'dartvel_structured_output',
'strict': true,
'schema': DVJsonCodec.toJsonObject(schema),
},
},
},
);
return parseStructuredText(_firstChoiceContent(payload));
}