joaomdmoura / crewAI

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
https://crewai.com
MIT License
17k stars 2.3k forks source link

DuckDuckGo: Tool search issue #706

Open Surgical17 opened 1 month ago

Surgical17 commented 1 month ago

Hi All

I am recieving the following two errors when using DuckDuck go yet it seems the tool is working or searching possibly: Error: I encountered an error while trying to use the tool. This was the error: DuckDuckGoSearchRun._run() got an unexpected keyword argument 'q'. Tool duckduckgo_search accepts these inputs: A wrapper around DuckDuckGo Search. Useful for when you need to answer questions about current events. Input should be a search query.

I encountered an error while trying to use the tool. This was the error: DuckDuckGoSearchRun._run() got an unexpected keyword argument 'search_query'. Tool duckduckgo_search accepts these inputs: A wrapper around DuckDuckGo Search. Useful for when you need to answer questions about current events. Input should be a search query.

Code:


from langchain.tools import DuckDuckGoSearchRun

@tool("Search the internet")
def search_tool(question: str) -> str:
    """A search tool used to query DuckDuckGo for search results when trying to find information from the internet."""
    # Tool logic here
    search = DuckDuckGoSearchRun()
    return search.run(question)```
gadgethome commented 1 month ago

Are you on the latest versions ? crewai 0.30.11 crewai-tools 0.2.6

Maybe try exa as I've used it and works well. https://github.com/joaomdmoura/crewAI-tools/tree/main/crewai_tools/tools/exa_tools

nico-checkmk commented 3 weeks ago

I do encounter the same issue. And I am on the latest versions

After changing ~/venv/lib/python3.10/site-packages/langchain_community/tools/ddg_search/tool.py from

    def _run(
        self,
        query: str,
        run_manager: Optional[CallbackManagerForToolRun] = None,
    ) -> str:
        """Use the tool."""
        return self.api_wrapper.run(query)

to

    def _run(
        self,
        q: str,
        run_manager: Optional[CallbackManagerForToolRun] = None,
    ) -> str:
        """Use the tool."""
        return self.api_wrapper.run(q)

it works constantly for me. Maybe the call of the function has a problem with the query instead of q