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

Commit

Permalink
Remove deprecated endpoints from example project (#40)
Browse files Browse the repository at this point in the history
The engine APIs are deprecated, and OpenAI will shut them down eventually
  • Loading branch information
TheoKanning authored Dec 4, 2022
1 parent 0caab13 commit c769239
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ CompletionRequest completionRequest = CompletionRequest.builder()
.model("ada")
.echo(true)
.build();
service.createCompletion( completionRequest).getChoices().forEach(System.out::println);
service.createCompletion(completionRequest).getChoices().forEach(System.out::println);
```

### Using OpenAiApi Retrofit client
Expand Down
11 changes: 2 additions & 9 deletions example/src/main/java/example/OpenAiApiExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,19 @@

import com.theokanning.openai.OpenAiService;
import com.theokanning.openai.completion.CompletionRequest;
import com.theokanning.openai.engine.Engine;

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

System.out.println("\nGetting available engines...");
service.getEngines().forEach(System.out::println);

System.out.println("\nGetting ada engine...");
Engine ada = service.getEngine("ada");
System.out.println(ada);

System.out.println("\nCreating completion...");
CompletionRequest completionRequest = CompletionRequest.builder()
.model("ada")
.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);
service.createCompletion(completionRequest).getChoices().forEach(System.out::println);
}
}

0 comments on commit c769239

Please sign in to comment.