mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-10 15:33:11 +00:00
core[major]: On Tool End Observation Casting Fix (#18798)
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>
This commit is contained in:
committed by
GitHub
parent
a96a6e0f2c
commit
43db4cd20e
@@ -1068,7 +1068,7 @@
|
||||
"\n",
|
||||
" def on_tool_end(\n",
|
||||
" self,\n",
|
||||
" output: str,\n",
|
||||
" output: Any,\n",
|
||||
" *,\n",
|
||||
" run_id: UUID,\n",
|
||||
" parent_run_id: Optional[UUID] = None,\n",
|
||||
@@ -1076,7 +1076,7 @@
|
||||
" ) -> Any:\n",
|
||||
" \"\"\"Run when tool ends running.\"\"\"\n",
|
||||
" print(\"Tool end\")\n",
|
||||
" print(output)\n",
|
||||
" print(str(output))\n",
|
||||
"\n",
|
||||
" async def on_llm_end(\n",
|
||||
" self,\n",
|
||||
|
@@ -59,7 +59,7 @@ class BaseCallbackHandler:
|
||||
) -> Any:
|
||||
"""Run when tool starts running."""
|
||||
|
||||
def on_tool_end(self, output: str, **kwargs: Any) -> Any:
|
||||
def on_tool_end(self, output: Any, **kwargs: Any) -> Any:
|
||||
"""Run when tool ends running."""
|
||||
|
||||
def on_tool_error(
|
||||
|
Reference in New Issue
Block a user