Open eix128 opened 1 year ago
I am going to create a new project item to address your first point to support streaming.
The second point. it is not clear but please open another issue for it with clarification as will assign this issue to streaming development.
Well , i mean when i ask a question to chatgpt , it will initiate a session. So when i ask second question , it also gets the first questions data.
Example :
I entered first my error :
Me: org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "alter table egitmen_dersler drop foreign key FKsnhnfh73svhpbno5xa5sqb4l3" via JDBC Statement
Chatgpt : The exception you are encountering, org.hibernate.tool.schema.spi.CommandAcceptanceException, indicates an error occurred while executing a Data Definition Language (DDL) statement via a JDBC statement in Hibernate. Specifically, the error message suggests that there was a problem with executing the following DDL statement:
Me: how to solve the issue on jpa side ?
Chatgpt:
To solve the issue on the JPA side, you can try the following steps:
Verify the entity mappings: Ensure that the JPA entity associated with the table egitmen_dersler has the correct mapping for the foreign key relationship. Make sure that the @JoinColumn or @JoinTable annotations are correctly specified, matching the foreign key constraint name FKsnhnfh73svhpbno5xa5sqb4l3.
Check the cascade options: If there are cascading relationships defined in the entity mappings, review the cascade options to ensure they are appropriate for your use case. If necessary, adjust the cascade options to match your desired behavior when deleting or updating related entities.
If i directly pass 2nd question to chatgpt as webservice , it doesnt know which issue i have. So i need some way to pass session like data to webservice.So it will answer to second related question.
So we need something like session or chat initialization.
Openai backend does not support the session id, but you can send the messages history as part of the call. This way the model will be aware of the ongoing conversation.
Example:
This is the way to initiate the first conversaion:
Chatbot bot = new Chatbot(openaiKey, SupportedChatModels.openai);
String mode = "You are a helpful astronomy assistant.";
ChatModelInput input = new ChatGPTInput.Builder(mode).addUserMessage("what is the space between moon and earth").build();
// the model responses
List<String> resValues = bot.chat(input);
You can add the model response to the history, then add your new message:
input.addMessage(new ChatGPTMessage("<replace with the model response>", "assistant"))
input.addUserMessage("<replace with your new message>")
Now when you send the input to the chatbot, it will be aware of the conversation history:
List<String> resValues = bot.chat(input);
you can checkout this library: https://github.com/Grt1228/chatgpt-java but its chinese. It would be good if we can add this to this library. It supports plugins use and stream
Hi , how can i get ChatGPT realtime response like on openai website. This api awaits for response so much long time.
And how can i get current session id of webrequest ? I mean i ask many questions on 1 session.