diff --git a/src/main/java/info/istlab/Zemi01/chatgpt/OpenAiApiExample.java b/src/main/java/info/istlab/Zemi01/chatgpt/OpenAiApiExample.java index 5821e7f..e09f137 100644 --- a/src/main/java/info/istlab/Zemi01/chatgpt/OpenAiApiExample.java +++ b/src/main/java/info/istlab/Zemi01/chatgpt/OpenAiApiExample.java @@ -14,7 +14,7 @@ String token = System.getenv("OPENAI_TOKEN"); //環境変数で設定 // System.out.println(token); // System.exit(0); - com.theokanning.openai.service.OpenAiService service = new OpenAiService(token); + OpenAiService service = new OpenAiService(token); // System.out.println("\nCreating completion..."); // CompletionRequest completionRequest = CompletionRequest.builder() @@ -43,14 +43,15 @@ .model("gpt-3.5-turbo") .messages(messages) .n(1) - .maxTokens(150) + .maxTokens(50) .logitBias(new HashMap<>()) .build(); service.streamChatCompletion(chatCompletionRequest) .doOnError(Throwable::printStackTrace) - .blockingForEach(System.out::println); + .blockingForEach(t -> System.out.print(t.getChoices().get(0).getMessage().getContent())); + // .blockingForEach(System.out::println); - service.shutdownExecutor(); + service.shutdownExecutor(); } } \ No newline at end of file