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

DuckDuckGoSearchRun leads to AttributeError: 'FieldInfo' object has no attribute 'run' #27184

Closed
5 tasks done
m-henneke opened this issue Oct 8, 2024 · 6 comments
Closed
5 tasks done
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature

Comments

@m-henneke
Copy link

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the 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 LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

from langchain_community.tools import DuckDuckGoSearchRun

tool = DuckDuckGoSearchRun()

tool.invoke("Size of Eifel tower")

Error Message and Stack Trace (if applicable)

Traceback (most recent call last):
File "/opt/conda/envs/my_env/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3553, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 5, in
tool.invoke("Size of Eifel tower")
File "/opt/conda/envs/my_env/lib/python3.11/site-packages/langchain_core/tools/base.py", line 397, in invoke
return self.run(tool_input, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/my_env/lib/python3.11/site-packages/langchain_core/tools/base.py", line 586, in run
raise error_to_raise
File "/opt/conda/envs/my_env/lib/python3.11/site-packages/langchain_core/tools/base.py", line 555, in run
response = context.run(self._run, *tool_args, **tool_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/my_env/lib/python3.11/site-packages/langchain_community/tools/ddg_search/tool.py", line 73, in _run
return self.api_wrapper.run(query)
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'FieldInfo' object has no attribute 'run'

Description

I'm trying to run a DuckDuckGo-search using langchaing_community.
Since updating to the latest pypi versions (langchain==0.3.2 and langchain_community==0.3.1), this error is returned.

System Info

System Information

OS: Linux
OS Version: #16~22.04.1-Ubuntu SMP Mon Aug 19 19:38:17 UTC 2024
Python Version: 3.11.10 | packaged by conda-forge | (main, Sep 22 2024, 14:10:38) [GCC 13.3.0]

Package Information

langchain_core: Installed. No version info available.
langchain: 0.3.2
langchain_community: 0.3.1
langsmith: 0.1.131
langchain_huggingface: 0.1.0
langchain_openai: 0.1.25
langchain_text_splitters: 0.3.0
langgraph: 0.2.34

Optional packages not installed

langserve

Other Dependencies

aiohttp: 3.10.9
async-timeout: Installed. No version info available.
dataclasses-json: 0.6.7
httpx: 0.27.2
huggingface-hub: 0.25.1
langgraph-checkpoint: 2.0.1
numpy: 1.26.4
openai: 1.51.0
orjson: 3.10.7
pydantic: 2.9.2
pydantic-settings: 2.5.2
PyYAML: 6.0.2
requests: 2.32.3
requests-toolbelt: 1.0.0
sentence-transformers: 3.1.1
SQLAlchemy: 2.0.35
tenacity: 8.5.0
tiktoken: 0.8.0
tokenizers: 0.20.0
transformers: 4.45.1

@dosubot dosubot bot added the 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature label Oct 8, 2024
@JamieHvizdos
Copy link

Hi! I represent a team of Computer Science students who are looking to gain experience working with large software systems. We would like to claim this issue to work on.

@JamieHvizdos
Copy link

Hi @m-henneke, we have started looking into the issue and we are unable to replicate this issue on the latest version.

We are on langchain version 0.3.3, langchain-community version 0.3.2 and duckduckgo-search version 6.3.0. Could you try updating to these versions and see if you are still getting the same error?

@m-henneke
Copy link
Author

Hi @JamieHvizdos, thanks for your suggestion. DDG-search works again with langchain 0.3.3 and langchain-community 0.3.2!

As a side note for others, there may have been a problem with my langchain-core installation (possibly 0.3.9) as shown above in the package info. Not sure if this caused the problem, but I had to create a new env to upgrade the packages.

langchain_core: Installed. No version info available.

@pradeepdev-1995
Copy link

any update on this?

@AmrinKareem
Copy link

I have the same issue as well.

@AmrinKareem
Copy link

Also, I was receiving this warning: LangChainDeprecationWarning: As of langchain-core 0.3.0, LangChain uses pydantic v2 internally. The langchain.pydantic_v1 module was a compatibility shim for pydantic v1, and should no longer be used. Please update the code to import from Pydantic directly.

For example, replace imports like: from langchain.pydantic_v1 import BaseModel
with: from pydantic import BaseModel

So I did this in the tool.py inside langchain_experimental-> tools -> python and it worked fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature
Projects
None yet
Development

No branches or pull requests

4 participants