stream toolnode
This commit is contained in:
@@ -232,6 +232,7 @@ def debug_chatty_node():
|
|||||||
|
|
||||||
|
|
||||||
def debug_tool_node():
|
def debug_tool_node():
|
||||||
|
import jax
|
||||||
from langchain_core.messages.base import BaseMessageChunk
|
from langchain_core.messages.base import BaseMessageChunk
|
||||||
from lang_agent.components.tool_manager import ToolManagerConfig
|
from lang_agent.components.tool_manager import ToolManagerConfig
|
||||||
|
|
||||||
@@ -244,15 +245,13 @@ def debug_tool_node():
|
|||||||
memory=mem)
|
memory=mem)
|
||||||
|
|
||||||
query = "use calculator to calculate 33*42"
|
query = "use calculator to calculate 33*42"
|
||||||
input = ({"messages":[SystemMessage("you are a kind helper"),
|
input = ({"messages":[SystemMessage("you are a kind helper"), HumanMessage(query)]},
|
||||||
HumanMessage(query)]},
|
|
||||||
{"configurable": {"thread_id": '3'}})
|
{"configurable": {"thread_id": '3'}})
|
||||||
inp = {
|
graph = tool_node.tool_agent
|
||||||
"inp":input
|
|
||||||
}
|
|
||||||
|
|
||||||
out = tool_node.invoke(inp)
|
for chunk in graph.stream(*input, stream_mode="updates"):
|
||||||
assert 0
|
el = jax.tree.leaves(chunk)[-1]
|
||||||
|
print(el.pretty_print())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user