crewAI
crewAI copied to clipboard
Crew.kickoff() got an unexpected keyword argument 'inputs'
Got this error while running the script:
Traceback (most recent call last):
File "/home/lijin/crew.py", line 75, in
This is the full code:
Traceback (most recent call last): import os from crewai import Task from crewai import Crew, Process from crewai import Agent from crewai_tools import SerperDevTool
os.environ["SERPER_API_KEY"] = "xxxxx" # serper.dev API key os.environ["OPENAI_API_KEY"] = "xxxxxxx"
search_tool = SerperDevTool()
Creating a senior researcher agent with memory and verbose mode
researcher = Agent( role='Senior Researcher', goal='Uncover groundbreaking technologies in {topic}', verbose=True, memory=True, backstory=( "Driven by curiosity, you're at the forefront of" "innovation, eager to explore and share knowledge that could change" "the world." ), tools=[search_tool], allow_delegation=True )
Creating a writer agent with custom tools and delegation capability
writer = Agent( role='Writer', goal='Narrate compelling tech stories about {topic}', verbose=True, memory=True, backstory=( "With a flair for simplifying complex topics, you craft" "engaging narratives that captivate and educate, bringing new" "discoveries to light in an accessible manner." ), tools=[search_tool], allow_delegation=False )
Research task
research_task = Task( description=( "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 innovations.', tools=[search_tool], agent=researcher, )
Writing task with language model configuration
write_task = Task( description=( "Compose an insightful article on {topic}." "Focus on the latest trends and how it's impacting the industry." "This article should be easy to understand, engaging, and positive." ), expected_output='A 4 paragraph article on {topic} advancements formatted as markdown.', tools=[search_tool], agent=writer, async_execution=False, output_file='new-blog-post.md' # Example of output customization )
Forming the tech-focused crew with enhanced configurations
crew = Crew( agents=[researcher, writer], tasks=[research_task, write_task], process=Process.sequential # Optional: Sequential task execution is default )
Starting the task execution process with enhanced feedback
result = crew.kickoff(inputs={'topic': 'AMD Ryzen 7 Mini PCs'}) print(result)
Had the exact same issue. Upgraded pip to latest (0.28.8 as of right this second) Cured issue.
Got same issue!
Try upgrading crewai - pip install crewai --upgrade
Hey thanks for the quick reply.
I am already in the latest version
crewai==0.28.8
crewai-tools==0.1.7
from the docs I am testing this main.py
from crewai import Crew, Process, Task
from tasks import Tasks
from agents import Agents
from dotenv import load_dotenv
load_dotenv()
from crewai import Agent
from crewai_tools import SerperDevTool
search_tool = SerperDevTool()
# Creating a senior researcher agent with memory and verbose mode
researcher = Agent(
role='Senior Researcher',
goal='Uncover groundbreaking technologies in {topic}',
verbose=True,
memory=True,
backstory=(
"Driven by curiosity, you're at the forefront of"
"innovation, eager to explore and share knowledge that could change"
"the world."
),
tools=[search_tool],
allow_delegation=True
)
# Creating a writer agent with custom tools and delegation capability
writer = Agent(
role='Writer',
goal='Narrate compelling tech stories about {topic}',
verbose=True,
memory=True,
backstory=(
"With a flair for simplifying complex topics, you craft"
"engaging narratives that captivate and educate, bringing new"
"discoveries to light in an accessible manner."
),
tools=[search_tool],
allow_delegation=False
)
research_task = Task(
description=(
"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.',
tools=[search_tool],
agent=researcher,
)
# Writing task with language model configuration
write_task = Task(
description=(
"Compose an insightful article on {topic}."
"Focus on the latest trends and how it's impacting the industry."
"This article should be easy to understand, engaging, and positive."
),
expected_output='A 4 paragraph article on {topic} advancements formatted as markdown.',
tools=[search_tool],
agent=writer,
async_execution=False,
output_file='new-blog-post.md' # Example of output customization
)
crew = Crew(
agents=[researcher, writer],
tasks=[research_task, write_task],
process=Process.sequential, # Optional: Sequential task execution is default
memory=True,
cache=True,
max_rpm=100,
share_crew=True
)
result = crew.kickoff(inputs={'topic': 'AI in healthcare'})
print(result)
and I am trying to use lama3 in local here is the env for that
OPENAI_API_BASE=http://localhost:11434/v1
OPENAI_MODEL_NAME=crewai-llama3
OPENAI_API_KEY=NA
I have build the crewai-llama3 locally
and when I try to run I am getting following error
Traceback (most recent call last):
File "/Users/kartik/Code/experiments/ai/learning_pyenv/main.py", line 79, in <module>
result = crew.kickoff(inputs={'topic': 'AI in healthcare'})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/crewai/crew.py", line 252, in kickoff
result = self._run_sequential_process()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/crewai/crew.py", line 293, in _run_sequential_process
output = task.execute(context=task_output)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/crewai/task.py", line 173, in execute
result = self._execute(
^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/crewai/task.py", line 182, in _execute
result = agent.execute_task(
^^^^^^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/crewai/agent.py", line 207, in execute_task
memory = contextual_memory.build_context_for_task(task, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/crewai/memory/contextual/contextual_memory.py", line 22, in build_context_for_task
context.append(self._fetch_stm_context(query))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/crewai/memory/contextual/contextual_memory.py", line 31, in _fetch_stm_context
stm_results = self.stm.search(query)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/crewai/memory/short_term/short_term_memory.py", line 23, in search
return self.storage.search(query=query, score_threshold=score_threshold)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/crewai/memory/storage/rag_storage.py", line 90, in search
else self.app.search(query, limit)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/embedchain/embedchain.py", line 635, in search
return [{"context": c[0], "metadata": c[1]} for c in self.db.query(**params)]
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/embedchain/vectordb/chroma.py", line 220, in query
result = self.collection.query(
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/chromadb/api/models/Collection.py", line 327, in query
valid_query_embeddings = self._embed(input=valid_query_texts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/chromadb/api/models/Collection.py", line 633, in _embed
return self._embedding_function(input=input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/chromadb/api/types.py", line 193, in __call__
result = call(self, input)
^^^^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/chromadb/utils/embedding_functions.py", line 188, in __call__
embeddings = self._client.create(
^^^^^^^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/openai/resources/embeddings.py", line 114, in create
return self._post(
^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/openai/_base_client.py", line 1232, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/openai/_base_client.py", line 921, in request
return self._request(
^^^^^^^^^^^^^^
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/openai/_base_client.py", line 1012, in _request
raise self._make_status_error_from_response(err.response) from None
openai.NotFoundError: 404 page not found
Exception in thread Thread-1:
Traceback (most recent call last):
File "/opt/homebrew/opt/[email protected]/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
self.run()
File "/opt/homebrew/opt/[email protected]/lib/python3.12/threading.py", line 1431, in run
self.function(*self.args, **self.kwargs)
File "/Users/kartik/.local/share/virtualenvs/learning_pyenv-snJKqLZa/lib/python3.12/site-packages/crewai/utilities/rpm_controller.py", line 59, in _reset_request_count
self._timer.start()
File "/opt/homebrew/opt/[email protected]/lib/python3.12/threading.py", line 992, in start
_start_new_thread(self._bootstrap, ())
RuntimeError: can't create new thread at interpreter shutdown
My project use pip env I can share my project for testing if required let me know.
Thanks @theCyberTech
Any update on this?
hey @kartik1225 I think i hit the same issue and removed the "imputs=" so that my kickoff works like this:
crew.kickoff({"topic": topic})
same issue i also get.even after changing to crew.kickoff({"topic": topic}) it gives same error
Same issue, checked input to be of type Dict[Str : Any] and it still gave the error.
Same problem. No answer yet.
It seems some people got it fixed by using a more up to date version, for the folks that are still experiencing this could you share what version you are using?
I've tried like this: crew.kickoff(inputs={"topic": topic}) and works for me.
Or you can try also: crew.kickoff({"topic": topic}), without inputs parameter. Also works!
I uninstalled Crew, updated to the latest version and applied this suggestion by thallys and it worked:
crew.kickoff(inputs={"topic": topic}) .
It was driving me crazy :D
i am on crewai==-0.1.7. tried a bunch of things. still complains about unexpected keyword argument 'inputs'. this is very frustrating.
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Consegui resolver o problema da seguinte maneira:
from crewai import Crew, Process, Task
from tasks import Tasks
from agents import Agents
from dotenv import load_dotenv
load_dotenv()
from crewai import Agent
from crewai_tools import SerperDevTool
search_tool = SerperDevTool()
# Creating a senior researcher agent with memory and verbose mode
researcher = Agent(
role='Senior Researcher',
goal='Uncover groundbreaking technologies in {topic}',
verbose=True,
memory=True,
backstory=(
"Driven by curiosity, you're at the forefront of"
"innovation, eager to explore and share knowledge that could change"
"the world."
),
tools=[search_tool],
allow_delegation=True
)
# Input
topics = "AI in healthcare"
# Creating a writer agent with custom tools and delegation capability
writer = Agent(
role='Writer',
goal='Narrate compelling tech stories about {topic}',
verbose=True,
memory=True,
backstory=(
"With a flair for simplifying complex topics, you craft"
"engaging narratives that captivate and educate, bringing new"
"discoveries to light in an accessible manner."
),
tools=[search_tool],
allow_delegation=False
)
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.',
tools=[search_tool],
agent=researcher,
)
# Writing task with language model configuration
write_task = Task(
description=(
f """ Compose an insightful article on {topic}.
Focus on the latest trends and how it's impacting the industry.
This article should be easy to understand, engaging, and positive.
"""),
expected_output=f'A 4 paragraph article on {topic} advancements formatted as markdown.',
tools=[search_tool],
agent=writer,
async_execution=False,
output_file='new-blog-post.md' # Example of output customization
)
crew = Crew(
agents=[researcher, writer],
tasks=[research_task, write_task],
process=Process.sequential, # Optional: Sequential task execution is default
memory=True,
cache=True,
max_rpm=100,
share_crew=True
)
result = crew.kickoff()
print(result)
Any update?
I don't know if this helps @Shreyasjain2 but I think when I hit this I just needed to update my crewai version. Hard to remember