OpenAICompletionModel.fromMap constructor
This represents the response from a completion request by the OpenAICompletion
methods.
This method is used to convert a Map<String, dynamic> object to a OpenAICompletionModel object.
Implementation
factory OpenAICompletionModel.fromMap(Map<String, dynamic> json) {
return OpenAICompletionModel(
id: json['id'],
created: DateTime.fromMillisecondsSinceEpoch(json['created'] * 1000),
model: json['model'],
choices: (json['choices'] as List)
.map((i) => OpenAICompletionModelChoice.fromMap(i))
.toList(),
usage: json['usage'] != null
? OpenAICompletionModelUsage.fromMap(json['usage'])
: null,
systemFingerprint: json['system_fingerprint'],
);
}