-
-
Notifications
You must be signed in to change notification settings - Fork 341
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
Log exceptions in /generate
to a file
#431
Conversation
I think this is a good approach as a fallback, but given that a common failure mode for /generate is that a model doesn't produce valid JSON, we should catch that error and handle it in a more user centered manner. Otherwise, users are going to look at that log file and open a GitHub issue this repo, when really we should be informing them that the model they were using wasn't able to generate valid JSON for the prompt and that they should try a different model. |
@ellisonbg I am tracking your suggestion as a separate issue in #435. Making this change will take more time as we need to reliably detect when an LLM is failing to generate JSON, and distinguish that from other exceptions. Currently, I am seeing a double exception emitted from LangChain when I use some less-capable language models:
|
Co-authored-by: Jason Weill <[email protected]>
* rename process_message() => on_message() * remove unused import * add handle_exc() method in BaseChatHandler * add _default_handle_exc() to handle excs from handle_exc() * log exceptions from /generate to a file * pre-commit * improve call to action in GenerateCH.handle_exc() * prefer period over colon in timestamped filenames Co-authored-by: Jason Weill <[email protected]> --------- Co-authored-by: Jason Weill <[email protected]>
* rename process_message() => on_message() * remove unused import * add handle_exc() method in BaseChatHandler * add _default_handle_exc() to handle excs from handle_exc() * log exceptions from /generate to a file * pre-commit * improve call to action in GenerateCH.handle_exc() * prefer period over colon in timestamped filenames Co-authored-by: Jason Weill <[email protected]> --------- Co-authored-by: Jason Weill <[email protected]>
Description
BaseChatHandler.process_message()
=>BaseChatHandler.on_message()
BaseChatHandler._process_message()
=>BaseChatHandler.process_message()
BaseChatHandler
for chat handlers to override:self.handle_exc()
. This allows chat handlers to define their own way of handling exceptions. If this is undefined, a default implementation is provided byBaseChatHandler
.GenerateChatHandler
to a timestamped file under./jupyter-ai-logs/
.Demo