jupyter-ai icon indicating copy to clipboard operation
jupyter-ai copied to clipboard

Allow developers to override built-in chat commands

Open JasonWeill opened this issue 1 year ago • 4 comments
trafficstars

Problem

After #398 is merged, developers can only add slash commands, and cannot modify existing slash commands.

Proposed Solution

Allow developers to modify existing slash commands in the Jupyter AI chat interface.

Additional context

We should also update the help message if a built-in chat command is rewritten or disabled; see #436.

JasonWeill avatar Dec 06 '23 23:12 JasonWeill

I was surprised to see that this was left out of https://github.com/jupyterlab/jupyter-ai/pull/398. I really looked forward to the ability to fully customise the slash commands and viewing the PR in early phases I understood that it will enable that. I would like to quote @Zsailer suggestion from that PR:

override builtin commands to do bad or unexpected things, which would hurt trust in Jupyter AI.

Sure, but it is Python and a bad actor can simply replace jai_chat_handlers setting from their own package/extension... which is exactly what I would to do to replace these values as a "good actor" 😉. Unfortunately, you can't get around this hackery.

For my immediate use-case, I want to disable some of the default chat handlers (not necessarily replace them) because they don't work well on my system. This already requires me to override the jai_chat_handlers setting. In a not-too-distance future, I could see replacing handlers with my own version that works for my system.

For the "good actors" who want to replace the default handlers—if you allows them to override using the entry-point system, you can detect this and log a warning to the user that the default command is being replaced.

Originally posted by @Zsailer in https://github.com/jupyterlab/jupyter-ai/issues/398#issuecomment-1843410388

Just saying that I fully agree with every word here.

krassowski avatar Dec 14 '23 11:12 krassowski

Hi!

I have looked over the plan for the upcoming release and could not find any mention about the status of this issue. Thus far, using jupyter-ai has been great and our users are very happy with it, but we feel it would be even better if we could substitute some of the built-in chat handlers. For instance, we could enable the RAG functionality offered by the /ask command as the default one, so that a user does not have to explicitly write /ask in front of every interaction with the chatbot.

How does this functionality fit within the existing timeplan/vision of jupyter-ai? Is someone working actively on it? Would a PR be welcomed, or are other features prioritized for now?

Side note: I am also curious on why this option is not allowed? We are explicitly checking for it (here, and here) but I am not sure why we are limiting this tool's flexibility.

ddnimara avatar Jul 09 '24 11:07 ddnimara

@ddnimara sorry I missed your reply; if you do open a PR I would be happy to review it.

krassowski avatar Jul 31 '24 15:07 krassowski

I'd also find this very useful. It would be nice if we could extend the commands in some way too

mlucool avatar Jul 31 '24 15:07 mlucool

@ddnimara @mlucool Hey, sorry for the lack of updates & feedback on this issue. I was super busy last year and some of the issues fell through the gaps. In the future, please don't hesitate to ping me directly if it looks like an important issue has gone stale. I've also set up a new GitHub project to help triage & organize future issues to ensure that they aren't forgotten.

@Darshan808 has contributed a PR to fix this behavior and it is currently in review. We'll likely backport this to the 2.x branch and cut a release. Thank you for using Jupyter AI and engaging with us! 🤗 ❤

dlqqq avatar Feb 18 '25 18:02 dlqqq