-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Open
Labels
python-bindingsgpt4all-bindings Python specific issuesgpt4all-bindings Python specific issues
Description
Issue you'd like to raise.
I have create a Gradio driven interface to GPT4All but I am having a problem trying to work out if it is possible to reset the chat session when the user hits "clear" - which resets the callback's history List argument to zero length.
I have a continuous history working using the Python with context as per the examples:
with model.chat_session():
def get_chat_response(message: str, history: list) -> str:
if (len(history) == 0):
print("how do i remove the chat history here")
result = ""
if (streaming):
for token in model.generate(prompt=message,
temp=0,
max_tokens=4000,
streaming=True):
result += token
yield result
else:
return model.generate(prompt=message,
temp=0,
max_tokens=4000)
if (streaming):
gr.ChatInterface(get_chat_response, chatbot=gr.Chatbot(height=1000)).queue().launch()
else:
gr.ChatInterface(get_chat_response, chatbot=gr.Chatbot(height=1000)).launch()
If I put the 'with model.chat_session()' within the callback it of course resets the chat session every prompt which is not desired.
I have also tried running model.chat_session() without using the context and this just produces #s as output tokens as the result.
Suggestion:
Add a function to reset the chat history within a session.
Metadata
Metadata
Assignees
Labels
python-bindingsgpt4all-bindings Python specific issuesgpt4all-bindings Python specific issues