mirror of
https://github.com/hwchase17/langchain
synced 2024-11-08 07:10:35 +00:00
e6ebde9688
- **Description:** The experimental package needs to be compatible with the usage of importing agents For example, if i use `from langchain.agents import create_pandas_dataframe_agent`, running the program will prompt the following information: ``` Traceback (most recent call last): File "/Users/dongwm/test/main.py", line 1, in <module> from langchain.agents import create_pandas_dataframe_agent File "/Users/dongwm/test/venv/lib/python3.11/site-packages/langchain/agents/__init__.py", line 87, in __getattr__ raise ImportError( ImportError: create_pandas_dataframe_agent has been moved to langchain experimental. See https://github.com/langchain-ai/langchain/discussions/11680 for more information. Please update your import statement from: `langchain.agents.create_pandas_dataframe_agent` to `langchain_experimental.agents.create_pandas_dataframe_agent`. ``` But when I changed to `from langchain_experimental.agents import create_pandas_dataframe_agent`, it was actually wrong: ```python Traceback (most recent call last): File "/Users/dongwm/test/main.py", line 2, in <module> from langchain_experimental.agents import create_pandas_dataframe_agent ImportError: cannot import name 'create_pandas_dataframe_agent' from 'langchain_experimental.agents' (/Users/dongwm/test/venv/lib/python3.11/site-packages/langchain_experimental/agents/__init__.py) ``` I should use `from langchain_experimental.agents.agent_toolkits import create_pandas_dataframe_agent`. In order to solve the problem and make it compatible, I added additional import code to the langchain_experimental package. Now it can be like this Used `from langchain_experimental.agents import create_pandas_dataframe_agent` - **Twitter handle:** [lin_bob57617](https://twitter.com/lin_bob57617) |
||
---|---|---|
.. | ||
agent_toolkits | ||
__init__.py |