Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ec701cd

Browse filesBrowse files
authored
JsonProperties avoiding 'Unrecognized request argument supplied' error in Image and Completion Requests (TheoKanning#91)
1 parent 17cd491 commit ec701cd
Copy full SHA for ec701cd

File tree

Expand file treeCollapse file tree

2 files changed

+11
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-0
lines changed

‎api/src/main/java/com/theokanning/openai/completion/CompletionRequest.java

Copy file name to clipboardExpand all lines: api/src/main/java/com/theokanning/openai/completion/CompletionRequest.java
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import java.util.List;
99
import java.util.Map;
1010

11+
import com.fasterxml.jackson.annotation.JsonProperty;
12+
1113
/**
1214
* A request for OpenAi to generate a predicted completion for a prompt.
1315
* All fields are nullable.
@@ -41,6 +43,7 @@ public class CompletionRequest {
4143
* Requests can use up to 2048 tokens shared between prompt and completion.
4244
* (One token is roughly 4 characters for normal English text)
4345
*/
46+
@JsonProperty("max_tokens")
4447
Integer maxTokens;
4548

4649
/**
@@ -58,6 +61,7 @@ public class CompletionRequest {
5861
*
5962
* We generally recommend using this or {@link CompletionRequest#temperature} but not both.
6063
*/
64+
@JsonProperty("top_p")
6165
Double topP;
6266

6367
/**
@@ -98,12 +102,14 @@ public class CompletionRequest {
98102
* Number between 0 and 1 (default 0) that penalizes new tokens based on whether they appear in the text so far.
99103
* Increases the model's likelihood to talk about new topics.
100104
*/
105+
@JsonProperty("presence_penalty")
101106
Double presencePenalty;
102107

103108
/**
104109
* Number between 0 and 1 (default 0) that penalizes new tokens based on their existing frequency in the text so far.
105110
* Decreases the model's likelihood to repeat the same line verbatim.
106111
*/
112+
@JsonProperty("frequency_penalty")
107113
Double frequencyPenalty;
108114

109115
/**
@@ -114,6 +120,7 @@ public class CompletionRequest {
114120
* When used with {@link CompletionRequest#n}, best_of controls the number of candidate completions and n specifies how many to return,
115121
* best_of must be greater than n.
116122
*/
123+
@JsonProperty("best_of")
117124
Integer bestOf;
118125

119126
/**
@@ -123,6 +130,7 @@ public class CompletionRequest {
123130
*
124131
* https://beta.openai.com/docs/api-reference/completions/create#completions/create-logit_bias
125132
*/
133+
@JsonProperty("logit_bias")
126134
Map<String, Integer> logitBias;
127135

128136
/**

‎api/src/main/java/com/theokanning/openai/image/CreateImageRequest.java

Copy file name to clipboardExpand all lines: api/src/main/java/com/theokanning/openai/image/CreateImageRequest.java
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.theokanning.openai.image;
22

3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
35
import lombok.*;
46

57
/**
@@ -33,6 +35,7 @@ public class CreateImageRequest {
3335
/**
3436
* The format in which the generated images are returned. Must be one of url or b64_json. Defaults to url.
3537
*/
38+
@JsonProperty("response_format")
3639
String responseFormat;
3740

3841
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.