Constantly encountering issue/error while creating the full-chain while dealing with large database. #25131
Replies: 1 comment 3 replies
-
@mangeshcodeadda Hello! I'm here to help you with any bugs, questions, or become a contributor. The error "unsupported operand type(s) for |: 'dict' and 'list'" occurs because the In your code, the problematic line is: table_chain = {"input": itemgetter(f"{user_input}")} | table_chain Here, To fix this, you can use the
Here's the updated code snippet: from langchain_core.utils._merge import merge_dicts
# Ensure table_chain is a dictionary
table_chain_dict = {"input": itemgetter(f"{user_input}")}
# Merge dictionaries
table_chain = merge_dicts(table_chain_dict, table_chain)
# Set table_names_to_use using table_chain.
full_chain = RunnablePassthrough.assign(table_names_to_use=table_chain) | query_chain This should resolve the error by ensuring that the operands of the Additionally, make sure you are using the correct versions of the LangChain packages, as there might be updates that affect the usage of the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
Im using below pakages of langchin,
langchain 0.2.12
langchain-community 0.2.11
langchain-core 0.2.27
langchain-openai 0.1.20
constantly getting error as "unsupported operand type(s) for |: 'dict' and 'list'" at line "table_chain = {"input": itemgetter(f"{question}")} | table_chain", where table chain output is [Table(name='bmt_app_client'), Table(name='bmt_app_userprofile_client')]
System Info
System Information
Package Information
Packages not installed (Not Necessarily a Problem)
The following packages were not found:
Beta Was this translation helpful? Give feedback.
All reactions