You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// This represents the message of the [OpenAIChatCompletionChoiceModel] model of the OpenAI API, which is used and get returned while using the [OpenAIChat] methods.
3
5
/// {@endtemplate}
4
6
classOpenAIChatCompletionChoiceMessageModel {
5
7
/// The [role] of the message.
6
-
finalString role;
8
+
finalOpenAIChatMessageRole role;
7
9
8
10
/// The [content] of the message.
9
11
finalString content;
@@ -24,15 +26,16 @@ class OpenAIChatCompletionChoiceMessageModel {
24
26
Map<String, dynamic> json,
25
27
) {
26
28
returnOpenAIChatCompletionChoiceMessageModel(
27
-
role: json['role'],
29
+
role:OpenAIChatMessageRole.values
30
+
.firstWhere((role) => role.name == json['role']),
28
31
content: json['content'],
29
32
);
30
33
}
31
34
32
35
/// This method used to convert the [OpenAIChatCompletionChoiceMessageModel] to a [Map<String, dynamic>] object.
0 commit comments