Skip to content

Commit 18f4bde

Browse files
committed
add functionCall
1 parent c91dca7 commit 18f4bde

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/main/java/com/plexpt/chatgpt/entity/chat/ChatCompletion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class ChatCompletion implements Serializable {
3131

3232
@NonNull
3333
@Builder.Default
34-
private String model = Model.GPT_3_5_TURBO.getName();
34+
private String model = Model.GPT_3_5_TURBO_0613.getName();
3535

3636
@NonNull
3737
private List<Message> messages;

src/main/java/com/plexpt/chatgpt/entity/chat/Message.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.plexpt.chatgpt.entity.chat;
22

33
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
46
import lombok.AllArgsConstructor;
57
import lombok.Builder;
68
import lombok.Data;
@@ -23,6 +25,9 @@ public class Message {
2325
private String content;
2426
private String name;
2527

28+
@JsonProperty("function_call")
29+
private String functionCall;
30+
2631
public Message(String role, String content) {
2732
this.role = role;
2833
this.content = content;
@@ -42,14 +47,21 @@ public static Message ofAssistant(String content) {
4247

4348
return new Message(Role.ASSISTANT.getValue(), content);
4449
}
45-
50+
51+
public static Message ofFunction(String function) {
52+
53+
return new Message(Role.FUNCTION.getValue(), function);
54+
}
55+
4656
@Getter
4757
@AllArgsConstructor
4858
public enum Role {
4959

5060
SYSTEM("system"),
5161
USER("user"),
5262
ASSISTANT("assistant"),
63+
64+
FUNCTION("function"),
5365
;
5466
private String value;
5567
}

0 commit comments

Comments
 (0)