Remove deprecated endpoints from example project (#40)
The engine APIs are deprecated, and OpenAI will shut them down eventually
This commit is contained in:
parent
0caab13666
commit
c76923926e
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue