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

DuckDuckGo tool max_results not working as described in docs #25629

Open
5 tasks done
vinicvaz opened this issue Aug 21, 2024 · 0 comments
Open
5 tasks done

DuckDuckGo tool max_results not working as described in docs #25629

vinicvaz opened this issue Aug 21, 2024 · 0 comments
Labels
🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder

Comments

@vinicvaz
Copy link

vinicvaz commented Aug 21, 2024

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

Non-functional Code Examples:

search = DuckDuckGoSearchResults(backend="news", max_results=2)
search.invoke("Obama")  # Returns the default 4 results

wrapper = DuckDuckGoSearchAPIWrapper(region="de-de", time="d", max_results=2)
search = DuckDuckGoSearchResults(api_wrapper=wrapper, source="news", max_results=2)
search.invoke("Obama")  # Also returns the default 4 results

Error Message and Stack Trace (if applicable)

No response

Description

Hi everyone.

I've been using the DuckDuckGoSearchResults tool to perform internet searches, and I noticed that the max_results argument is not limiting the number of results as expected when used as shown in this part of the documentation: DuckDuckGoSearchResults Documentation.

However, after checking the API reference for the DuckDuckGoSearchResults class, I found that max_results is the field name and there is an alias for this field called num_results which makes it work.

This isn't a critical bug, but I think it is a mismatch between the documentation and the actual code. I'm happy to update it if necessary, but I would like to confirm if I'm correct and what exactly should be updated—whether the documentation to reflect the use of num_results or the tool's data model to accept input via the field name.

Thanks

System Info

OS: Ubuntu 24.04 LTS
Python 3.11.9

langchain==0.2.14
langchain-cohere==0.1.9
langchain-community==0.2.12
langchain-core==0.2.32
langchain-experimental==0.0.64
langchain-openai==0.1.21
langchain-text-splitters==0.2.2
@dosubot dosubot bot added the 🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder
Projects
None yet
Development

No branches or pull requests

1 participant