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")
|
.model("ada")
|
||||||
.echo(true)
|
.echo(true)
|
||||||
.build();
|
.build();
|
||||||
service.createCompletion( completionRequest).getChoices().forEach(System.out::println);
|
service.createCompletion(completionRequest).getChoices().forEach(System.out::println);
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using OpenAiApi Retrofit client
|
### Using OpenAiApi Retrofit client
|
||||||
|
|
|
@ -2,26 +2,19 @@ package example;
|
||||||
|
|
||||||
import com.theokanning.openai.OpenAiService;
|
import com.theokanning.openai.OpenAiService;
|
||||||
import com.theokanning.openai.completion.CompletionRequest;
|
import com.theokanning.openai.completion.CompletionRequest;
|
||||||
import com.theokanning.openai.engine.Engine;
|
|
||||||
|
|
||||||
class OpenAiApiExample {
|
class OpenAiApiExample {
|
||||||
public static void main(String... args) {
|
public static void main(String... args) {
|
||||||
String token = System.getenv("OPENAI_TOKEN");
|
String token = System.getenv("OPENAI_TOKEN");
|
||||||
OpenAiService service = new OpenAiService(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...");
|
System.out.println("\nCreating completion...");
|
||||||
CompletionRequest completionRequest = CompletionRequest.builder()
|
CompletionRequest completionRequest = CompletionRequest.builder()
|
||||||
|
.model("ada")
|
||||||
.prompt("Somebody once told me the world is gonna roll me")
|
.prompt("Somebody once told me the world is gonna roll me")
|
||||||
.echo(true)
|
.echo(true)
|
||||||
.user("testing")
|
.user("testing")
|
||||||
.build();
|
.build();
|
||||||
service.createCompletion("ada", completionRequest).getChoices().forEach(System.out::println);
|
service.createCompletion(completionRequest).getChoices().forEach(System.out::println);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue