Ollama-and-Agents icon indicating copy to clipboard operation
Ollama-and-Agents copied to clipboard

Error from agent:"...got an unexpected keyword argument 'q'."

Open TomWest61 opened this issue 1 month ago • 0 comments

I get an error from an agent:

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.

Is there somebody how has fixed it? Thank you.

Full code:

from crewai import Agent, Task, Crew, Process from langchain_community.tools import DuckDuckGoSearchRun from langchain_community.llms import Ollama

Define your tools and models

ollama_llm = Ollama(model="llama3") search_tool = DuckDuckGoSearchRun()

Define your agents with their specific roles, goals, and tools

researcher = Agent( role='Researcher', goal='Search the internet for the information requested', backstory="As an experienced researcher, I use my skills and tools to search the internet for the requested information. I strive to find the most relevant and accurate information to make informed decisions.", verbose=True, allow_delegation=False, tools=[search_tool], llm=ollama_llm, max_search_results=10, # Maximum number of search results to consider search_depth=3, # Depth of search in terms of linked pages )

writer = Agent( role='Tech Content Strategist', goal='Craft compelling content on a set of information provided by the researcher.', backstory="As a technical content strategist, I specialize in transforming complex concepts into captivating and easily understandable content. With an eye for detail and a feel for the audience, I create content that is both informative and engaging.", verbose=True, allow_delegation=True, llm=ollama_llm, max_paragraphs=5, # Maximum number of paragraphs in the blog post min_words_per_paragraph=100, # Minimum number of words per paragraph )

Define your tasks with their specific descriptions and expected outputs

task1 = Task( description="Research about open source LLMs vs closed source LLMs. Your final answer MUST be a full analysis report.", expected_output="A detailed report on open source LLMs vs closed source LLMs.", agent=researcher )

task2 = Task( description="Using the insights provided, develop an engaging blog post that highlights the most significant facts and differences between open-source LLMs and closed-source LLMs. Your post should be informative yet accessible, catering to a tech-savvy audience. Make it sound cool, and avoid complex words so it doesn't sound like AI. Your final answer MUST be the full blog post of at least 4 paragraphs. The target word count for the blog post should be between 1,500 and 2,500 words, with a sweet spot at around 2,450 words.", expected_output="A blog post of at least 4 paragraphs highlighting the most significant facts and differences between open-source LLMs and closed-source LLMs.", agent=writer )

Create your crew with a sequential process and define the logging level

crew = Crew( agents=[researcher, writer], tasks=[task1, task2], verbose=2 )

Kick off your crew!

result = crew.kickoff()

TomWest61 avatar May 26 '24 07:05 TomWest61