in pkgs/google_generative_ai/lib/src/content.dart [66:98]
Part _parsePart(Object? jsonObject) {
return switch (jsonObject) {
{'text': final String text} => TextPart(text),
{
'functionCall': {
'name': final String name,
'args': final Map<String, Object?> args
}
} =>
FunctionCall(name, args),
{
'functionResponse': {'name': String _, 'response': Map<String, Object?> _}
} =>
throw UnimplementedError('FunctionResponse part not yet supported'),
{'inlineData': {'mimeType': String _, 'data': String _}} =>
throw UnimplementedError('inlineData content part not yet supported'),
{
'executableCode': {
'language': final String language,
'code': final String code,
}
} =>
ExecutableCode(Language._parse(language), code),
{
'codeExecutionResult': {
'outcome': final String outcome,
'output': final String output,
}
} =>
CodeExecutionResult(Outcome._parse(outcome), output),
_ => throw unhandledFormat('Part', jsonObject),
};
}