holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.8k stars 519 forks source link

Deprecate `panel.langchain.PanelCallbackHandler` proposal #7470

Open ahuang11 opened 2 weeks ago

ahuang11 commented 2 weeks ago

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:

philippjfr commented 2 weeks ago

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

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.