OpenAIStreamCompletionModel.fromMap constructor

OpenAIStreamCompletionModel.fromMap(
  1. Map<String, dynamic> json
)

This class is used to represent an OpenAI stream completion. This method is used to convert a Map<String, dynamic> object to a OpenAIStreamCompletionModel object.

Implementation

factory OpenAIStreamCompletionModel.fromMap(Map<String, dynamic> json) {
  return OpenAIStreamCompletionModel(
    id: json['id'],
    created: DateTime.fromMillisecondsSinceEpoch(json['created'] * 1000),
    choices: (json['choices'] as List)
        .map((e) => OpenAIStreamCompletionModelChoice.fromMap(e))
        .toList(),
    model: json['model'],
  );
}