"duckduckgo\_search is not a valid tool" #1131
Replies: 8 comments
-
The issue is that the tool in your code is called search_tool not duckduckgo_search so maybe the llm hallucinate and messed up the name of the tool so CrewAI didn't recognize it as a valid tool , one fix that may work is to do some prompt engineering in your prompts to lead the llm to use the tool with the correct name when needed |
Beta Was this translation helpful? Give feedback.
-
As a work around for this issue that worked for me, you can instantiate the tool as a new Langchain Tool and specifically give it the name of "search_tool". It's a little hackish, but works. I'm guessing CrewAI is confusing the langchain tool names with the object instance name of the tool. search = DuckDuckGoSearchRun()
search_tool = Tool(
name="search\_tool",
description="A search tool used to query DuckDuckGo for search results when trying to find information from the internet.",
func=search.run
) Then call the name of the tool you created (in this case search_tool in the task: research_task = Task(
description=f"""Identify the next big trend in {topic}.
Focus on identifying pros and cons and the overall narrative.
Your final report should clearly articulate the key points,
its market opportunities, and potential risks.
""",
expected_output='A comprehensive 3 paragraphs long report on the latest AI trends.',
max_inter=3,
tools=[search_tool],
agent=researcher
) |
Beta Was this translation helpful? Give feedback.
-
same issue here, especially when I use smaller local model, that is not that flexible. It was never a problem with gpt-4. Thanks for the work around, it works. |
Beta Was this translation helpful? Give feedback.
-
Hello guys, I have tried all the options above but it is still not working! There are other alternatives I could try to make it work? As one of the guys above said, it only happens when using local models (in my case llama2) Libraries version: |
Beta Was this translation helpful? Give feedback.
-
try use other models than llama 2 , like openhermes is good for this stuff |
Beta Was this translation helpful? Give feedback.
-
Hello mate... I downloaded and ran the openhermes and tried again but without success. After doing the changes suggested on this topic it finally worked |
Beta Was this translation helpful? Give feedback.
-
To add to this, I only run into this problem when using text-generation-webui and emulating the OpenAI API. I was running some tests with LocalAI and found that this change was not necessary at all and it worked out of the box. Therefore, it's very possible the problem is specifically with the TextGen-Webui implementation of the OpenAI API spec.
|
Beta Was this translation helpful? Give feedback.
-
Solution by @edsealing worked for me. Thanks Libraries version: |
Beta Was this translation helpful? Give feedback.
-
Often (not always !) when I use duckduckgo as a search tool in a CrewAI setup, I get this message:
"duckduckgo_search is not a valid tool"
What can be the cause of this and how can I avoid getting that ?
This is a relevant piece of my code:
import os
from crewai import Agent, Task, Crew, Process
from langchain.tools import DuckDuckGoSearchRun
search_tool = DuckDuckGoSearchRun()
from langchain.llms import Ollama
Define your agents with roles and goals
researcher = Agent(
role='Senior Research Analyst',
goal='Uncover cutting-edge developments in Physics based on Machs principle',
backstory="""You are an absolute expert at a Physics research group, especially on Machs principle and Machs Gravity,
skilled in identifying trends and analyzing complex data.""",
verbose=True,
allow_delegation=False,
tools=[search_tool],
llm=local_openai_client # llm #ollama_llm
)
Etc.
Beta Was this translation helpful? Give feedback.
All reactions