OpenAICompletionModel.fromMap constructor
This represents the response from a completion request. 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: OpenAICompletionModelUsage.fromMap(json['usage']),
);
}