-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
605 additions
and
37 deletions.
There are no files selected for viewing
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
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
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
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
31 changes: 19 additions & 12 deletions
31
...ctor/openai/entity/CompletionMessage.java → ...onnector/openai/entity/OpenaiMessage.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,52 @@ | ||
package de.l3s.interweb.connector.openai.entity; | ||
|
||
import java.util.List; | ||
|
||
import io.quarkus.runtime.annotations.RegisterForReflection; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import de.l3s.interweb.core.chat.Message; | ||
import de.l3s.interweb.core.chat.ToolCall; | ||
|
||
@RegisterForReflection | ||
public final class CompletionMessage { | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public final class OpenaiMessage { | ||
private String role; | ||
@JsonIgnore | ||
private String name; | ||
private String content; | ||
private String refusal; | ||
@JsonProperty("tool_calls") | ||
private List<ToolCall> toolCalls; | ||
|
||
public CompletionMessage(Message message) { | ||
public OpenaiMessage(Message message) { | ||
this.role = message.getRole().name(); | ||
this.name = message.getName(); | ||
this.content = message.getContent(); | ||
this.refusal = message.getRefusal(); | ||
this.toolCalls = message.getToolCalls(); | ||
} | ||
|
||
public String getRole() { | ||
return role; | ||
} | ||
|
||
public void setRole(String role) { | ||
this.role = role; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getContent() { | ||
return content; | ||
} | ||
|
||
public void setContent(String content) { | ||
this.content = content; | ||
public String getRefusal() { | ||
return refusal; | ||
} | ||
|
||
public List<ToolCall> getToolCalls() { | ||
return toolCalls; | ||
} | ||
} |
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
42 changes: 42 additions & 0 deletions
42
interweb-core/src/main/java/de/l3s/interweb/core/chat/CallFunction.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package de.l3s.interweb.core.chat; | ||
|
||
import java.io.Serial; | ||
import java.io.Serializable; | ||
|
||
import jakarta.validation.constraints.NotEmpty; | ||
|
||
import io.quarkus.runtime.annotations.RegisterForReflection; | ||
|
||
@RegisterForReflection | ||
public class CallFunction implements Serializable { | ||
@Serial | ||
private static final long serialVersionUID = -2780720621585498099L; | ||
|
||
/** | ||
* The name of the function to call. | ||
*/ | ||
@NotEmpty | ||
private String name; | ||
|
||
/** | ||
* The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, | ||
* and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. | ||
*/ | ||
private String arguments; | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setArguments(String arguments) { | ||
this.arguments = arguments; | ||
} | ||
|
||
public String getArguments() { | ||
return arguments; | ||
} | ||
} |
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
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
Oops, something went wrong.