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
importpprintinputs= {
"messages": [
("user", "What does Lilian Weng say about the types of agent memory?"),
]
}
foroutputingraph.stream(inputs):
forkey, valueinoutput.items():
pprint.pprint(f"Output from node '{key}':")
pprint.pprint("---")
pprint.pprint(value, indent=2, width=80, depth=None)
pprint.pprint("\n---\n")
Error Message and Stack Trace (if applicable)
KeyError Traceback (most recent call last)
Cell In[8], line 8
1 import pprint
3 inputs = {
4 "messages": [
5 ("user", "What does Lilian Weng say about the types of agent memory?"),
6 ]
7 }
----> 8 for output in graph.stream(inputs):
9 for key, value in output.items():
10 pprint.pprint(f"Output from node '{key}':")
File ~/.pyenv/versions/3.11.7/envs/langc2/lib/python3.11/site-packages/langgraph/pregel/init.py:771, in Pregel.stream(self, input, config, stream_mode, output_keys, input_keys, interrupt_before, interrupt_after, debug)
764 done, inflight = concurrent.futures.wait(
765 futures,
766 return_when=concurrent.futures.FIRST_EXCEPTION,
767 timeout=self.step_timeout,
768 )
770 # panic on failure or timeout
--> 771 _panic_or_proceed(done, inflight, step)
773 # combine pending writes from all tasks
774 pending_writes = dequetuple[str, Any]
File ~/.pyenv/versions/3.11.7/envs/langc2/lib/python3.11/site-packages/langchain_core/runnables/base.py:2499, in RunnableSequence.invoke(self, input, config)
2497 try:
2498 for i, step in enumerate(self.steps):
-> 2499 input = step.invoke(
2500 input,
2501 # mark each step as a child run
2502 patch_config(
2503 config, callbacks=run_manager.get_child(f"seq:step:{i+1}")
2504 ),
2505 )
2506 # finish the root run
2507 except BaseException as e:
File ~/.pyenv/versions/3.11.7/envs/langc2/lib/python3.11/site-packages/langgraph/utils.py:88, in RunnableCallable.invoke(self, input, config)
82 context.run(var_child_runnable_config.set, config)
83 kwargs = (
84 {**self.kwargs, "config": config}
85 if accepts_config(self.func)
86 else self.kwargs
87 )
---> 88 ret = context.run(self.func, input, **kwargs)
89 if isinstance(ret, Runnable) and self.recurse:
90 return ret.invoke(input, config)
Checked other resources
Example Code
Running the exact LangChain notebook form here: https://github.com/langchain-ai/langgraph/blob/main/examples/rag/langgraph_agentic_rag.ipynb
The error occurs when running the very last cell:
Error Message and Stack Trace (if applicable)
KeyError Traceback (most recent call last)
Cell In[8], line 8
1 import pprint
3 inputs = {
4 "messages": [
5 ("user", "What does Lilian Weng say about the types of agent memory?"),
6 ]
7 }
----> 8 for output in graph.stream(inputs):
9 for key, value in output.items():
10 pprint.pprint(f"Output from node '{key}':")
File ~/.pyenv/versions/3.11.7/envs/langc2/lib/python3.11/site-packages/langgraph/pregel/init.py:771, in Pregel.stream(self, input, config, stream_mode, output_keys, input_keys, interrupt_before, interrupt_after, debug)
764 done, inflight = concurrent.futures.wait(
765 futures,
766 return_when=concurrent.futures.FIRST_EXCEPTION,
767 timeout=self.step_timeout,
768 )
770 # panic on failure or timeout
--> 771 _panic_or_proceed(done, inflight, step)
773 # combine pending writes from all tasks
774 pending_writes = dequetuple[str, Any]
File ~/.pyenv/versions/3.11.7/envs/langc2/lib/python3.11/site-packages/langgraph/pregel/init.py:1263, in _panic_or_proceed(done, inflight, step)
1261 inflight.pop().cancel()
1262 # raise the exception
-> 1263 raise exc
1264 # TODO this is where retry of an entire step would happen
1266 if inflight:
1267 # if we got here means we timed out
File ~/.pyenv/versions/3.11.7/lib/python3.11/concurrent/futures/thread.py:58, in _WorkItem.run(self)
55 return
57 try:
---> 58 result = self.fn(*self.args, **self.kwargs)
59 except BaseException as exc:
60 self.future.set_exception(exc)
File ~/.pyenv/versions/3.11.7/envs/langc2/lib/python3.11/site-packages/langchain_core/runnables/base.py:2499, in RunnableSequence.invoke(self, input, config)
2497 try:
2498 for i, step in enumerate(self.steps):
-> 2499 input = step.invoke(
2500 input,
2501 # mark each step as a child run
2502 patch_config(
2503 config, callbacks=run_manager.get_child(f"seq:step:{i+1}")
2504 ),
2505 )
2506 # finish the root run
2507 except BaseException as e:
File ~/.pyenv/versions/3.11.7/envs/langc2/lib/python3.11/site-packages/langgraph/utils.py:88, in RunnableCallable.invoke(self, input, config)
82 context.run(var_child_runnable_config.set, config)
83 kwargs = (
84 {**self.kwargs, "config": config}
85 if accepts_config(self.func)
86 else self.kwargs
87 )
---> 88 ret = context.run(self.func, input, **kwargs)
89 if isinstance(ret, Runnable) and self.recurse:
90 return ret.invoke(input, config)
File ~/.pyenv/versions/3.11.7/envs/langc2/lib/python3.11/site-packages/langgraph/graph/graph.py:74, in Branch._route(self, input, config, reader, writer)
72 result = [result]
73 if self.ends:
---> 74 destinations = [self.ends[r] for r in result]
75 else:
76 destinations = result
File ~/.pyenv/versions/3.11.7/envs/langc2/lib/python3.11/site-packages/langgraph/graph/graph.py:74, in (.0)
72 result = [result]
73 if self.ends:
---> 74 destinations = [self.ends[r] for r in result]
75 else:
76 destinations = result
KeyError: 'action'
Description
Cannot run the graph from the notebook LangGraph_agentic_rag.ipynb. It fails with KeyError: 'action'.
System Info
System Information
Package Information
Packages not installed (Not Necessarily a Problem)
The following packages were not found:
The text was updated successfully, but these errors were encountered: