Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mystery coworker call crashes workflow #184

Open
tholonia opened this issue May 9, 2024 · 2 comments
Open

Mystery coworker call crashes workflow #184

tholonia opened this issue May 9, 2024 · 2 comments

Comments

@tholonia
Copy link

tholonia commented May 9, 2024

I would love to get this working... LanceDB sounds like exactly what I need. However, when I run this, the search function calls a coworker "Database Manager", which does not exist. Where is the agent getting that coworker from? Is this something I need to define, or is it LanceDB somewhere?

(p.s. also, your blog post at https://blog.lancedb.com/track-ai-trends-crewai-agents-rag/ is missing the Tasks declaration code)

5, -3.4255998134613037, -4.876443386077881, 1.111032247543335, 1.3212069272994995, -0.4721265733242035, -1.0972766876220703, -1.4117374420166016, -0.3189839720726013, -0.26777249574661255, 0.044715918600559235, 0.47417911887168884, -1.2439095973968506, -0.051855288445949554, 1.9904354810714722, 1.192123293876648, -0.45629948377609253, -2.320878267288208, -0.9717252850532532, 0.4254404902458191, -0.5110087394714355, -0.3441590368747711], '_distance': 26038.275390625})]

  Thought: I now can give a great answer

Final Answer: This is an incorrect response from the agent as it should not be providing this message before giving a proper solution or using any tools that have been used already.

> Finished chain.
 

This is an incorrect response from the agent as it should not be providing this message before giving a proper solution or using any tools that have been used already.

 Thought: In order to gather a list of news articles about a specific topic, I need to use a tool that can retrieve relevant articles from a database. However, it seems there is no such direct tool available, so I will delegate this task to a coworker who can perform this job.

Action: Delegate work to co-worker

Action Input: {"coworker": "Writer", "task": "Gather news articles about AI and emerging trends", "context": {"database": "A database that contains news articles"}} 

I tried reusing the same input, I must stop using this action input. I'll try something else instead.



 Action: Ask question to co-worker

Action Input: 
{
    "coworker": "Database Manager",
    "question": "Can you please get all the news articles related to AI and emerging trends? The database has this information, I have seen it before but I need it in a list now.",
    "context": {
        "database": "A database that contains news articles"
    }
} 


Error executing tool. Co-worker mentioned not found, it must to be one of the following options:
- Writer


 Thought: To gather a list of news articles about a specific topic, I need to delegate this task to a coworker who can perform this job.

Action: Delegate work to co-worker

Action Input: {"coworker": "Writer", "task": "Gather news articles about AI and emerging trends", "context": {"database": "A database that contains news articles"}} 

This is an incorrect response from the agent as it should not be providing this message before giving a proper solution or using any tools that have been used already.

^CTraceback (most recent call last):
  File "/home/jw/store/src/crewai/dataCrew/data_analyst_crew/./xmain3.py", line 204, in <module>
    result = news_crew.kickoff()
             ^^^^^^^^^^^^^^^^^^^
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/crewai/crew.py", line 204, in kickoff
    result = self._run_sequential_process()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/crewai/crew.py", line 240, in _run_sequential_process
    output = task.execute(context=task_output)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/crewai/task.py", line 148, in execute
    result = self._execute(
             ^^^^^^^^^^^^^^
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/crewai/task.py", line 157, in _execute
    result = agent.execute_task(
             ^^^^^^^^^^^^^^^^^^^
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/crewai/agent.py", line 193, in execute_task
    result = self.agent_executor.invoke(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/langchain/chains/base.py", line 163, in invoke
    raise e
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/langchain/chains/base.py", line 153, in invoke
    self._call(inputs, run_manager=run_manager)
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/crewai/agents/executor.py", line 64, in _call
    next_step_output = self._take_next_step(
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/langchain/agents/agent.py", line 1138, in _take_next_step
    [
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/langchain/agents/agent.py", line 1138, in <listcomp>
    [
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/crewai/agents/executor.py", line 118, in _iter_next_step
    output = self.agent.plan(
             ^^^^^^^^^^^^^^^^
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/langchain/agents/agent.py", line 397, in plan
    for chunk in self.runnable.stream(inputs, config={"callbacks": callbacks}):
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 2685, in stream
    yield from self.transform(iter([input]), config, **kwargs)
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 2672, in transform
    yield from self._transform_stream_with_config(
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 1743, in _transform_stream_with_config
    chunk: Output = context.run(next, iterator)  # type: ignore
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 2636, in _transform
    for output in final_pipeline:
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 1209, in transform
    for chunk in input:
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 4532, in transform
    yield from self.bound.transform(
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 1226, in transform
    yield from self.stream(final, config, **kwargs)
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 239, in stream
    raise e
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 222, in stream
    for chunk in self._stream(
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/langchain_openai/chat_models/base.py", line 408, in _stream
    for chunk in self.client.create(messages=message_dicts, **params):
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/openai/_streaming.py", line 46, in __iter__
    for item in self._iterator:
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/openai/_streaming.py", line 61, in __stream__
    for sse in iterator:
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/openai/_streaming.py", line 53, in _iter_events
    yield from self._decoder.iter(self.response.iter_lines())
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/openai/_streaming.py", line 287, in iter
    for line in iterator:
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/httpx/_models.py", line 863, in iter_lines
    for text in self.iter_text():
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/httpx/_models.py", line 850, in iter_text
    for byte_content in self.iter_bytes():
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/httpx/_models.py", line 829, in iter_bytes
    for raw_bytes in self.iter_raw():
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/httpx/_models.py", line 887, in iter_raw
    for raw_stream_bytes in self.stream:
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/httpx/_client.py", line 124, in __iter__
    for chunk in self._stream:
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/httpx/_transports/default.py", line 111, in __iter__
    for part in self._httpcore_stream:
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 367, in __iter__
    raise exc from None
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 363, in __iter__
    for part in self._stream:
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 336, in __iter__
    raise exc
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 328, in __iter__
    for chunk in self._connection._receive_response_body(**kwargs):
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 197, in _receive_response_body
    event = self._receive_event(timeout=timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/httpcore/_sync/http11.py", line 211, in _receive_event
    data = self._network_stream.read(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jw/miniforge3/envs/crewai2/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 126, in read
    return self._sock.recv(max_bytes)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^


@tholonia
Copy link
Author

tholonia commented May 9, 2024

Update. I do not get this error when I run the DDGS, but because I get a ton of rate limiis failures from DDGS I was running SerperSearch, which returns structured data/JSON. Does LanceDB see the JSON and assume its some sort of DB update or something?

However, I get other errors when I run DDGS.

Action Input: {"coworker": "Writer", "task": "Use SearchNewsDB to gather news articles about recent advancements in AI and process them in a way that includes key trends, breakthrough technologies, and potential industry impacts."} 

I encountered an error while trying to use the tool. This was the error: AgentTools.delegate_work() missing 1 required positional argument: 'context'.
 Tool Delegate work to co-worker accepts these inputs: Delegate work to co-worker(coworker: str, task: str, context: str) - Delegate a specific task to one of the following co-workers: ['Writer']
The input to this tool should be the coworker, the task you want them to do, and ALL necessary context to exectue the task, they know nothing about the task, so share absolute everything you know, don't reference things but instead explain them.
Action Input: {"coworker": "AI Research Assistant", "question": "Can you please gather some relevant news articles about recent advancements in AI and process them using SearchNewsDB? This would help us understand the latest trends and technologies in this field.", "context": "None"} 


Error executing tool. Co-worker mentioned not found, it must to be one of the following options:
- Writer
Action Input: {"coworker": "Writer", "task": "Use SearchNewsDB to gather news articles about recent advancements in AI and process them in a way that includes key trends, breakthrough technologies, and potential industry impacts."} 

I encountered an error while trying to use the tool. This was the error: AgentTools.delegate_work() missing 1 required positional argument: 'context'.
 Tool Delegate work to co-worker accepts these inputs: Delegate work to co-worker(coworker: str, task: str, context: str) - Delegate a specific task to one of the following co-workers: ['Writer']
The input to this tool should be the coworker, the task you want them to do, and ALL necessary context to exectue the task, they know nothing about the task, so share absolute everything you know, don't reference things but instead explain them.

@PrashantDixit0
Copy link
Collaborator

PrashantDixit0 commented May 12, 2024

Hi @tholonia, Thank you for highlighting I have updated the blog https://blog.lancedb.com/track-ai-trends-crewai-agents-rag/ with tasks for agents.

Referring to the Issue you encountered, Can you Please try out Colab Notebook https://colab.research.google.com/github/lancedb/vectordb-recipes/blob/main/examples/AI-Trends-with-CrewAI/CrewAI_AI_Trends.ipynb
For me It is running without any error using this Notebook.

Please highlight which cell throws an error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants