Skip to content
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

plan-and-execute example => TypeError: can only concatenate list (not "tuple") to list #978

Open
5 tasks done
nick-youngblut opened this issue Jul 10, 2024 · 1 comment · May be fixed by #1256
Open
5 tasks done

Comments

@nick-youngblut
Copy link

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangGraph/LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangGraph/LangChain rather than my code.
  • I am sure this is better as an issue rather than a GitHub discussion, since this is a LangGraph bug and not a design question.

Example Code

Simply running the [Plan-and-Execute](https://langchain-ai.github.io/langgraph/tutorials/plan-and-execute/plan-and-execute) code

Error Message and Stack Trace (if applicable)

{
	"name": "TypeError",
	"message": "can only concatenate list (not \"tuple\") to list",
	"stack": "---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[47], line 3
      1 config = {\"recursion_limit\": 50}
      2 inputs = {\"input\": \"what is the hometown of the 2024 Australia open winner?\"}
----> 3 async for event in app.astream(inputs, config=config):
      4     for k, v in event.items():
      5         if k != \"__end__\":

File /usr/local/lib/python3.11/site-packages/langgraph/pregel/__init__.py:1446, in Pregel.astream(self, input, config, stream_mode, output_keys, input_keys, interrupt_before, interrupt_after, debug)
   1441     print_step_writes(
   1442         step, pending_writes, self.stream_channels_list
   1443     )
   1445 # apply writes to channels
-> 1446 _apply_writes(
   1447     checkpoint,
   1448     channels,
   1449     pending_writes,
   1450     (
   1451         self.checkpointer.get_next_version
   1452         if self.checkpointer
   1453         else _increment
   1454     ),
   1455 )
   1457 # yield current values
   1458 if \"values\" in stream_modes:

File /usr/local/lib/python3.11/site-packages/langgraph/pregel/__init__.py:1758, in _apply_writes(checkpoint, channels, pending_writes, get_next_version)
   1756 if chan in channels:
   1757     try:
-> 1758         updated = channels[chan].update(vals)
   1759     except InvalidUpdateError as e:
   1760         raise InvalidUpdateError(
   1761             f\"Invalid update for channel {chan} with values {vals}\"
   1762         ) from e

File /usr/local/lib/python3.11/site-packages/langgraph/channels/binop.py:96, in BinaryOperatorAggregate.update(self, values)
     94     values = values[1:]
     95 for value in values:
---> 96     self.value = self.operator(self.value, value)
     97 return True

TypeError: can only concatenate list (not \"tuple\") to list"
}

Description

I'm running the code in a Jupyter notebook in a VS Code devcontainer on my macbook.

System Info

System Information

OS: Linux
OS Version: #1 SMP PREEMPT Wed Dec 6 17:08:31 UTC 2023
Python Version: 3.11.9 (main, Jul 2 2024, 21:48:22) [GCC 10.2.1 20210110]

Package Information

langchain_core: 0.2.12
langchain: 0.2.7
langchain_community: 0.2.7
langsmith: 0.1.84
langchain_google_vertexai: 1.0.6
langchain_groq: 0.1.6
langchain_openai: 0.1.14
langchain_text_splitters: 0.2.2
langchain_weaviate: 0.0.2
langchainhub: 0.1.20
langgraph: 0.1.6

Packages not installed (Not Necessarily a Problem)

The following packages were not found:

langserve

@tisage
Copy link

tisage commented Jul 17, 2024

The tutorial omitted a pair of square brackets [] in the past_steps line.
Fixed version:

    return {
        # "past_steps": (task, agent_response["messages"][-1].content),
        "past_steps": [(task, agent_response["messages"][-1].content)],
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants