Created
March 3, 2023 00:18
-
-
Save jtmuller5/e5773498cf4327ebd75c9665730ac6df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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