Skip to content
This repository was archived by the owner on Jun 6, 2024. It is now read-only.

Commit c769239

Browse files
authored
Remove deprecated endpoints from example project (#40)
The engine APIs are deprecated, and OpenAI will shut them down eventually
1 parent 0caab13 commit c769239

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ CompletionRequest completionRequest = CompletionRequest.builder()
4747
.model("ada")
4848
.echo(true)
4949
.build();
50-
service.createCompletion( completionRequest).getChoices().forEach(System.out::println);
50+
service.createCompletion(completionRequest).getChoices().forEach(System.out::println);
5151
```
5252

5353
### Using OpenAiApi Retrofit client

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,19 @@
22

33
import com.theokanning.openai.OpenAiService;
44
import com.theokanning.openai.completion.CompletionRequest;
5-
import com.theokanning.openai.engine.Engine;
65

76
class OpenAiApiExample {
87
public static void main(String... args) {
98
String token = System.getenv("OPENAI_TOKEN");
109
OpenAiService service = new OpenAiService(token);
1110

12-
System.out.println("\nGetting available engines...");
13-
service.getEngines().forEach(System.out::println);
14-
15-
System.out.println("\nGetting ada engine...");
16-
Engine ada = service.getEngine("ada");
17-
System.out.println(ada);
18-
1911
System.out.println("\nCreating completion...");
2012
CompletionRequest completionRequest = CompletionRequest.builder()
13+
.model("ada")
2114
.prompt("Somebody once told me the world is gonna roll me")
2215
.echo(true)
2316
.user("testing")
2417
.build();
25-
service.createCompletion("ada", completionRequest).getChoices().forEach(System.out::println);
18+
service.createCompletion(completionRequest).getChoices().forEach(System.out::println);
2619
}
2720
}

0 commit comments

Comments
 (0)