This repository was archived by the owner on Jun 6, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +3
-10
lines changed
example/src/main/java/example Expand file tree Collapse file tree 2 files changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ CompletionRequest completionRequest = CompletionRequest.builder()
47
47
.model("ada")
48
48
.echo(true)
49
49
.build();
50
- service.createCompletion( completionRequest).getChoices().forEach(System.out::println);
50
+ service.createCompletion(completionRequest).getChoices().forEach(System.out::println);
51
51
```
52
52
53
53
### Using OpenAiApi Retrofit client
Original file line number Diff line number Diff line change 2
2
3
3
import com .theokanning .openai .OpenAiService ;
4
4
import com .theokanning .openai .completion .CompletionRequest ;
5
- import com .theokanning .openai .engine .Engine ;
6
5
7
6
class OpenAiApiExample {
8
7
public static void main (String ... args ) {
9
8
String token = System .getenv ("OPENAI_TOKEN" );
10
9
OpenAiService service = new OpenAiService (token );
11
10
12
- System .out .println ("\n Getting available engines..." );
13
- service .getEngines ().forEach (System .out ::println );
14
-
15
- System .out .println ("\n Getting ada engine..." );
16
- Engine ada = service .getEngine ("ada" );
17
- System .out .println (ada );
18
-
19
11
System .out .println ("\n Creating completion..." );
20
12
CompletionRequest completionRequest = CompletionRequest .builder ()
13
+ .model ("ada" )
21
14
.prompt ("Somebody once told me the world is gonna roll me" )
22
15
.echo (true )
23
16
.user ("testing" )
24
17
.build ();
25
- service .createCompletion ("ada" , completionRequest ).getChoices ().forEach (System .out ::println );
18
+ service .createCompletion (completionRequest ).getChoices ().forEach (System .out ::println );
26
19
}
27
20
}
You can’t perform that action at this time.
0 commit comments