openai-java
openai-java copied to clipboard
Completion with gpt-3.5-turbo is currently not supported
I get the following error when trying to use gpt-3.5-turbo model. Is there a plan to support this model?
`` com.theokanning.openai.OpenAiHttpException: This is a chat model and not supported in the v1/completions endpoint. Did you mean to use v1/chat/completions? at com.theokanning.openai.service.OpenAiService.execute(OpenAiService.java:220)
``
You should use createChatCompletion()
.
You should use
createChatCompletion()
.
Can send me example please
@HendSame can send me example please
It looks like this has not been pushed to maven repo yet.
Maven repo is still at 0.11.0 while github is at 0.19.0 already. It would be very much appreciated if the latest could be published to maven central.
@HendSame can send me example please
Refer to the API documentation: https://platform.openai.com/docs/api-reference/chat/create
Code example:
String token = System.getenv("OPENAI_TOKEN");
OpenAiService service = new OpenAiService(token);
List<ChatMessage> chatMessageList = new ArrayList<>();
ChatMessage chatMessage = new ChatMessage();
chatMessage.setContent("Hello!");
chatMessage.setRole("user");
chatMessageList.add(chatMessage);
ChatCompletionRequest chatCompletionRequest = ChatCompletionRequest.builder()
.model("gpt-3.5-turbo")
.messages(chatMessageList).build();
service.createChatCompletion(chatCompletionRequest);
It looks like this has not been pushed to maven repo yet.
Yes, current version(0.19.0) is required. You can package it by yourself.
createChatCompletion
should be supported in 0.11.0
I have a few changes going out in 0.11.1 but they're all minor
Thanks. I did compile and it works great. I would be thrilled to see an example that uses streaming. Or some explanation of how to get the incremental content from openai server.