generateStructured method
Generates a JSON object that is guaranteed to match schema.
schema is a JSON-Schema subset: object (with properties and
required), array (with items, minItems, maxItems), string,
number, integer, boolean, enum of strings, and description on
any node. Properties are generated in the order they are written.
images are encoded image bytes (JPEG, PNG, HEIC). They need iOS 27 and
NativeAiCapabilities.vision; otherwise the call throws
VISION_UNSUPPORTED.
Implementation
Future<Map<String, dynamic>> generateStructured({
required String prompt,
required Map<String, dynamic> schema,
String? instructions,
List<Uint8List> images = const [],
String schemaName = 'Response',
double? temperature,
int? maxTokens,
Duration? timeout,
}) {
return AppleFoundationFlutterPlatform.instance.generateStructured(
prompt: prompt,
schema: schema,
instructions: instructions,
images: images,
schemaName: schemaName,
temperature: temperature,
maxTokens: maxTokens,
timeout: timeout,
);
}