Skip to content

Commit

Permalink
Change order for spec consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Mar 8, 2024
1 parent 5bfe6a2 commit f7da578
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* @param toolChoice {@link String} or {@link ToolChoice}
*/
public record CreateChatCompletionRequest(
String model,
List<ChatMessage> messages,
String model,
Optional<Double> frequencyPenalty,
Optional<Map<Integer, Integer>> logitBias,
Optional<Boolean> logprobs,
Expand Down Expand Up @@ -43,10 +43,10 @@ public static class Builder {

private static final String DEFAULT_MODEL = "gpt-3.5-turbo";

private String model = DEFAULT_MODEL;

private final List<ChatMessage> messages = new LinkedList<>();

private String model = DEFAULT_MODEL;

private Optional<Double> frequencyPenalty = Optional.empty();
private Optional<Map<Integer, Integer>> logitBias = Optional.empty();
private Optional<Boolean> logprobs = Optional.empty();
Expand All @@ -64,14 +64,6 @@ public static class Builder {
private Optional<Object> toolChoice = Optional.empty();
private Optional<String> user = Optional.empty();

/**
* @param model ID of the model to use
*/
public Builder model(String model) {
this.model = model;
return this;
}

/**
* @param message message to append to the list of messages comprising the conversation so far
*/
Expand All @@ -88,6 +80,14 @@ public Builder messages(List<ChatMessage> messages) {
return this;
}

/**
* @param model ID of the model to use
*/
public Builder model(String model) {
this.model = model;
return this;
}

/**
* @param frequencyPenalty Number between -2.0 and 2.0. Positive values penalize new tokens
* based on their existing frequency in the text so far, decreasing the model's likelihood
Expand Down Expand Up @@ -276,8 +276,8 @@ public Builder user(String user) {

public CreateChatCompletionRequest build() {
return new CreateChatCompletionRequest(
model,
List.copyOf(messages),
model,
frequencyPenalty,
logitBias,
logprobs,
Expand Down

0 comments on commit f7da578

Please sign in to comment.