Skip to content

Instantly share code, notes, and snippets.

@jtmuller5
Last active March 3, 2023 10:57
Show Gist options
  • Save jtmuller5/3a38aee3216b6a71ac31970ec132ef6a to your computer and use it in GitHub Desktop.
Save jtmuller5/3a38aee3216b6a71ac31970ec132ef6a to your computer and use it in GitHub Desktop.
import 'gpt_choice_message.dart';
import 'package:json_annotation/json_annotation.dart';
part 'gpt_choice.g.dart';
@JsonSerializable(explicitToJson: true)
class GptChoice {
GptChoiceMessage message;
@JsonKey(name: 'finish_reason')
String? finishReason;
int index;
// Constructor
GptChoice({required this.message, required this.finishReason, required this.index});
// Factory
factory GptChoice.fromJson(Map<String, dynamic> json) => _$GptChoiceFromJson(json);
// To Json
Map<String, dynamic> toJson() => _$GptChoiceToJson(this);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment