This repository was archived by the owner on Jun 6, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
api/src/main/java/com/theokanning/openai/completion
client/src/test/java/com/theokanning/openai Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 6
6
import lombok .NoArgsConstructor ;
7
7
8
8
import java .util .List ;
9
+ import java .util .Map ;
9
10
10
11
/**
11
12
* A request for OpenAi to generate a predicted completion for a prompt.
@@ -110,6 +111,15 @@ public class CompletionRequest {
110
111
*/
111
112
Integer bestOf ;
112
113
114
+ /**
115
+ * Modify the likelihood of specified tokens appearing in the completion.
116
+ *
117
+ * Maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100.
118
+ *
119
+ * https://beta.openai.com/docs/api-reference/completions/create#completions/create-logit_bias
120
+ */
121
+ Map <String , Integer > logitBias ;
122
+
113
123
/**
114
124
* A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse.
115
125
*/
Original file line number Diff line number Diff line change 4
4
import com .theokanning .openai .completion .CompletionRequest ;
5
5
import org .junit .jupiter .api .Test ;
6
6
7
+ import java .util .HashMap ;
7
8
import java .util .List ;
8
9
9
10
import static org .junit .jupiter .api .Assertions .assertFalse ;
@@ -21,6 +22,7 @@ void createCompletion() {
21
22
.prompt ("Somebody once told me the world is gonna roll me" )
22
23
.echo (true )
23
24
.user ("testing" )
25
+ .logitBias (new HashMap <>())
24
26
.build ();
25
27
26
28
List <CompletionChoice > choices = service .createCompletion (completionRequest ).getChoices ();
You can’t perform that action at this time.
0 commit comments