structuredOutput method
Implementation
@override
Future<DVJsonObject> structuredOutput(
String prompt,
DVJsonObject schema,
) async {
final payload = await postJson(
_generateContent(model),
<String, Object?>{
'contents': _textContents(prompt),
'generationConfig': <String, Object?>{
'maxOutputTokens': maxOutputTokens,
'responseMimeType': 'application/json',
'responseSchema': DVJsonCodec.toJsonObject(schema),
},
},
);
return parseStructuredText(_firstCandidateText(payload));
}