Remove deprecated endpoints from example project (#40)

The engine APIs are deprecated, and OpenAI will shut them down eventually
This commit is contained in:
Theo Kanning 2022-12-04 12:44:30 -06:00 committed by GitHub
parent 0caab13666
commit c76923926e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 10 deletions

View File

@ -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

View File

@ -2,26 +2,19 @@ package example;
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);
}
}