File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
api/src/main/java/com/theokanning/openai/completion/chat Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 18
18
*/
19
19
@ Data
20
20
@ NoArgsConstructor (force = true )
21
- @ RequiredArgsConstructor
22
21
@ AllArgsConstructor
23
22
public class ChatMessage {
24
23
25
24
/**
26
25
* Must be either 'system', 'user', 'assistant' or 'function'.<br>
26
+ * If it's set to null, it will be set to 'assistant' by default.<br>
27
27
* You may use {@link ChatMessageRole} enum.
28
28
*/
29
- @ NonNull
30
29
String role ;
31
30
@ JsonInclude () // content should always exist in the call, even if it is null
32
31
String content ;
@@ -40,12 +39,12 @@ public class ChatMessage {
40
39
ChatFunctionCall functionCall ;
41
40
42
41
public ChatMessage (String role , String content ) {
43
- this .role = role ;
42
+ this .role = role == null ? "assistant" : role ;
44
43
this .content = content ;
45
44
}
46
45
47
46
public ChatMessage (String role , String content , String name ) {
48
- this .role = role ;
47
+ this .role = role == null ? "assistant" : role ;
49
48
this .content = content ;
50
49
this .name = name ;
51
50
}
You can’t perform that action at this time.
0 commit comments