generate method
Future<List<String> >
generate({
- required String prompt,
- double? temperature,
- int? seed,
- int? topK,
- int? candidateCount,
- int? maxOutputTokens,
override
Generates a list of strings based on a prompt using the on-device model.
Implementation
@override
Future<List<String>> generate({
required String prompt,
double? temperature,
int? seed,
int? topK,
int? candidateCount,
int? maxOutputTokens,
}) async {
final List<String>? result =
await methodChannel.invokeListMethod<String>('generateText', {
'prompt': prompt,
'temperature': temperature,
'seed': seed,
'topK': topK,
'candidateCount': candidateCount,
'maxOutputTokens': maxOutputTokens,
});
if (result == null) {
throw PlatformException(
code: 'NULL_RESPONSE',
message: 'The model returned null.',
);
}
return result;
}