Skip to content
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

PanelCallbackHandler design principle #5707

Closed
MarcSkovMadsen opened this issue Oct 21, 2023 · 2 comments · Fixed by #5710
Closed

PanelCallbackHandler design principle #5707

MarcSkovMadsen opened this issue Oct 21, 2023 · 2 comments · Fixed by #5710
Labels
type: discussion Requiring community discussion

Comments

@MarcSkovMadsen
Copy link
Collaborator

yesterday I changed the PanelCallBackHandler handler to also output the final response from the agent.

image

The change is marked below.

image

I can see that Streamlits Callback handler does not write the 'output'. The user/ developer have to manually do this.

image

I'm thinking that maybe it was a mistake by me to change this. What do you think @ahuang11 ?

@MarcSkovMadsen MarcSkovMadsen added TRIAGE Default label for untriaged issues type: discussion Requiring community discussion and removed TRIAGE Default label for untriaged issues labels Oct 21, 2023
@MarcSkovMadsen MarcSkovMadsen mentioned this issue Oct 21, 2023
37 tasks
@ahuang11
Copy link
Contributor

Right if users type return / yield in the callback, it would duplicate the results.

At the same time, all of the streaming from Langchain does not require any yield/return so if users use return, its also semi inconsistent.

One last point to consider is the tool usually reports the final answer.

@MarcSkovMadsen
Copy link
Collaborator Author

MarcSkovMadsen commented Oct 21, 2023

I'm more and more convinced it was a mistake. The CallbackHandler should be seen as something you attach to debug and can remove again. You should not change what else you do.

The code in the callback function should be

pn_cb = pn.chat.langchain.PanelCallbackHandler(instance=instance)
response = state.pandas_df_agent.run(contents, callbacks=[pn_cb])
return response

not

pn_cb = pn.chat.langchain.PanelCallbackHandler(instance=instance)
response = state.pandas_df_agent.run(contents, callbacks=[pn_cb])

I will make a PR to revert including updating the example notebooks. Then we can discuss from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: discussion Requiring community discussion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants