Updating example to not use new api (#33)

This commit is contained in:
Robin Glauser 2022-12-04 19:39:31 +01:00 committed by GitHub
parent 5e14d4f62b
commit 0caab13666
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,12 +41,13 @@ or
### Using OpenAiService ### Using OpenAiService
If you're looking for the fastest solution, import the `client` and use [OpenAiService](client/src/main/java/com/theokanning/openai/OpenAiService.java). If you're looking for the fastest solution, import the `client` and use [OpenAiService](client/src/main/java/com/theokanning/openai/OpenAiService.java).
``` ```
OpenAiService service = new OpenAiService(your_token) OpenAiService service = new OpenAiService("your_token");
CompletionRequest completionRequest = CompletionRequest.builder() CompletionRequest completionRequest = CompletionRequest.builder()
.prompt("Somebody once told me the world is gonna roll me") .prompt("Somebody once told me the world is gonna roll me")
.model("ada")
.echo(true) .echo(true)
.build(); .build();
service.createCompletion("ada", completionRequest).getChoices().forEach(System.out::println); service.createCompletion( completionRequest).getChoices().forEach(System.out::println);
``` ```
### Using OpenAiApi Retrofit client ### Using OpenAiApi Retrofit client