Add user to CompletionRequest (#23)

Fixes https://github.com/TheoKanning/openai-java/issues/19
This commit is contained in:
Theo Kanning 2022-08-19 09:44:38 -05:00 committed by GitHub
parent 1391f4074d
commit 77219d497b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View File

@ -108,4 +108,9 @@ public class CompletionRequest {
* best_of must be greater than n.
*/
Integer bestOf;
/**
* A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse.
*/
String user;
}

View File

@ -19,6 +19,7 @@ public class CompletionTest {
CompletionRequest completionRequest = CompletionRequest.builder()
.prompt("Somebody once told me the world is gonna roll me")
.echo(true)
.user("testing")
.build();
List<CompletionChoice> choices = service.createCompletion("ada", completionRequest).getChoices();

View File

@ -23,6 +23,7 @@ class OpenAiApiExample {
CompletionRequest completionRequest = CompletionRequest.builder()
.prompt("Somebody once told me the world is gonna roll me")
.echo(true)
.user("testing")
.build();
service.createCompletion("ada", completionRequest).getChoices().forEach(System.out::println);