-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
[Core]: On Tool End Obersvation Casting Fix #18798
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might break a bunch of user code -- I'm going to scope out how to do this without introducing breaking changes
okay, please let me know about the scope so I can integrate that within this PR. Thank you. @eyurtsev |
Keep PR open for now in case we decide to make a breaking here |
OK I think we can actually do this! It's a breaking change, but not one that I think will affect many users, and likely better to do this than to implement a work-around. The remaining changes we need to make:
def on_tool_end(self, output: str, *, run_id: UUID, **kwargs: Any) -> Run:
"""End a trace for a tool run.""" to def on_tool_end(self, output: Any, *, run_id: UUID, **kwargs: Any) -> Run:
"""End a trace for a tool run."""
output = str(output) # Cast to maintain logic unchanged -- We can then follow up with another PR to actually fix astream_events:
|
@keenborder786 @eyurtsev looks like the same str casting appears elsewhere (in the langchain/libs/core/langchain_core/tools.py Line 501 in 62ba5e1
and langchain/libs/core/langchain_core/tools.py Line 509 in 62ba5e1
|
Yeah we should get both sync and async methods good catch @adreo00 |
@keenborder786 let me know if you're OK taking this on or want me to commandeer! Would be nice to merge a fix next week :) |
Ok. Yes I am taking this.
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Eugene Yurtsev ***@***.***>
Sent: Friday, March 8, 2024 11:38:06 PM
To: langchain-ai/langchain ***@***.***>
Cc: Mohammad Mohtashim Khan ***@***.***>; Mention ***@***.***>
Subject: Re: [langchain-ai/langchain] [Core]: On Tool End Obersvation Casting Fix (PR #18798)
CAUTION: This email has originated from outside of LUMS. Do not click links or open attachments unless you recognize sender’s email address and know the content is safe.
@keenborder786<https://github.com/keenborder786> let me know if you're OK taking this on or want me to commandeer! Would be nice to merge a fix next week :)
—
Reply to this email directly, view it on GitHub<#18798 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AKZFN6YXOFG7FVU6N7D2J3DYXIAQ5AVCNFSM6AAAAABEM3QLNOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBWGIYTGMRWG4>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@eyurtsev please review. |
I will create the second PR for tests that you have mentioned after you have given a green light for this one.. |
Looks good! On mobile right now, so won't merge until at my laptop later tonight. |
Had no time over the weekend, taking a look now |
This PR updates the on_tool_end handlers to return the raw output from the tool instead of casting it to a string. This is technically a breaking change, though it's impact is expected to be somewhat minimal. It will fix behavior in `astream_events` as well. Fixes the following issue langchain-ai#18760 raised by @eyurtsev --------- Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
This PR updates the on_tool_end handlers to return the raw output from the tool instead of casting it to a string. This is technically a breaking change, though it's impact is expected to be somewhat minimal. It will fix behavior in `astream_events` as well. Fixes the following issue langchain-ai#18760 raised by @eyurtsev --------- Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
…l_end (#18932) This PR completes work for PR #18798 to expose raw tool output in on_tool_end. Affected APIs: * astream_log * astream_events * callbacks sent to langsmith via langsmith-sdk * Any other code that relies on BaseTracer! --------- Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com> Co-authored-by: Bagatur <baskaryan@gmail.com>
…l_end (langchain-ai#18932) This PR completes work for PR langchain-ai#18798 to expose raw tool output in on_tool_end. Affected APIs: * astream_log * astream_events * callbacks sent to langsmith via langsmith-sdk * Any other code that relies on BaseTracer! --------- Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com> Co-authored-by: Bagatur <baskaryan@gmail.com>
This PR updates the on_tool_end handlers to return the raw output from the tool instead of casting it to a string. This is technically a breaking change, though it's impact is expected to be somewhat minimal. It will fix behavior in `astream_events` as well. Fixes the following issue #18760 raised by @eyurtsev --------- Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
…l_end (#18932) This PR completes work for PR #18798 to expose raw tool output in on_tool_end. Affected APIs: * astream_log * astream_events * callbacks sent to langsmith via langsmith-sdk * Any other code that relies on BaseTracer! --------- Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com> Co-authored-by: Bagatur <baskaryan@gmail.com>
Fixes the following issue #18760 raised by @eyurtsev