panel icon indicating copy to clipboard operation
panel copied to clipboard

Deprecate `panel.langchain.PanelCallbackHandler` proposal

Open ahuang11 opened this issue 1 year ago • 1 comments

https://panel.holoviz.org/reference/chat/PanelCallbackHandler.html

Feature Overview The panel.langchain.PanelCallbackHandler was introduced to address challenges in streaming LangChain outputs and showing tool usage--for reference, see the original discussion in HoloViz Discourse.

Deprecation Proposal I propose deprecating this feature in Panel and migrating it to the langchain-community repository. This aligns with how similar callback handlers, such as the StreamlitCallbackHandler, are managed. By moving this to the LangChain ecosystem, the feature becomes more discoverable to LangChain users and fosters community-driven development.

Impact Assessment The feature does not appear to have widespread adoption, but there were notably a: Feature request Bug report

The suggested alternative is to use LangChain’s LCEL with a custom callback in ChatFeed or Interface.

Effort Involved Most of the necessary work has already been done, notably in the LangChain PR #27039, which simplifies the migration process.

The primary remaining tasks include:

  • Having the PR reviewed and approved in the LangChain community side (please give it an upvote)
  • Updating the Panel documentation to reflect the deprecation and point to langchain-community
  • Adding a deprecation warning in the Panel code.

ahuang11 avatar Nov 07 '24 12:11 ahuang11

Based on a GitHub search it's currently used by three projects:

  • https://github.com/divyeg/meakuchatbot_project
  • https://github.com/cloudera/AI_AGENTS/
  • https://github.com/TechNickAI/cora-panel

That doesn't seem like a big impact even if we remove it entirely because LangChain won't accept it. We could then simply inline it in a chat example and other users can vendor the code themselves.

philippjfr avatar Nov 07 '24 13:11 philippjfr