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

The DuckDuckGo Search Tool is not functional #5786

Open
poonacha-2 opened this issue Jan 18, 2025 · 2 comments
Open

The DuckDuckGo Search Tool is not functional #5786

poonacha-2 opened this issue Jan 18, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@poonacha-2
Copy link

Bug Description

The error complains that there is a local variable "results" that is accessed before being assigned.

In the Langflow installation, the DuckDuckGoSearch component relies on the duckduckgo_search package, version 6.4.2, which was installed by Langflow.

We identified that the issue lies in the DuckDuckGoSearch component's code at line 43, which is causing the Exception displayed in the Notifications tab when the component is executed.

We suspect that the DuckDuckGoSearch installation may be out of date and the code may need to be updated to use https://pypi.org/project/duckduckgo-search/ version 7.2.1

def build_tool(self) -> Tool:
        wrapper = self._build_wrapper()

        def search_func(query: str, max_results: int = 5, max_snippet_length: int = 100) -> list[dict[str, Any]]:
            try:
                full_results = wrapper.invoke(f"{query} (site:*)")

Reproduction

Steps to Reproduce Bug:

  1. just play/run the DuckDuckGoSearch Component
  2. View the Notifications and see the results Exception

Expected behavior

When we run the DuckDuckGo tool component, it should build successfully regardless of whether the tool is connected to an agent or is alone.

Who can help?

Backend:

Full Stack:

Operating System

Debian GNU/Linux 12 (bookworm)

Langflow Version

1.1.1

Python Version

3.11

Screenshot

Image

Flow File

No response

@poonacha-2 poonacha-2 added the bug Something isn't working label Jan 18, 2025
Copy link

dosubot bot commented Jan 18, 2025

The error you're encountering with the DuckDuckGoSearch component, where the "results" variable is accessed before being assigned, seems to be related to the version of the duckduckgo_search package being used. The component is currently using version 6.4.2, which might be causing compatibility issues.

To resolve this, you can try updating the duckduckgo_search package to version 7.2.1. This newer version might have changes that address the issue with the "results" variable. You can update the package using pip:

pip install duckduckgo-search==7.2.1

After updating, ensure that the code in the DuckDuckGoSearch component is compatible with the new version of the package. You might need to adjust the method calls or parameters if there were any changes in the package's API between versions 6.4.2 and 7.2.1.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@Cristhianzl
Copy link
Member

hi!

please follow up on this PR updating the version of duckduckgo component.

#5818

It was tested as tool mode and component and both scenarios are ok.

Image

Image

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants