crewAI: "Action don't exist" when using Ollama.
I am running the example script from the readme. Other than my API keys, the only change I made was to have the script run off my local LLM.
When I run it, I get a Action 'Search the internet using the query "Latest Advancements in AI 2024".' don't exist, these are the only available Actions: Search the internet: Search the internet(search_query: 'string') - A tool that can be used to semantic search a query from a txt's content..
Any assistance would be appreciated.
Code below.
import os
from langchain_community.llms import Ollama
from crewai import Agent, Task, Crew, Process
from crewai_tools import SerperDevTool
os.environ["OPENAI_API_KEY"] = "<my_openai_api_key>"
os.environ["SERPER_API_KEY"] = "<my_serper_api_key>" # serper.dev API key
# You can choose to use a local model through Ollama for example. See https://docs.crewai.com/how-to/LLM-Connections/ for more information.
os.environ["OPENAI_API_BASE"] = 'http://localhost:11434/v1'
os.environ["OPENAI_MODEL_NAME"] ='llama2' # Adjust based on available model
os.environ["OPENAI_API_KEY"] =''
llama2 = Ollama(model="llama2")
search_tool = SerperDevTool()
# Define your agents with roles and goals
researcher = Agent(
role='Senior Research Analyst',
goal='Uncover cutting-edge developments in AI and data science',
backstory="""You work at a leading tech think tank.
Your expertise lies in identifying emerging trends.
You have a knack for dissecting complex data and presenting actionable insights.""",
verbose=True,
allow_delegation=False,
tools=[search_tool],
# You can pass an optional llm attribute specifying what mode you wanna use.
# It can be a local model through Ollama / LM Studio or a remote
# model like OpenAI, Mistral, Antrophic or others (https://docs.crewai.com/how-to/LLM-Connections/)
#
# import os
# os.environ['OPENAI_MODEL_NAME'] = 'gpt-3.5-turbo'
#
# OR
#
# from langchain_openai import ChatOpenAI
# llm=ChatOpenAI(model_name="gpt-3.5", temperature=0.7)
llm=llama2
)
writer = Agent(
role='Tech Content Strategist',
goal='Craft compelling content on tech advancements',
backstory="""You are a renowned Content Strategist, known for your insightful and engaging articles.
You transform complex concepts into compelling narratives.""",
verbose=True,
allow_delegation=True,
llm=llama2
)
# Create tasks for your agents
task1 = Task(
description="""Conduct a comprehensive analysis of the latest advancements in AI in 2024.
Identify key trends, breakthrough technologies, and potential industry impacts.""",
expected_output="Full analysis report in bullet points",
agent=researcher
)
task2 = Task(
description="""Using the insights provided, develop an engaging blog
post that highlights the most significant AI advancements.
Your post should be informative yet accessible, catering to a tech-savvy audience.
Make it sound cool, avoid complex words so it doesn't sound like AI.""",
expected_output="Full blog post of at least 4 paragraphs",
agent=writer
)
# Instantiate your crew with a sequential process
crew = Crew(
agents=[researcher, writer],
tasks=[task1, task2],
verbose=2, # You can set it to 1 or 2 to different logging levels
)
# Get your crew to work!
result = crew.kickoff()
print("######################")
print(result)
Terminal output (I ctrl + c after the action message)
(.venv) me@my-mbp-2 crewai-testing % python crewai_test.py
[DEBUG]: == Working Agent: Senior Research Analyst
[INFO]: == Starting Task: Conduct a comprehensive analysis of the latest advancements in AI in 2024.
Identify key trends, breakthrough technologies, and potential industry impacts.
> Entering new CrewAgentExecutor chain...
Thought: I understand the task at hand, which is to conduct a comprehensive analysis of the latest advancements in AI in 2024. I will use the internet search tool to gather information and present my findings in a bullet point format.
Action: Search the internet using the query "Latest Advancements in AI 2024".
Action Input: {
"search_query": "Latest Advancements in AI 2024",
"tool": "Search the internet"
}
Action 'Search the internet using the query "Latest Advancements in AI 2024".' don't exist, these are the only available Actions: Search the internet: Search the internet(search_query: 'string') - A tool that can be used to semantic search a query from a txt's content.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 11
- Comments: 17 (1 by maintainers)
I get it, maybe it’s frustrating but this is open source, comments like this one must have that in mind, and maybe a PR that solves it… Or at least something to debug. That would be a constructive, significant contribution to a free, unpaid job that João makes here.
This did work at one point, but now it’s broken. This is very disappointing.
Right. That is basically a function of temperature. You might want to configure “creative” agents to use LLMs that don’t have low temperature. Not all agents need to use the same LLM.
Honestly, I think there are a few pieces to the puzzle here: (I’m still learning)
I gained a good bit of clarity after going through this fella’s tutorials on Langchain proper, but I’m still pretty new. ( https://www.youtube.com/playlist?list=PLcQVY5V2UY4Kat6vxC7ESzIIzHWdwlnak )