You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def db_tool_node(state: dict, config: RunnableConfig) -> dict[str, Any]:
"""Initialise a tool node that executes the tools and writes
all returned keys and values to the state variable.
TODO: This should be a modular class.
"""
messages = []
out = {}
for tool_call in state["messages"][-1].tool_calls:
tool = tools_by_name[tool_call["name"]]
state_args = {var: state for var in _get_state_args(tool)}
observation = tool.invoke({**tool_call["args"], **state_args}, config=config)
# observation = observation['score']
# print(f"observation: {observation}")
message_content = observation
messages.append(
ToolMessage(content=message_content, tool_call_id=tool_call["id"])
)
# out = {**out, **observation}
out = {**out, "observation": observation}
return {"messages": messages, **out}
But I can't import _get_state_args via from langgraph.prebuilt.tool_node import _get_state_args after upgrading to langgraph > 0.3. What is the workaround? I found some discussion here but I couldn't get it resolved. Also, it is found here, but I can't figure a way to import it.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I used to create a custom tool node like this.
But I can't import
_get_state_args
viafrom langgraph.prebuilt.tool_node import _get_state_args
after upgrading tolanggraph > 0.3
. What is the workaround? I found some discussion here but I couldn't get it resolved. Also, it is found here, but I can't figure a way to import it.Beta Was this translation helpful? Give feedback.
All reactions