-
-
Notifications
You must be signed in to change notification settings - Fork 517
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
Fix returning/yielding chat message from callback #5712
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5712 +/- ##
==========================================
+ Coverage 82.45% 84.11% +1.65%
==========================================
Files 288 288
Lines 41995 42054 +59
==========================================
+ Hits 34629 35374 +745
+ Misses 7366 6680 -686
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 19 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
UPDATE: WORKS NOW I've tested that But import panel as pn
import pandas as pd
agent_user="Pandas Agent"
agent_avatar="🐼"
pn.extension("perspective")
def _create_message(message):
return pn.chat.ChatMessage(message, user="Pandas Agent", avatar="🐼")
async def callback(contents, user, instance):
if isinstance(contents, pd.DataFrame):
instance.active=1
print("I was here")
yield _create_message("You uploaded a dataframe. Ask me anything about it")
yield _create_message("That is a great question. I don't know.")
chat_interface = pn.chat.ChatInterface(
widgets=[pn.widgets.FileInput(name="Upload"), pn.widgets.TextInput(name="Message")],
renderers=pn.pane.Perspective,
callback=callback,
callback_exception="verbose",
)
chat_interface.send("I'm your LangChain Pandas Agent!", user="Pandas Agent", avatar="🐼", respond=False)
chat_interface.servable() |
Should be fixed now. |
I can confirm its fixed.Thanks. |
Closes #5708