-
Notifications
You must be signed in to change notification settings - Fork 537
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
astream_log produces TypeError: unsupported operand type(s) for +: 'dict' and 'dict' in passthrough.py #136
Comments
also mentioned in #124 |
any update on this one? |
I had the same issue and used some suggestions in #78 . after upgrading to python 3.12 and downgrading to langgraph 0.0.20 I could run all the example notebooks including this one (agent supervisor). However my graph needs sqlite memory from langgraph>=0.0.22 so I'm a bit stuck.
Would love to hear if anyone has a solution to this issue yet |
Will investigate tomorrow if it's langchain-core or langgraph. Similar error message appears in langserve |
cross linking langchain-ai/langserve#504 |
…form (#18743) Automatic upgrade to transform and atransform Closes: #18741 langchain-ai/langgraph#136 langchain-ai/langserve#504
Thank you for the fix @eyurtsev ! I upgraded to langchain_core 0.1.31 but still got the same error. Looks like the error message is pointing to langchain_core/runnables/passthrough.py instead of base.py. Do you mind looking into it and see if the same solution |
…ict (#19051) Follow up on #18743 which missed RunnablePassthrough Issues: #18741 langchain-ai/langgraph#136 langchain-ai/langserve#504
@mingxuan-he thanks for flagging -- This will be available during the next release. |
when do you expect the next release to be released? |
…ict (langchain-ai#19051) Follow up on langchain-ai#18743 which missed RunnablePassthrough Issues: langchain-ai#18741 langchain-ai/langgraph#136 langchain-ai/langserve#504
…form (langchain-ai#18743) Automatic upgrade to transform and atransform Closes: langchain-ai#18741 langchain-ai/langgraph#136 langchain-ai/langserve#504
…ict (langchain-ai#19051) Follow up on langchain-ai#18743 which missed RunnablePassthrough Issues: langchain-ai#18741 langchain-ai/langgraph#136 langchain-ai/langserve#504
This has been released in latest version of langchain-core |
…form (langchain-ai#18743) Automatic upgrade to transform and atransform Closes: langchain-ai#18741 langchain-ai/langgraph#136 langchain-ai/langserve#504
…ict (langchain-ai#19051) Follow up on langchain-ai#18743 which missed RunnablePassthrough Issues: langchain-ai#18741 langchain-ai/langgraph#136 langchain-ai/langserve#504
…form (#18743) Automatic upgrade to transform and atransform Closes: #18741 langchain-ai/langgraph#136 langchain-ai/langserve#504
…ict (#19051) Follow up on #18743 which missed RunnablePassthrough Issues: #18741 langchain-ai/langgraph#136 langchain-ai/langserve#504
Checked other resources
Example Code
The following code produces the error. I have found it in many different scenarios, but this uses one of your base examples from https://github.com/langchain-ai/langgraph/blob/main/examples/multi_agent/agent_supervisor.ipynb. The only change is the async invocation to produce the aysnc for output in graph.astream_log(): located at the very bottom of the code.
Error Message and Stack Trace (if applicable)
(agents_v09) JasonMacPro:agents_v09 jason$ python langgraph_astream_events.py
content='' additional_kwargs={'function_call': {'arguments': '', 'name': 'route'}}
content='' additional_kwargs={'function_call': {'arguments': '{"', 'name': ''}}
content='' additional_kwargs={'function_call': {'arguments': 'next', 'name': ''}}
content='' additional_kwargs={'function_call': {'arguments': '":"', 'name': ''}}
Traceback (most recent call last):
File "/Users/jason/Documents/agents_v09/langgraph_astream_events.py", line 165, in
asyncio.run(main())
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/Users/jason/Documents/agents_v09/langgraph_astream_events.py", line 147, in main
async for output in graph.astream_log(
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/site-packages/langchain_core/runnables/base.py", line 683, in astream_log
async for item in _astream_log_implementation( # type: ignore
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/site-packages/langchain_core/tracers/log_stream.py", line 612, in _astream_log_implementation
await task
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/site-packages/langchain_core/tracers/log_stream.py", line 566, in consume_astream
async for chunk in runnable.astream(input, config, **kwargs):
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/site-packages/langgraph/pregel/init.py", line 657, in astream
async for chunk in self.atransform(
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/site-packages/langgraph/pregel/init.py", line 675, in atransform
async for chunk in self._atransform_stream_with_config(
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/site-packages/langchain_core/runnables/base.py", line 1597, in _atransform_stream_with_config
chunk = cast(Output, await py_anext(iterator))
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/site-packages/langchain_core/tracers/log_stream.py", line 237, in tap_output_aiter
async for chunk in output:
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/site-packages/langgraph/pregel/init.py", line 524, in _atransform
_interrupt_or_proceed(done, inflight, step)
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/site-packages/langgraph/pregel/init.py", line 698, in _interrupt_or_proceed
raise exc
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/site-packages/langgraph/pregel/init.py", line 836, in _aconsume
async for _ in iterator:
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/site-packages/langchain_core/runnables/base.py", line 4140, in astream
async for item in self.bound.astream(
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/site-packages/langchain_core/runnables/base.py", line 2452, in astream
async for chunk in self.atransform(input_aiter(), config, **kwargs):
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/site-packages/langchain_core/runnables/base.py", line 2435, in atransform
async for chunk in self._atransform_stream_with_config(
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/site-packages/langchain_core/runnables/base.py", line 1597, in _atransform_stream_with_config
chunk = cast(Output, await py_anext(iterator))
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/site-packages/langchain_core/tracers/log_stream.py", line 237, in tap_output_aiter
async for chunk in output:
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/site-packages/langchain_core/runnables/base.py", line 2405, in _atransform
async for output in final_pipeline:
File "/Users/jason/.pyenv/versions/3.10.11/lib/python3.10/site-packages/langchain_core/runnables/passthrough.py", line 280, in atransform
final = final + chunk
TypeError: unsupported operand type(s) for +: 'dict' and 'dict'
Description
I am trying to stream output from a compiled langgraph using the astream_log (astream_events also produces this error). It is easily reproducible with example code in many of the langgraph examples if using astream_log rather than astream or synchronous calls.
System Info
langchain==0.1.8
langchain-community==0.0.21
langchain-core==0.1.25
langchain-experimental==0.0.52
langchain-mistralai==0.0.4
langchain-openai==0.0.6
langgraph==0.0.25
langsmith==0.1.5
Mac OSX 12.6.5
Python 3.10.11
The text was updated successfully, but these errors were encountered: