Skip to content

Commit

Permalink
Merged develop into main
Browse files Browse the repository at this point in the history
# Conflicts:
#	build.gradle
  • Loading branch information
LookforFPS committed Aug 14, 2024
2 parents 7ed3883 + 0fcd3aa commit 509c6eb
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {

project.group = 'me.lookforfps'
project.description = "OpenAI Java API"
project.version = new Version("1", "0", "0")
project.version = new Version("1", "0", "1")

java {
sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

[versions]
com-fasterxml-jackson-core-jackson-databind = "2.17.0"
org-projectlombok-lombok = "1.18.32"
org-slf4j-slf4j-api = "2.0.13"
com-fasterxml-jackson-core-jackson-databind = "2.17.2"
org-projectlombok-lombok = "1.18.34"
org-slf4j-slf4j-api = "2.0.16"

[libraries]
com-fasterxml-jackson-core-jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "com-fasterxml-jackson-core-jackson-databind" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ private byte[] buildRequest() throws IOException {
requestDto.setMax_tokens(config.getMaxTokens());
requestDto.setN(config.getChoices());
requestDto.setPresence_penalty(config.getPresencePenalty());
if(config.getResponseType() != null) {
requestDto.setResponse_format(new ResponseFormat(config.getResponseType().getIdentifier()));
}
requestDto.setResponse_format(config.getResponseFormat());
requestDto.setSeed(config.getSeed());
if(config.getServiceTier() != null) {
requestDto.setService_tier(config.getServiceTier().getIdentifier());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import lombok.Data;
import lombok.EqualsAndHashCode;
import me.lookforfps.oja.chatcompletion.model.natives.request.ResponseFormat;
import me.lookforfps.oja.chatcompletion.model.natives.request.ResponseType;
import me.lookforfps.oja.chatcompletion.model.natives.request.ServiceTier;
import me.lookforfps.oja.chatcompletion.model.natives.tools.Tool;
Expand Down Expand Up @@ -111,7 +112,7 @@ public class ChatCompletionConfiguration extends Configuration {
* <br><br>
* Setting to <code>{ "type": "json_object" }</code> enables JSON mode, which guarantees the message the model generates is valid JSON.
*/
private ResponseType responseType;
private ResponseFormat responseFormat;
/**
* What sampling temperature to use, between 0 and 2.
* Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.<br>
Expand Down Expand Up @@ -163,4 +164,11 @@ public void removeTool(Tool tool) {
public void removeTool(int toolIndex) {
tools.remove(toolIndex);
}

public void setResponseFormat(ResponseType responsetype) {
this.responseFormat = new ResponseFormat(responsetype.getIdentifier());
}
public void setResponseFormat(String jsonSchema) {
this.responseFormat = new ResponseFormat("json_schema", jsonSchema);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,20 @@ public class AssistantMessage extends Message {

private String content;
private String name;
private String refusal;
private List<ToolCall> tool_calls;


public AssistantMessage(String content, String name, List<ToolCall> tool_calls) {
public AssistantMessage(String content, String name, String refusal, List<ToolCall> tool_calls) {
super(MessageRole.ASSISTANT);
this.content = content;
this.name = name;
this.refusal = refusal;
this.tool_calls = tool_calls;
}
public AssistantMessage(String content, String name, List<ToolCall> tool_calls) {
this(content, name, null, tool_calls);
}
public AssistantMessage(String content, List<ToolCall> tool_calls) {
this(content, null, tool_calls);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
package me.lookforfps.oja.chatcompletion.model.natives.request;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseFormat {
private String type;
private String json_schema;

public ResponseFormat(String type, String jsonSchema) {
this.type = type;
this.json_schema = jsonSchema;
}
public ResponseFormat(String type) {
this(type, null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ public class Delta {

private String role;
private String content;
private String refusal;
private List<ToolCall> tool_calls;
}

0 comments on commit 509c6eb

Please sign in to comment.