Skip to content

Instantly share code, notes, and snippets.

@jtmuller5
Created March 3, 2023 00:18
Show Gist options
  • Save jtmuller5/e5773498cf4327ebd75c9665730ac6df to your computer and use it in GitHub Desktop.
Save jtmuller5/e5773498cf4327ebd75c9665730ac6df to your computer and use it in GitHub Desktop.
import 'package:json_annotation/json_annotation.dart';
part 'gpt_choice_message.g.dart';
@JsonSerializable(explicitToJson: true)
class GptChoiceMessage{
String role;
String content;
// Stripped content
String get strippedContent => content.replaceAll('\n', '').replaceAll('"', '');
// Constructor
GptChoiceMessage({
required this.role,
required this.content,
});
// Factory
factory GptChoiceMessage.fromJson(Map<String, dynamic> json) => _$GptChoiceMessageFromJson(json);
// To Json
Map<String, dynamic> toJson() => _$GptChoiceMessageToJson(this);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment