openai-java
openai-java copied to clipboard
demo code return with error 400
I strictly followed the demo code, but still got http 400 error when i call it

Try upgrading to 0.10.0 and switching to the OpenAiService in the service library. It will give more detailed info when a request fails.
Does running the example work for you?
OpenAiService service = new OpenAiService("xxxx",Duration.ofSeconds(300)); CompletionRequest completionRequest = CompletionRequest.builder() .prompt("说出你的问题") .model("text-davinci-003").maxTokens(2048) .build(); System.out.println(service.createCompletion(completionRequest).getChoices().get(0).getText());
Try upgrading to 0.10.0 and switching to the
OpenAiServicein theservicelibrary. It will give more detailed info when a request fails.Does running the example work for you?
I've already done those in my project. I managed to invalidate cache & restart my ide, and now it works. Thanks