-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python bindings: add possibility to clear history of a chat_session #2358
Comments
The session should be reset at the end of the from gpt4all import GPT4All
model = GPT4All("Phi-3-mini-4k-instruct.Q4_0.gguf")
with model.chat_session():
print(model.generate("2 fun names for a pelican"))
print(model.generate("2 more"))
with model.chat_session():
print("-- should have reset --")
print(model.generate("2 more")) I get this:
|
that does not work for me. In my tkinter app mainloop() must at the end of the with statement. |
You might be able to achieve the same effect by calling Try something like this: from gpt4all import GPT4All
model = GPT4All("Phi-3-mini-4k-instruct.Q4_0.gguf")
# First chat session
session = model.chat_session()
session.__enter__()
try:
print(model.generate("2 fun names for a pelican"))
print(model.generate("2 more"))
finally:
session.__exit__(None, None, None)
# Second chat session
session = model.chat_session()
session.__enter__()
try:
print("-- should have reset --")
print(model.generate("2 more"))
finally:
session.__exit__(None, None, None) You can keep that |
Excellent, thanks! That works. https://github.com/woheller69/gpt4all-TK-CHAT/blob/main/appGUI.py |
Feature Request
Once initiating a chat session by
there is no way to start a new session without leaving and restarting the CLI.
What about adding something like gpt4all_instance.chat_session.reset() to start a new chat with the same model
The text was updated successfully, but these errors were encountered: