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 77219d4

Browse filesBrowse files
authored
Add user to CompletionRequest (TheoKanning#23)
Fixes TheoKanning#19
1 parent 1391f40 commit 77219d4
Copy full SHA for 77219d4

File tree

Expand file treeCollapse file tree

3 files changed

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

3 files changed

+7
-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
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,9 @@ public class CompletionRequest {
108108
* best_of must be greater than n.
109109
*/
110110
Integer bestOf;
111+
112+
/**
113+
* A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse.
114+
*/
115+
String user;
111116
}

‎client/src/test/java/com/theokanning/openai/CompletionTest.java

Copy file name to clipboardExpand all lines: client/src/test/java/com/theokanning/openai/CompletionTest.java
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ void createCompletion() {
1919
CompletionRequest completionRequest = CompletionRequest.builder()
2020
.prompt("Somebody once told me the world is gonna roll me")
2121
.echo(true)
22+
.user("testing")
2223
.build();
2324

2425
List<CompletionChoice> choices = service.createCompletion("ada", completionRequest).getChoices();

‎example/src/main/java/example/OpenAiApiExample.java

Copy file name to clipboardExpand all lines: example/src/main/java/example/OpenAiApiExample.java
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public static void main(String... args) {
2323
CompletionRequest completionRequest = CompletionRequest.builder()
2424
.prompt("Somebody once told me the world is gonna roll me")
2525
.echo(true)
26+
.user("testing")
2627
.build();
2728
service.createCompletion("ada", completionRequest).getChoices().forEach(System.out::println);
2829

0 commit comments

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