extract method
Extract structured data from text
Implementation
Future<Map<String, dynamic>?> extract(
String text,
Map<String, dynamic> schema,
) async {
return executeWithRetry(
() async {
final response = await _dio.post(
'$_baseUrl/api/extract',
data: {
'text': text,
'schema': schema,
},
);
return Map<String, dynamic>.from(
response.data['data'] ?? response.data,
);
},
maxAttempts: 3,
estimatedCost: 0.002,
);
}