Skip to content

Commit

Permalink
add functionCall
Browse files Browse the repository at this point in the history
  • Loading branch information
PlexPt committed Jun 15, 2023
1 parent c91dca7 commit 18f4bde
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class ChatCompletion implements Serializable {

@NonNull
@Builder.Default
private String model = Model.GPT_3_5_TURBO.getName();
private String model = Model.GPT_3_5_TURBO_0613.getName();

@NonNull
private List<Message> messages;
Expand Down
14 changes: 13 additions & 1 deletion src/main/java/com/plexpt/chatgpt/entity/chat/Message.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.plexpt.chatgpt.entity.chat;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -23,6 +25,9 @@ public class Message {
private String content;
private String name;

@JsonProperty("function_call")
private String functionCall;

public Message(String role, String content) {
this.role = role;
this.content = content;
Expand All @@ -42,14 +47,21 @@ public static Message ofAssistant(String content) {

return new Message(Role.ASSISTANT.getValue(), content);
}


public static Message ofFunction(String function) {

return new Message(Role.FUNCTION.getValue(), function);
}

@Getter
@AllArgsConstructor
public enum Role {

SYSTEM("system"),
USER("user"),
ASSISTANT("assistant"),

FUNCTION("function"),
;
private String value;
}
Expand Down

0 comments on commit 18f4bde

Please sign in to comment.