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

Better input/output visibility in Langchain callback #7478

Merged
merged 5 commits into from Oct 5, 2023

Conversation

pokidyshev
Copy link
Contributor

@pokidyshev pokidyshev commented Oct 3, 2023

Show long inputs under the cut:
image

Copy link
Collaborator

@vdonato vdonato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @pokidyshev!

Code-wise this LGTM, but I'll defer to our product team as to whether we want to make this change (CC @sfc-gh-jcarroll)

@sfc-gh-jcarroll
Copy link
Collaborator

Thanks for the contribution!

I don't think we should change the default behavior for all usage (which this seems to do)

If it only modified the input behavior if the input_str was longer than MAX_TOOL_INPUT_STR_LENGTH, I would be more onboard! Might suggest doing something like:

if input_str > MAX_TOOL_INPUT_STR_LENGTH:
    self._container.markdown(f"**Input:**\n\n{input_str}")
    self._container.divider()

And then don't modify the output

If you want to push an app with the change so we can play around with it (or record a quick video) that would help too with deciding whether to accept this.

BTW If you just want this for your own uses, I believe you can easily just take the file, make your changes and import / use it in your own app. It should be fairly standalone and stable at this point.

@pokidyshev
Copy link
Contributor Author

Hello @sfc-gh-jcarroll,

Thank you for your valuable suggestions! I have updated the code accordingly. Regarding the .divider(), while I understand its potential utility, I personally feel that \n\n**Output:** provides clearer segmentation without occupying too much space. Currently, I am utilizing a modified version of this file in my project, as you suggested. However, I would love to see this feature integrated into the library since reviewing inputs can significantly aid in debugging agents.

@pokidyshev
Copy link
Contributor Author

@sfc-gh-jcarroll
Copy link
Collaborator

This looks great. The way you implemented it makes sense and I'm fine with that approach instead of the divider. The Loom is very helpful too, thanks for putting it together 😄

@vdonato good by me to approve and merge

@vdonato
Copy link
Collaborator

vdonato commented Oct 5, 2023

Thanks again @pokidyshev!

@vdonato vdonato merged commit 94774c8 into streamlit:develop Oct 5, 2023
49 checks passed
eric-skydio pushed a commit to eric-skydio/streamlit that referenced this pull request Dec 20, 2023
* Better input/output visibility in Langchain callback

* Update streamlit_callback_handler.py

* Update streamlit_callback_handler.py

* Update streamlit_callback_handler.py

* Update streamlit_callback_handler.py
zyxue pushed a commit to zyxue/streamlit that referenced this pull request Mar 22, 2024
* Better input/output visibility in Langchain callback

* Update streamlit_callback_handler.py

* Update streamlit_callback_handler.py

* Update streamlit_callback_handler.py

* Update streamlit_callback_handler.py
zyxue pushed a commit to zyxue/streamlit that referenced this pull request Apr 16, 2024
* Better input/output visibility in Langchain callback

* Update streamlit_callback_handler.py

* Update streamlit_callback_handler.py

* Update streamlit_callback_handler.py

* Update streamlit_callback_handler.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants