Git Product home page Git Product logo

crewai-examples's People

Contributors

al1p avatar biancamazzi avatar campeis avatar davirolim avatar enriquesanchezb avatar frostythesouthernsnowman avatar garmeeh avatar itlackey avatar ivanfioravanti avatar joaomdmoura avatar joecryptotoo avatar michaelsynan avatar michaelwdombek avatar olafgeibig avatar prabha-git avatar stoltzmaniac avatar sumitbindra avatar tkunstek avatar toon-noot avatar yamz8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

crewai-examples's Issues

Key error: "description"

On my first run after successfully installing everything i got this, and it kept coming no matter what company i asked for -

Thought: Do I need to use a tool? Yes
Action: yahoo_finance_news
Action Input: TSLATraceback (most recent call last):
File "E:\Project\crewAI-examples\stock_analysis\main.py", line 54, in
result = financial_crew.run()
^^^^^^^^^^^^^^^^^^^^
File "E:\Project\crewAI-examples\stock_analysis\main.py", line 42, in run
result = crew.kickoff()
^^^^^^^^^^^^^^
File "E:\Project\crewAI-examples\stock_analysis\env\Lib\site-packages\crewai\crew.py", line 63, in kickoff
return self.__sequential_loop()
^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Project\crewAI-examples\stock_analysis\env\Lib\site-packages\crewai\crew.py", line 81, in __sequential_loop
task_outcome = task.execute(task_outcome)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Project\crewAI-examples\stock_analysis\env\Lib\site-packages\crewai\task.py", line 36, in execute
return self.agent.execute_task(
^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Project\crewAI-examples\stock_analysis\env\Lib\site-packages\crewai\agent.py", line 102, in execute_task
return self.agent_executor.invoke({
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Project\crewAI-examples\stock_analysis\env\Lib\site-packages\langchain\chains\base.py", line 87, in invoke
return self(
^^^^^
File "E:\Project\crewAI-examples\stock_analysis\env\Lib\site-packages\langchain\chains\base.py", line 310, in call
raise e
File "E:\Project\crewAI-examples\stock_analysis\env\Lib\site-packages\langchain\chains\base.py", line 304, in call
self._call(inputs, run_manager=run_manager)
File "E:\Project\crewAI-examples\stock_analysis\env\Lib\site-packages\langchain\agents\agent.py", line 1167, in _call
next_step_output = self._take_next_step(
^^^^^^^^^^^^^^^^^^^^^
File "E:\Project\crewAI-examples\stock_analysis\env\Lib\site-packages\langchain\agents\agent.py", line 1017, in _take_next_step
observation = tool.run(
^^^^^^^^^
File "E:\Project\crewAI-examples\stock_analysis\env\Lib\site-packages\langchain\tools\base.py", line 365, in run
raise e
File "E:\Project\crewAI-examples\stock_analysis\env\Lib\site-packages\langchain\tools\base.py", line 337, in run
self._run(*tool_args, run_manager=run_manager, **tool_kwargs)
File "E:\Project\crewAI-examples\stock_analysis\env\Lib\site-packages\langchain\tools\yahoo_finance_news.py", line 55, in _run
result = self._format_results(docs, query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Project\crewAI-examples\stock_analysis\env\Lib\site-packages\langchain\tools\yahoo_finance_news.py", line 62, in _format_results
doc_strings = [
^
File "E:\Project\crewAI-examples\stock_analysis\env\Lib\site-packages\langchain\tools\yahoo_finance_news.py", line 65, in
if query in doc.metadata["description"] or query in doc.metadata["title"]
~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'description'

To fix it i changed the yahoo_finance_news.py as follows:

From this :
doc_strings = [
"\n".join([doc.metadata["title"], doc.metadata["description"]])
for doc in docs
if query in doc.metadata["description"] or query in doc.metadata["title"]
]

to this :
def _format_results(docs: Iterable[Document], query: str) -> str:
doc_strings = []
for doc in docs:
title = doc.metadata.get("title", "")
description = doc.metadata.get("description", "")
if query in description or query in title:
doc_strings.append("\n".join([title, description]))

CrewAI-LangGraph - possible to use imap server?

Its possible to create a version of this tool with standard imap protocol? I was starting to work with this on 'nodes.pl' but maybe somebody would help/had already done this.

import imaplib
import email
import time
from datetime import datetime, timedelta

class Nodes():

  def __init__(self):
    self.mail = imaplib.IMAP4_SSL('mail.server.com', 993)
    self.mail.login('[email protected]', 'Password')
    self.mail.select('INBOX')

  def check_email(self, state):
    print("# Checking for new emails")

    # Search for emails in last day
    yesterday = (datetime.now() - timedelta(days=1)).strftime("%d-%b-%Y")
    result, message_ids = self.mail.search(None, '(SINCE {date})'.format(date=yesterday))

    new_emails = []
    new_ids = []

    # Loop through new emails and fetch details
    for msg_id in message_ids[0].split():
      if msg_id not in state['checked_emails_ids']:
        result, data = self.mail.fetch(msg_id, '(RFC822)')
        email_msg = email.message_from_bytes(data[0][1])
        
        new_emails.append({
          'id': msg_id,
          'sender': email_msg['From'],
          'subject': email_msg['Subject']
        })
        new_ids.append(msg_id)

    # Update state
    state['checked_emails_ids'].extend(new_ids)
    state['emails'] = new_emails

    return state

  def wait_next_run(self, state):
    print("## Waiting for 3 minutes")  
    time.sleep(180)
    return state

  def new_emails(self, state):
    if len(state['emails']) == 0:
      print("## No new emails")
      return "end"
    else:
      print("## New emails")
      return "continue"


cannot import name 'TypeAliasType' from 'typing_extensions'

/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_core_utils.py in
14 from pydantic_core import CoreSchema, core_schema
15 from pydantic_core import validate_core_schema as _validate_core_schema
---> 16 from typing_extensions import TypeAliasType, TypeGuard, get_args, get_origin
17
18 from . import _repr

ImportError: cannot import name 'TypeAliasType' from 'typing_extensions' (/usr/local/lib/python3.10/dist-packages/typing_extensions.py)

Tasks need predefiend input: Don't use input() but use human tool

Maybe I'm missing something obvious, but if Agents run Tasks, then inputs to tasks may not be know at run time. Currently it seems Tasks need to be defined with inputs passed in the main.py file. But if I want to pass an intermediate value to a Task that is only know at run time then how to do that?

For all intensive purposes, how do you refactor the job posting example to not use input, but instead have an a agent, like top_dog_manager_agent who discusses what inputs it needs with the human, then passes those to the tasks?

Sorry the is probably obvious to someone out there but I haven't been able to find an example

Cheers

example model file for ollama openhermes2.5-mistral

would this be a correct modelfile to use for ollama openhermes2.5-mistral?

TEMPLATE """<|im_start|>system
{{ .System }}<|im_end|>
<|im_start|>user
{{ .Prompt }}<|im_end|>
<|im_start|>assistant
"""
PARAMETER num_ctx 4096
PARAMETER top_p 0.5
PARAMETER temperature 0
PARAMETER stop "<|im_start|>"
PARAMETER stop "<|im_end|>"
PARAMETER stop "Observation"

I am trying to run the trip_planner example locally using ollama and openhermes2.5-mistral model. In the example readme it says...

Configure Ollama: Set up Ollama to work with your local model. You will probably need to tweak the model using a Modelfile, I'd recommend adding Observation as a stop word and playing with top_p and temperature.

https://github.com/joaomdmoura/crewAI-examples/tree/main/trip_planner

The reason why I am asking is if I use default ollama model file for openhermes2.5-mistral I get these errors...

Retrying langchain.chat_models.openai.ChatOpenAI.completion_with_retry.._completion_with_retry in 4.0 seconds as it raised RateLimitError: Rate limit reached for gpt-4 in organization org-xxxxxxxxxxxxxxxxxx on tokens_usage_based per min: Limit 10000, Used 7356, Requested 2894. Please try again in 1.5s. Visit https://platform.openai.com/account/rate-limits to learn more..

Error with dependencies on Pydantic

After facing no problems running crewai, facing the following error:

ImportError: cannot import name 'InstanceOf' from 'pydantic' (/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pydantic/init.cpython-311-darwin.so)

Tried uninstall-reinstall both crewai and pydantic. Any suggestions?

KeyError: 'description' on stock_analysis

Hi, trying to run the stock_analysis example I'm receiving this error from the yfinance library, did it happend to you?

  File "/lib/python3.11/site-packages/langchain_community/tools/yahoo_finance_news.py", line 55, in _run
    result = self._format_results(docs, query)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/langchain_community/tools/yahoo_finance_news.py", line 62, in _format_results
    doc_strings = [
                  ^
  File "/lib/python3.11/site-packages/langchain_community/tools/yahoo_finance_news.py", line 65, in <listcomp>
    if query in doc.metadata["description"] or query in doc.metadata["title"]
                ~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'description'

Not working: GmailCreateDraft

langchain_community.tools.gmail.create_draft.GmailCreateDraft not working there are no errors nothing the emails just doesn't get drafted i tried with the google python api and it did worked just to check if my auth had some limitations but it doesn't had any and was working fine it's something in that, also not every email is getting read the filter is way too much removes important emails as well

Trying to run Trip planner

Hi all, I am trying to run the trip planner, and i have this error:

Use Tool: Search the internet(query: "best time to visit Japan animes")

Failed to convert text into a pydantic model due to the following error: Unexpected message with type <class 'langchain_core.messages.system.SystemMessage'> at the position 1.

Could you please help with this error or if you could tell me how to debug this?

much appreciate.

cannot run poetry install on Python 3.12

Windows 10
Python 3.12

poetry install --no-root.
The currently activated Python version 3.12.0 is not supported by the project (>=3.10.0,<3.12).
Trying to find and use a compatible version.

  • Tried to mannually update the pyproject.toml line 8 to (no luck)

  • python = ">=3.10.0,<3.13"

How to increase agent max iteration limit

I was running the trip planner with a local LM and got the following output:

> Finished chain.
Task output: Agent stopped due to max iterations.


########################
## Here is you Trip Plan
########################

Agent stopped due to max iterations.

Where can I increase the threshold for the max iterations?

How to increase the reliability of the crewai-langgraph example

Hello

sometimes the example crashes even if we have the same emails to process on the test sets.
The thread_id is not passed correctly to the google api.
For example:

> Entering new CrewAgentExecutor chain...
Thought: Do I need to use a tool? Yes
Action: get_gmail_thread
Action Input: thread_id:18cc96304f1566d0Traceback (most recent call last):
  File "/Users/hleclerc/dev/projects/clients/alterway/alterwai/crewAI-examples/CrewAI-LangGraph/main.py", line 4, in <module>
    app.invoke({})
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langgraph/pregel/__init__.py", line 569, in invoke
    for chunk in self.stream(
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langgraph/pregel/__init__.py", line 605, in transform
    for chunk in self._transform_stream_with_config(
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 1497, in _transform_stream_with_config
    chunk: Output = context.run(next, iterator)  # type: ignore
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langgraph/pregel/__init__.py", line 347, in _transform
    _interrupt_or_proceed(done, inflight, step)
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langgraph/pregel/__init__.py", line 688, in _interrupt_or_proceed
    raise exc
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 4041, in invoke
    return self.bound.invoke(
           ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 2053, in invoke
    input = step.invoke(
            ^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 3507, in invoke
    return self._call_with_config(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 1246, in _call_with_config
    context.run(
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langchain_core/runnables/config.py", line 326, in call_func_with_variable_args
    return func(input, **kwargs)  # type: ignore[call-arg]
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 3383, in _invoke
    output = call_func_with_variable_args(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langchain_core/runnables/config.py", line 326, in call_func_with_variable_args
    return func(input, **kwargs)  # type: ignore[call-arg]
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hleclerc/dev/projects/clients/alterway/alterwai/crewAI-examples/CrewAI-LangGraph/src/crew/crew.py", line 25, in kickoff
    result = crew.kickoff()
             ^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/crewai/crew.py", line 127, in kickoff
    return self._sequential_loop()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/crewai/crew.py", line 134, in _sequential_loop
    task_output = task.execute(task_output)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/crewai/task.py", line 56, in execute
    result = self.agent.execute_task(
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/crewai/agent.py", line 146, in execute_task
    result = self.agent_executor.invoke(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langchain/chains/base.py", line 162, in invoke
    raise e
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langchain/chains/base.py", line 156, in invoke
    self._call(inputs, run_manager=run_manager)
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/crewai/agents/executor.py", line 59, in _call
    next_step_output = self._take_next_step(
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langchain/agents/agent.py", line 1097, in _take_next_step
    [
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langchain/agents/agent.py", line 1097, in <listcomp>
    [
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/crewai/agents/executor.py", line 191, in _iter_next_step
    observation = tool.run(
                  ^^^^^^^^^
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langchain_core/tools.py", line 373, in run
    raise e
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langchain_core/tools.py", line 345, in run
    self._run(*tool_args, run_manager=run_manager, **tool_kwargs)
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/langchain_community/tools/gmail/get_thread.py", line 37, in _run
    thread_data = query.execute()
                  ^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
    return wrapped(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/anaconda3/envs/crewai-example/lib/python3.11/site-packages/googleapiclient/http.py", line 938, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://gmail.googleapis.com/gmail/v1/users/me/threads/thread_id%3A18cc90303f1526d0?alt=json returned "Invalid id value". Details: "[{'message': 'Invalid id value', 'domain': 'global', 'reason': 'invalidArgument'}]">

as you can see the url is not correct

we should have

I 've tried to change the Task prompt with thread_id (ONLY the id of the thread_id)

it's better but not every time

I always get this error

Traceback (most recent call last):
File "/Users/siddartha/Desktop/github/GenAi/Agents/test.py", line 76, in
researcher = Agent(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pydantic/main.py", line 164, in init
pydantic_self.pydantic_validator.validate_python(data, self_instance=pydantic_self)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/crewai/agent.py", line 95, in
default_factory=lambda: ChatOpenAI(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/langchain_core/load/serializable.py", line 107, in init
super().init(**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pydantic/v1/main.py", line 341, in init
raise validation_error
pydantic.v1.error_wrappers.ValidationError: 1 validation error for ChatOpenAI
root
Did not find openai_api_key, please add an environment variable OPENAI_API_KEY which contains it, or pass openai_api_key as a named parameter. (type=value_error)

Here is my .env structure

AZURE_OPENAI_VERSION="2023-07-01-preview"
AZURE_OPENAI_DEPLOYMENT="chat"
AZURE_OPENAI_ENDPOINT="https://gpt-4-trails.openai.azure.com/"
AZURE_OPENAI_KEY = ""

No module named 'crewai_tools'

I already isntalled crewai_tools but i have this error yet:

    from crewai_tools import SerperDevTool
ModuleNotFoundError: No module named 'crewai_tools'

line after installed crewai_tools

Requirement already satisfied: mypy-extensions>=0.3.0 in /home/xoxoxox/.local/lib/python3.8/site-packages (from typing-inspect<1,>=0.4.0->dataclasses-json<0.7,>=0.5.7->langchain<0.0.352,>=0.0.351->crewai[tools]) (1.0.0)

somaone know how can i sove this?

Pydantic error in Instagram Post example

In the Instagram Post example, I get the following error:

Traceback (most recent call last):
  File "/home/gene/Projects/crewai/crewAI-examples/instagram_post/main.py", line 20, in <module>
    product_competitor_agent = agents.product_competitor_agent()
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gene/Projects/crewai/crewAI-examples/instagram_post/agents.py", line 14, in product_competitor_agent
    return Agent(
           ^^^^^^
  File "/home/gene/Projects/crewai/venv/lib/python3.11/site-packages/pydantic/main.py", line 164, in __init__
    __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
pydantic_core._pydantic_core.ValidationError: 1 validation error for Agent
  Value error, 1 validation error for ConversationSummaryMemory
llm
  value is not a valid dict (type=type_error.dict) [type=value_error, input_value={'role': 'Lead Market Ana...es'),), 'verbose': True}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/value_error

Error import SerperDevTool or SeperDevTool

seper_dev_tool = SerperDevTool()

from crewai_tools import WebsiteSearchTool, SeperDevTool, FileReadTool

ImportError: cannot import name 'SeperDevTool' from 'crewai_tools'

Found incorrectness while playing around with this tutorial. Got error importing both the modules: "SerperDevTool" & "SeperDevTool".

Both the names are used in the tutorials/docs on the website of crewai. https://docs.crewai.com/core-concepts/Tools/#available-crewai-tools. Ctrl + F for both names and you will see the typo.

Are there any bugs in this or some gotcha I need to be aware of ?

Please help. TIA.

How to connect the process to streamlit?

I wonder if I can put the process in the streamlit UI chat messages rather than in the terminal..

I think the approach would be tinkering with the logger. Or anyone else have suggestions?

Not blocking, but trip planner says Error executing tool. Missing exact 3 pipe (|) separated values. For example, `coworker|task|information`.

trying trip planner with ollama

from langchain.llms import Ollama
ollama_openhermes = Ollama(model="openhermes")

sends me some non blocking error

> Entering new CrewAgentExecutor chain...
Thought: Do I need to use a tool? Yes
Action: Ask question to co-worker
Action Input: coworker|What are the average flight costs from Lyon to both Toulouse and Bordeaux during late January? And any other information related to the traveler's interests in technology, AI, and Japanese food in each city?
Error executing tool. Missing exact 3 pipe (|) separated values. For example, `coworker|task|information`.

Agent stopped due to iteration limit or time limit

I have tried some examples like instagram post,trip_planner and game-builder-crew. At the end of the output, they all return below result.

########################

Here is the result

########################

Your post copy:
Agent stopped due to iteration limit or time limit.
'

version incompatibility issue between several packages

Do you have any suggestions on how to resolve the error below? I am just using OpenAI instead of Langchain but would love to use Langchain.

Because no versions of langchain-openai match >0.0.7,<0.0.8
and langchain-openai (0.0.7) depends on langchain-core (>=0.1.26,<0.2.0), langchain-openai (>=0.0.7,<0.0.8) requires langchain-core (>=0.1.26,<0.2.0).
And because no versions of langchain-core match >0.1.26,<0.2
and langchain-core (0.1.26) depends on langsmith (>=0.1.0,<0.2.0), langchain-openai (>=0.0.7,<0.0.8) requires langsmith (>=0.1.0,<0.2.0).
Because langchain (0.0.354) depends on langsmith (>=0.0.77,<0.1.0)
and no versions of langchain match >0.0.354,<0.0.355, langchain (>=0.0.354,<0.0.355) requires langsmith (>=0.0.77,<0.1.0).
Thus, langchain-openai (>=0.0.7,<0.0.8) is incompatible with langchain (>=0.0.354,<0.0.355).
And because crewai (0.1.24) depends on langchain (>=0.0.354,<0.0.355), langchain-openai (>=0.0.7,<0.0.8) is incompatible with crewai (0.1.24).
So, because trip-planner-yt depends on both crewai (0.1.24) and langchain-openai (^0.0.7), version solving failed.

No module named 'pymarkdown'

crewAI-examples/markdown_validator/main.py", line 7, in
from pymarkdown.api import PyMarkdownApi, PyMarkdownApiException
ModuleNotFoundError: No module named 'pymarkdown'

Como solicitar escrita de arquivo para o agente

Olรก Joao.
Estou tentando ao final da minha iteraรงรฃo entre agentes que eles escrevam a conclusรฃo num arquivo txt.
No GPT da crewai ele diz que a ferramenta que tambem รฉ usada para escrever arquivos รฉ a FileReadTool, porรฉm ao tentar usar ela para este propรณsito, nรฃo funciona. Poderia me indicar alguma forma de escrever arquivos localmente usando os agentes?
Obrigado

Landing Page Generator - Permission Denied Bug

It seems like the following tool in the template_tools.py file is failing:

  @tool("Copy landing page template to project folder")
  def copy_landing_page_template_to_project_folder(landing_page_template):
    """Copy a landing page template to your project 
    folder so you can start modifying it, it expects 
    a landing page template folder as input"""
    source_path = Path(f"templates/{landing_page_template}")
    destination_path = Path(f"workdir/{landing_page_template}")
    destination_path.parent.mkdir(parents=True, exist_ok=True)
    shutil.copytree(source_path, destination_path)
    return f"Template copied to {landing_page_template} and ready to be modified, main files should be under ./{landing_page_template}/src/components, you should focus on those."

It might have to do with the update_page() function in the tasks.py file as well. I had to update the paths there, otherwise, it wasn't finding them anymore. The default paths to the Tailwind themes have changed to /templates/[chosen_template]/[chosen_template]-js/src/app/page.jsx

Output from the run:

Action: Scrape website content
Action Input: "https://elements.envato.com/web-templates/landing-page-templates/showcase"[nltk_data] Error loading punkt: <urlopen error [SSL:
[nltk_data]     CERTIFICATE_VERIFY_FAILED] certificate verify failed:
[nltk_data]     unable to get local issuer certificate (_ssl.c:1002)>
 
I just used the scrape website content tool with input https://elements.envato.com/web-templates/landing-page-templates/showcase. So I already know that and must stop using it in a row with the same input. 
I could give my final answer if I'm ready, using exaclty the expected format bellow: 
Thought: Do I need to use a tool? No
Final Answer: [your response here]
Do I need to use a tool? Yes
Action: Copy landing page template to project folder
Action Input: {"landing_page_template": "showcase"} 
I just used the Copy landing page template to project folder tool with input showcase. So I already know that and must stop using it in a row with the same input. 
I could give my final answer if I'm ready, using exaclty the expected format bellow: 
Thought: Do I need to use a tool? No
Final Answer: [your response here]
Do I need to use a tool? Yes
Action: list_directory
Action Input: {"folder": "/workdir/template/showcase"} 
Error: Access denied to dir_path: /workdir/template/showcase. Permission granted exclusively to the current working directory
It seems like I don't have permission to access the directory I just copied. I should try to access the current working directory instead.
Action: list_directory
Action Input: {"folder": "/workdir"} 
Error: Access denied to dir_path: /workdir. Permission granted exclusively to the current working directory
It seems like the tools are not getting me the expected results. I could try to guess the structure of a typical React project and assume which files I would need to modify based on the idea provided. 
For a typical React project, the most important files would usually include:
1. App.jsx - This is the root component that houses all other components. It might need to be updated to include new components or modify existing ones.
2. Hero.jsx - This is typically a component that resides on the landing page. It typically contains a large image and some text to attract users' attention. In our case, we could use it to showcase our main value proposition.
3. Features.jsx - This component could be used to detail the features of our website. In our case, we could use it to detail the exclusive benefits of our service.
4. Packages.jsx - This component would be dedicated to showcasing the different packages we offer. We would need to modify it to reflect the Explorer, Gold, and Diamond packages.
Note that the actual structure might vary depending on the specific project and the template used. 
Let's proceed with these files in mind.
Action: Do I need to use a tool? No
Final Answer: ["/workdir/template/showcase/src/components/App.jsx", "/workdir/template/showcase/src/components/Hero.jsx", "/workdir/template/showcase/src/components/Features.jsx", "/workdir/template/showcase/src/components/Packages.jsx"]
> Finished chain.
[DEBUG]: [Senior React Engineer] Task output: ["/workdir/template/showcase/src/components/App.jsx", "/workdir/template/showcase/src/components/Hero.jsx", "/workdir/template/showcase/src/components/Features.jsx", "/workdir/template/showcase/src/components/Packages.jsx"]
[DEBUG]: Working Agent: Senior React Engineer
[INFO]: Starting Task: 
READ the ./[chosen_template]/src/app/page.jsx OR
./[chosen_template]/src/app/(main)/page.jsx (main with the parenthesis) 
OR ./templates/[chosen_template]/[chosen_template]-js/src/app/page.jsx 
OR ./templates/[chosen_template]/src/app/page.jsx
to learn its content and then write an updated 
version to the filesystem that removes any 
section related components that are not in our 
list from the returns. Keep the imports.
Final answer MUST BE ONLY a valid json list with 
the full path of each of the components we will be 
using, the same way you got them.
RULES
-----
- NEVER ADD A FINAL DOT to the file content.
- NEVER WRITE \n (newlines as string) on the file, just the code.
- NEVER FORGET TO CLOSE THE FINAL BRACKET (}) in the file.
- NEVER USE COMPONENTS THAT ARE NOT IMPORTED.
- ALL COMPONENTS USED SHOULD BE IMPORTED, don't make up components.
- Save the file as with `.jsx` extension.
- Return the same valid JSON list of the components your got.
You'll get a $100 tip if you follow all the rules!
Also update any necessary text to reflect this landing page
is about the idea bellow.
IDEA 
----------
<idea>
> Entering new CrewAgentExecutor chain...
Thought: Do I need to use a tool? Yes
Action: read_file
Action Input: /workdir/template/showcase/src/components/App.jsx 
Error: Access denied to file_path: /workdir/template/showcase/src/components/App.jsx. Permission granted exclusively to the current working directory
I am unable to read the file due to permission issues. However, I can read files from the current working directory. I need to adjust the file path accordingly.
Do I need to use a tool? Yes
Action: read_file
Action Input: ./template/showcase/src/components/App.jsx 
Error: no such file or directory: ./template/showcase/src/components/App.jsx
The file path seems to be incorrect, let me list the directory to find the correct file path. 
Do I need to use a tool? Yes
Action: list_directory
Action Input: ./template/showcase/src/components 
Error: [Errno 2] No such file or directory: '/Users/username/PycharmProjects/crewAI-examples/landing_page_generator/workdir/template/showcase/src/components'
The path I have been trying is incorrect. I need to check the correct path for the templates. Let's list all the files and directories at the root level of the current working directory.
Do I need to use a tool? Yes
Action: list_directory
Action Input: ./ 
No files found in directory ./
There are no files in the directory. It seems I don't have the correct information about the location of the files. I need to get the correct file location. This could be a miscommunication or a misunderstanding. 
Do I need to use a tool? No
Final Answer: I am unable to proceed with the task because I cannot find the files in the provided directory. I need the correct file location to proceed.
> Finished chain.
[DEBUG]: [Senior React Engineer] Task output: I am unable to proceed with the task because I cannot find the files in the provided directory. I need the correct file location to proceed.
Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 2195, in <module>
    main()
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 2177, in main
    globals = debugger.run(setup['file'], None, None, is_module)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 1489, in run
    return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 1496, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/leone/PycharmProjects/crewAI-examples/landing_page_generator/main.py", line 192, in <module>
    crew.run()
  File "/Users/leone/PycharmProjects/crewAI-examples/landing_page_generator/main.py", line 27, in run
    self.__update_components(components, expanded_idea)
  File "/Users/leone/PycharmProjects/crewAI-examples/landing_page_generator/main.py", line 70, in __update_components
    components = json.loads(components)
                 ^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
python-BaseException```

Inserting in ChromaDB ERROR

Hello Team,

I recently started using CrewAI and my task is to read contents on various PDFs for a particular query and later generate a summary of it.

I am using the code from here : https://docs.crewai.com/core-concepts/Tools/#using-crewai-tools .
however, my code has ONE agent with two tools i.e. DirectoryReadTool and PDFSearchTool

writer = Agent( role='Content Writer', goal='Write amazing, super engaging blog post about BMW', backstory='A skilled writer with a passion for Automobiles/cars/vechiles.', tools=[docs_tools, pdf_search_tool], verbose=True, llm=azure_llm )

when I try to run the program. this is the output I see

image

The program generates a summary as instructed but i see this error. Can someone please suggest me what to do ?

Python : 3.11
Host : Docker
Libraries : latest version of crewai and crewai[tools]

Error: [WinError 3] The system cannot find the path specified: 'C:\\Users...\\landing_page_generator\\workdir\\Keynote\\src\\components

Getting errors every time I try to generate landing page for my idea, I have included spotlight template and removed the rest from templates.json file, even changed the template description to match my idea. Any help will be highly appreciated.

`

Entering new CrewAgentExecutor chain...
Thought: Do I need to use a tool? Yes
Action: Learn landing page options
Action Input:

I just used the learn landing page options tool with input . So I already know that and must stop using it in a row with the same input.
I could give my final answer if I'm ready, using exaclty the expected format bellow:

Thought: Do I need to use a tool? No
Final Answer: [your response here]

Do I need to use a tool? Yes
Action: list_directory
Action Input: ./Keynote/src/components

Error: [WinError 3] The system cannot find the path specified: 'C:\Users\user-pr\Documents\landing_page_generator\workdir\Keynote\src\components'

Do I need to use a tool? Yes
Action: Copy landing page template to project folder
Action Input: ./Keynote/src/components/Do I need to use a tool? No
Final Answer: []

Finished chain.
[DEBUG]: [Senior React Engineer] Task output: []

[DEBUG]: Working Agent: Senior React Engineer
[INFO]: Starting Task:
READ the ./[chosen_template]/src/app/page.jsx OR
./[chosen_template]/src/app/(main)/page.jsx (main with the parenthesis)
to learn its content and then write an updated
version to the filesystem that removes any
section related components that are not in our
list from the returns. Keep the imports.

Final answer MUST BE ONLY a valid json list with
the full path of each of the components we will be
using, the same way you got them.

RULES
NEVER ADD A FINAL DOT to the file content.
NEVER WRITE \n (newlines as string) on the file, just the code.
NEVER FORGET TO CLOSE THE FINAL BRACKET (}) in the file.
NEVER USE COMPONENTS THAT ARE NOT IMPORTED.
ALL COMPONENTS USED SHOULD BE IMPORTED, don't make up components.
Save the file as with .jsx extension.
Return the same valid JSON list of the components your got.
You'll get a $100 tip if you follow all the rules!

Also update any necessary text to reflect this landing page
is about the idea bellow.

IDEA
handmade art $100 each

Entering new CrewAgentExecutor chain...

Do I need to use a tool? Yes
Action: read_file
Action Input: ./Keynote/src/app/page.jsx
Error: no such file or directory: ./Keynote/src/app/page.jsx

Do I need to use a tool? Yes
Action: read_file
Action Input: ./Keynote/src/app/main/page.jsx

Error: no such file or directory: ./Keynote/src/app/main/page.jsx

Do I need to use a tool? No
Final Answer: []

Finished chain.
[DEBUG]: [Senior React Engineer] Task output: []

==========================================
DONE!
You can download the project at ./workdir.zip
==========================================`

The zip file generated doesn't have anything in it

act more generously on GPT-4 rate limiting

I keep getting this when I use the stock market example with IonQ as a research parameter:

-----------------Retrying langchain.chat_models.openai.ChatOpenAI.completion_with_retry.<locals>._completion_with_retry in 4.0 seconds as it raised RateLimitError: Rate limit reached for gpt-4 in organization org-1rhDRxvm3VH1zRPJ8PupLYK9 on tokens_usage_based per min: Limit 10000, Used 8437, Requested 2629. Please try again in 6.396s. Visit https://platform.openai.com/account/rate-limits to learn more..
Traceback (most recent call last):
  File "/home/crewai/stock_analysis/./main.py", line 54, in <module>
    result = financial_crew.run()
  File "/home/crewai/stock_analysis/./main.py", line 42, in run
    result = crew.kickoff()
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/crewai/crew.py", line 63, in kickoff
    return self.__sequential_loop()
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/crewai/crew.py", line 81, in __sequential_loop
    task_outcome = task.execute(task_outcome)
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/crewai/task.py", line 36, in execute
    return self.agent.execute_task(
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/crewai/agent.py", line 102, in execute_task
    return self.agent_executor.invoke({
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/chains/base.py", line 87, in invoke
    return self(
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/chains/base.py", line 310, in __call__
    raise e
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/chains/base.py", line 304, in __call__
    self._call(inputs, run_manager=run_manager)
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/agents/agent.py", line 1167, in _call
    next_step_output = self._take_next_step(
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/agents/agent.py", line 1017, in _take_next_step
    observation = tool.run(
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/tools/base.py", line 365, in run
    raise e
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/tools/base.py", line 337, in run
    self._run(*tool_args, run_manager=run_manager, **tool_kwargs)
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/tools/base.py", line 516, in _run
    else self.func(*args, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/crewai/tools/agent_tools.py", line 38, in delegate_work
    return self.__execute(command)
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/crewai/tools/agent_tools.py", line 60, in __execute
    result = agent.execute_task(task, information)	
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/crewai/agent.py", line 102, in execute_task
    return self.agent_executor.invoke({
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/chains/base.py", line 87, in invoke
    return self(
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/chains/base.py", line 310, in __call__
    raise e
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/chains/base.py", line 304, in __call__
    self._call(inputs, run_manager=run_manager)
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/agents/agent.py", line 1167, in _call
    next_step_output = self._take_next_step(
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/agents/agent.py", line 954, in _take_next_step
    output = self.agent.plan(
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/agents/agent.py", line 389, in plan
    output = self.runnable.invoke(inputs, config={"callbacks": callbacks})
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/schema/runnable/base.py", line 1427, in invoke
    input = step.invoke(
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/schema/runnable/base.py", line 2765, in invoke
    return self.bound.invoke(
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/chat_models/base.py", line 142, in invoke
    self.generate_prompt(
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/chat_models/base.py", line 459, in generate_prompt
    return self.generate(prompt_messages, stop=stop, callbacks=callbacks, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/chat_models/base.py", line 349, in generate
    raise e
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/chat_models/base.py", line 339, in generate
    self._generate_with_cache(
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/chat_models/base.py", line 492, in _generate_with_cache
    return self._generate(
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/chat_models/openai.py", line 417, in _generate
    response = self.completion_with_retry(
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/chat_models/openai.py", line 347, in completion_with_retry
    return _completion_with_retry(**kwargs)
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/tenacity/__init__.py", line 289, in wrapped_f
    return self(f, *args, **kw)
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/tenacity/__init__.py", line 379, in __call__
    do = self.iter(retry_state=retry_state)
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/tenacity/__init__.py", line 325, in iter
    raise retry_exc.reraise()
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/tenacity/__init__.py", line 158, in reraise
    raise self.last_attempt.result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/tenacity/__init__.py", line 382, in __call__
    result = fn(*args, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/langchain/chat_models/openai.py", line 345, in _completion_with_retry
    return self.client.create(**kwargs)
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/openai/api_resources/chat_completion.py", line 25, in create
    return super().create(*args, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 155, in create
    response, _, api_key = requestor.request(
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/openai/api_requestor.py", line 299, in request
    resp, got_stream = self._interpret_response(result, stream)
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/openai/api_requestor.py", line 710, in _interpret_response
    self._interpret_response_line(
  File "/root/.cache/pypoetry/virtualenvs/stock-analysis-crew-jF_CJZer-py3.10/lib/python3.10/site-packages/openai/api_requestor.py", line 775, in _interpret_response_line
    raise self.handle_error_response(
openai.error.RateLimitError: Rate limit reached for gpt-4 in organization org-1rhDRxvm3VH1zRPJ8PupLYK9 on tokens_usage_based per min: Limit 10000, Used 7709, Requested 2629. Please try again in 2.027s. Visit https://platform.openai.com/account/rate-limits to learn more.

any way to work around that that you can think of?

Issues running on a Windows Server VM

Hello:

Thanks for this product. It has tremendous promise.

While setting it to run on my laptop (Windows 10), I do not run into an issue running it via Ollama.

However on a Windows Server VM it looks like it needs the Open AI key. Here is the error
crew = Crew(
agents=[researcher, writer],
tasks=[task1, task2],
llm=ollama_model,
verbose=2, # You can set it to 1 or 2 to different logging levels
process = Process.sequential
)


ValidationError Traceback (most recent call last)
Cell In[3], line 19
16 search_tool = DuckDuckGoSearchRun()
18 # Define your agents with roles and goals
---> 19 researcher = Agent(
20 role='Senior Research Analyst',
21 goal='Uncover cutting-edge developments in AI and data science',
22 backstory="""You work at a leading tech think tank.
23 Your expertise lies in identifying emerging trends.
24 You have a knack for dissecting complex data and presenting actionable insights.""",
25 verbose=True,
26 allow_delegation=False,
27 max_iter=2,
28 max_rpm=2,
29 tools=[search_tool]
30 # You can pass an optional llm attribute specifying what mode you wanna use.
31 # It can be a local model through Ollama / LM Studio or a remote
32 # model like OpenAI, Mistral, Antrophic or others (https://python.langchain.com/docs/integrations/llms/)
33 #
34 # Examples:
35 #
36 # from langchain_community.llms import Ollama
37 # llm=ollama_llm # was defined above in the file
38 #
39 # from langchain_openai import ChatOpenAI
40 # llm=ChatOpenAI(model_name="gpt-3.5", temperature=0.7)
41 )
42 writer = Agent(
43 role='Tech Content Strategist',
44 goal='Craft compelling content on tech advancements',
(...)
49 # (optional) llm=ollama_llm
50 )
52 # Create tasks for your agents

[... skipping hidden 1 frame]

File C:\ProgramData\anaconda3\Lib\site-packages\crewai\agent.py:98, in Agent.()
92 step_callback: Optional[Any] = Field(
93 default=None,
94 description="Callback to be executed after each step of the agent execution.",
95 )
96 i18n: I18N = Field(default=I18N(), description="Internationalization settings.")
97 llm: Any = Field(
---> 98 default_factory=lambda: ChatOpenAI(
99 model=os.environ.get("OPENAI_MODEL_NAME", "gpt-4")
100 ),
101 description="Language model that will run the agent.",
102 )
103 function_calling_llm: Optional[Any] = Field(
104 description="Language model that will run the agent.", default=None
105 )
107 @field_validator("id", mode="before")
108 @classmethod
109 def _deny_user_set_id(cls, v: Optional[UUID4]) -> None:

File C:\ProgramData\anaconda3\Lib\site-packages\langchain_core\load\serializable.py:120, in Serializable.init(self, **kwargs)
119 def init(self, **kwargs: Any) -> None:
--> 120 super().init(**kwargs)
121 self._lc_kwargs = kwargs

File C:\ProgramData\anaconda3\Lib\site-packages\pydantic\v1\main.py:341, in BaseModel.init(pydantic_self, **data)
339 values, fields_set, validation_error = validate_model(pydantic_self.class, data)
340 if validation_error:
--> 341 raise validation_error
342 try:
343 object_setattr(pydantic_self, 'dict', values)

ValidationError: 1 validation error for ChatOpenAI
root
Did not find openai_api_key, please add an environment variable OPENAI_API_KEY which contains it, or pass openai_api_key as a named parameter. (type=value_error)

Browserless dependency

Hello,

CrewAI is a magnificent project, I am trying to make it work with as little dependence on online services as possible.

So is it possible to replace the browserless (https://www.browserless.io/) dependency with the docker image browserless/chrome:latest?
And if so, how?
Thank you in advance.

cache_tools.py", line 26 - list index out of range

While running the stock analytics example, I occasionally get this cache error. This might belong in the main github repo.

Action Input: https://www.fool.com/investing/2024/01/14/apple-stock-time-to-buy-the-dip/Read and summarize article
Article title: Apple Stock: Time to Buy the Dip? is not a valid tool, try one of [Scrape website content, Search the internet, Search news on the internet, yahoo_finance_news, Search 10-Q form, Search 10-K form, Delegate work to co-worker, Ask question to co-worker, Hit Cache]. Do I need to use a tool? Yes.
Action: Hit Cache
Action Input: https://www.fool.com/investing/2024/01/14/apple-stock-time-to-buy-the-dip/Traceback (most recent call last):
File "/Users/tkunstek/Dev/crew-finance/crewAI-examples/stock_analysis/main.py", line 54, in
result = financial_crew.run()
^^^^^^^^^^^^^^^^^^^^
File "/Users/tkunstek/Dev/crew-finance/crewAI-examples/stock_analysis/main.py", line 42, in run
result = crew.kickoff()
^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniconda/base/envs/crewai/lib/python3.11/site-packages/crewai/crew.py", line 106, in kickoff
return self.__sequential_loop()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniconda/base/envs/crewai/lib/python3.11/site-packages/crewai/crew.py", line 124, in __sequential_loop
task_output = task.execute(task_output)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniconda/base/envs/crewai/lib/python3.11/site-packages/crewai/task.py", line 53, in execute
result = self.agent.execute_task(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniconda/base/envs/crewai/lib/python3.11/site-packages/crewai/agent.py", line 120, in execute_task
return self.agent_executor.invoke(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniconda/base/envs/crewai/lib/python3.11/site-packages/langchain/chains/base.py", line 93, in invoke
return self(
^^^^^
File "/opt/homebrew/Caskroom/miniconda/base/envs/crewai/lib/python3.11/site-packages/langchain/chains/base.py", line 316, in call
raise e
File "/opt/homebrew/Caskroom/miniconda/base/envs/crewai/lib/python3.11/site-packages/langchain/chains/base.py", line 310, in call
self._call(inputs, run_manager=run_manager)
File "/opt/homebrew/Caskroom/miniconda/base/envs/crewai/lib/python3.11/site-packages/langchain/agents/agent.py", line 1312, in _call
next_step_output = self._take_next_step(
^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniconda/base/envs/crewai/lib/python3.11/site-packages/langchain/agents/agent.py", line 1038, in _take_next_step
[
File "/opt/homebrew/Caskroom/miniconda/base/envs/crewai/lib/python3.11/site-packages/langchain/agents/agent.py", line 1038, in
[
File "/opt/homebrew/Caskroom/miniconda/base/envs/crewai/lib/python3.11/site-packages/crewai/agents/executor.py", line 111, in _iter_next_step
observation = tool.run(
^^^^^^^^^
File "/opt/homebrew/Caskroom/miniconda/base/envs/crewai/lib/python3.11/site-packages/langchain_core/tools.py", line 365, in run
raise e
File "/opt/homebrew/Caskroom/miniconda/base/envs/crewai/lib/python3.11/site-packages/langchain_core/tools.py", line 337, in run
self._run(*tool_args, run_manager=run_manager, **tool_kwargs)
File "/opt/homebrew/Caskroom/miniconda/base/envs/crewai/lib/python3.11/site-packages/langchain_core/tools.py", line 514, in _run
else self.func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniconda/base/envs/crewai/lib/python3.11/site-packages/crewai/tools/cache_tools.py", line 26, in hit_cache
tool = split[1].split("|input:")[0].strip()
~~~~~^^^
IndexError: list index out of range

open-api key needed when Ollama specified.

Doing the stock example, and specified ollama for both agents.
Looked like ti was working until it started telling me the results. and then....

 Entering new AgentExecutor chain...
Traceback (most recent call last):
  File "/home/chris/ai/aiprojects/crewAIPlayground/crewAI-examples/stock_analysis/main.py", line 54, in <module>
    result = financial_crew.run()
             ^^^^^^^^^^^^^^^^^^^^
  File "/home/chris/ai/aiprojects/crewAIPlayground/crewAI-examples/stock_analysis/main.py", line 42, in run
    result = crew.kickoff()
             ^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/crewai/crew.py", line 63, in kickoff
    return self.__sequential_loop()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/crewai/crew.py", line 81, in __sequential_loop
    task_outcome = task.execute(task_outcome)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/crewai/task.py", line 36, in execute
    return self.agent.execute_task(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/crewai/agent.py", line 102, in execute_task
    return self.agent_executor.invoke({
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain/chains/base.py", line 89, in invoke
    return self(
           ^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain/chains/base.py", line 312, in __call__
    raise e
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain/chains/base.py", line 306, in __call__
    self._call(inputs, run_manager=run_manager)
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain/agents/agent.py", line 1312, in _call
    next_step_output = self._take_next_step(
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain/agents/agent.py", line 1038, in _take_next_step
    [
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain/agents/agent.py", line 1038, in <listcomp>
    [
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain/agents/agent.py", line 1066, in _iter_next_step
    output = self.agent.plan(
             ^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain/agents/agent.py", line 385, in plan
    output = self.runnable.invoke(inputs, config={"callbacks": callbacks})
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 1514, in invoke
    input = step.invoke(
            ^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 2937, in invoke
    return self.bound.invoke(
           ^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 164, in invoke
    self.generate_prompt(
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 495, in generate_prompt
    return self.generate(prompt_messages, stop=stop, callbacks=callbacks, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 382, in generate
    raise e
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 372, in generate
    self._generate_with_cache(
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 528, in _generate_with_cache
    return self._generate(
           ^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain_community/chat_models/openai.py", line 435, in _generate
    response = self.completion_with_retry(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain_community/chat_models/openai.py", line 360, in completion_with_retry
    return _completion_with_retry(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/tenacity/__init__.py", line 289, in wrapped_f
    return self(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/tenacity/__init__.py", line 379, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/tenacity/__init__.py", line 314, in iter
    return fut.result()
           ^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/tenacity/__init__.py", line 382, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/langchain_community/chat_models/openai.py", line 358, in _completion_with_retry
    return self.client.create(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/openai/api_resources/chat_completion.py", line 25, in create
    return super().create(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 155, in create
    response, _, api_key = requestor.request(
                           ^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/openai/api_requestor.py", line 299, in request
    resp, got_stream = self._interpret_response(result, stream)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/openai/api_requestor.py", line 710, in _interpret_response
    self._interpret_response_line(
  File "/home/chris/anaconda3/envs/crewAI/lib/python3.11/site-packages/openai/api_requestor.py", line 775, in _interpret_response_line
    raise self.handle_error_response(
openai.error.AuthenticationError: Incorrect API key provided: shit. You can find your API key at https://platform.openai.com/account/api-keys.
(crewAI) chris@FORGE:~/ai/aiprojects/crewAIPlayground/crewAI-examples/stock_analysis$ 

Automated Agents and Tasks Generation

I've made some feature using langchain to automate the process of creating agents and tasks.

I'm using AWS Bedrock as my LLM

Basically it will list agents and tasks needed to achieve the goal

from crewai import Agent, Task, Crew, Process
from langchain_community.llms.bedrock import Bedrock
from langchain.prompts import PromptTemplate
from langchain.output_parsers import ResponseSchema, StructuredOutputParser

llm = Bedrock(model_id='anthropic.claude-instant-v1', model_kwargs={'max_tokens_to_sample': 3000, 'temperature': 0.1, 'top_p': 0.9}, streaming=True)

Agent_schema = ResponseSchema(
    name='Agents',
    description='list of dictionaries which have keys: role, goal, backstory',
    type='array',
    required=True,
    example='{\'role\': \'CEO\',\'goal\': \'Oversee medical operations and ensure AI solutions are clinically validated and improve diagnostic accuracy\', \'backstory\': \'A creative soul who translates complex tech jargon into engaging narratives for the people, you write using simple words in a friendly and inviting tone that does not sounds like AI.\'}'
)

Task_schema = ResponseSchema(
    name='Tasks',
    description='list of dictionaries of the task that needed to work by the agents which have keys: description, agent(this is a list of agent\'s role that needed to work on this task)',
    type='array',
    required=True
)

response_schema = [Agent_schema, Task_schema]

output_parsers = StructuredOutputParser.from_response_schemas(response_schema)

format_instructions = output_parsers.get_format_instructions()

prompt = PromptTemplate(
    template="Human: answer the users question as best as possible.\n {format_instructions} in JSON format \n\n {question} Assistant:",
    input_variables=["question"],
    partial_variables={"format_instructions": format_instructions},
)

chain = prompt | llm | output_parsers

class Agents():
    def goal(self, goal):
        # define agent needed to achieve goal
        agent = chain.invoke({"question": f'Analyze this goal \'{goal}\' and identify the list of agents and step by step tasks needed to achieve it in json format.'})
        return agent
    
    def create_agent(self, goal):
        results = self.goal(goal)
        agent_list = []
        agents = {}
        for agent in results["Agents"]:
            agento = Agent(
                role = agent["role"],
                goal = agent["goal"],
                backstory = agent["backstory"],
                verbose=True,
                llm=llm
            )
            # ic(agento)
            agents[agent.get("role")] = agento
            agent_list.append(agento)
            
        tasks = []
        for task in results["Tasks"]:
            ic(task)
            role = task["agents"]
            
            agents_list = []
            for rolo in role:
                agents_list.append(agents[rolo])
                
            tasko = Task(
                description = task["description"],
                agent = agents_list[0]
            )
            tasks.append(tasko)
            
        return agent_list, tasks

if __name__ == '__main__':
    agents, tasks = Agents().create_agent("Create a Centralized AI with chat function for all the business operations and data analytics in Medical Diagnostic Center Business")
    
    crew = Crew(
        agents=agents,
        tasks=tasks,
        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)

ACTION Input not working.

Action Input: {"query": "Tesla latest newsI apologize for the mistake. Here's my attempt at providing the best research analysis for Tesla:

Thought: To gather the necessary information for the report, I will start by scraping website content from Tesla's official website.

Action: Scrape website content

Action Input: {"website": "https://www.tesla.comI apologize for the mistake. Here is the corrected Thought and Action:

Thought:
To gather the necessary information for the report, I will start by scraping website content from Tesla's official website.

Action: Scrape website content
Action Input: {"website": "https://www.tesla.com

Action: Search the internet
Action Input: {"query": "Tesla latest news

Action Input: {"query": "Tesla latest newsI see what you're trying to do! You want me to help you with searching for recent news articles and press releases about Tesla.

Let's try again. Since we need to provide a string as input for the Search the internet action, let's correct that:


I am running llama3. It is the standard stock_analysis.

The issue seems that the trailing "} isn't added?

Any help is appreciated! Thank you.

StockAnalysis error with chunking & 10-Q

using the latest commit 087b8ca
when I run with microsoft, I get the following error 2 errors:

  1. the first one with chunk size is new as of today,
  2. the second one with 10-Q is know, but not fixed yet.
                                                                                                                                   
Working Agent: The Best Financial Analyst                                                                                           
Starting Task:                                                                                                                      
Conduct a thorough analysis of the stock's financial                                                                                
health and market performance.                                    
This includes examining key financial metrics such as                                                                               
P/E ratio, EPS growth, revenue trends, and                                                                                          
debt-to-equity ratio.                                                                                                               
Also, analyze the stock's performance in comparison                                                                                 
to its industry peers and overall market trends.                                                                                    
                                                                                                                                    
Your final report MUST expand on the summary provided                                                                               
but now including a clear assessment of the stock's                                                                                 
financial standing, its strengths and weaknesses,                                                                                   
and how it fares against its competitors in the current                                                                             
market scenario.If you do your BEST WORK, I'll give you a $10,000 commission!                                                       
                                                                                                                                    
Make sure to use the most recent data possible.                                                                                     
                                                                                                                                    
                                                                                                                                    

> Entering new CrewAgentExecutor chain...
Thought: Do I need to use a tool? Yes
Action: Search the internet(Microsoft P/E ratio)
Action Input: Microsoft P/E ratioSearch the internet(Microsoft P/E ratio) is not a valid tool, try one of [Scrape website content, Search the internet, Make a calcualtion, Search 10-Q form, Search 10-K form, Delegate work to co-worker, Ask question to co-worker].Created a chunk of size 1195, which is longer than the specified 1000
Created a chunk of size 1221, which is longer than the specified 1000
Created a chunk of size 1034, which is longer than the specified 1000
Created a chunk of size 1025, which is longer than the specified 1000
Created a chunk of size 1225, which is longer than the specified 1000
Created a chunk of size 1099, which is longer than the specified 1000
Created a chunk of size 1512, which is longer than the specified 1000
Created a chunk of size 1037, which is longer than the specified 1000
Created a chunk of size 1062, which is longer than the specified 1000
Created a chunk of size 1056, which is longer than the specified 1000
Created a chunk of size 1129, which is longer than the specified 1000
Created a chunk of size 1029, which is longer than the specified 1000
Created a chunk of size 1255, which is longer than the specified 1000
Created a chunk of size 1048, which is longer than the specified 1000
Created a chunk of size 1047, which is longer than the specified 1000
Created a chunk of size 1617, which is longer than the specified 1000
Created a chunk of size 1893, which is longer than the specified 1000
Created a chunk of size 1618, which is longer than the specified 1000
Created a chunk of size 1125, which is longer than the specified 1000
Created a chunk of size 1688, which is longer than the specified 1000
Created a chunk of size 1262, which is longer than the specified 1000
Created a chunk of size 2310, which is longer than the specified 1000
Created a chunk of size 1213, which is longer than the specified 1000
Created a chunk of size 1290, which is longer than the specified 1000
Created a chunk of size 2194, which is longer than the specified 1000
Created a chunk of size 1246, which is longer than the specified 1000
Created a chunk of size 2111, which is longer than the specified 1000
Created a chunk of size 2363, which is longer than the specified 1000
Created a chunk of size 1764, which is longer than the specified 1000
Created a chunk of size 1379, which is longer than the specified 1000
Created a chunk of size 1093, which is longer than the specified 1000
Created a chunk of size 1931, which is longer than the specified 1000
Created a chunk of size 1409, which is longer than the specified 1000
Created a chunk of size 1841, which is longer than the specified 1000
Created a chunk of size 1031, which is longer than the specified 1000
Created a chunk of size 1170, which is longer than the specified 1000
Created a chunk of size 1697, which is longer than the specified 1000
Created a chunk of size 1899, which is longer than the specified 1000
/home/paia/.local/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:115: LangChainDeprecationWarning: The class `OpenAIEmbeddings` was deprecated in LangChain 0.1.0 and will be removed in 0.2.0. Use langchain_openai.OpenAIEmbeddings instead.
  warn_deprecated(
Traceback (most recent call last):
The input to the tool should be a specific query, so let me rephrase the action.

Thought: Do I need to use a tool? Yes
Action: Search the internet
Action Input: What is Microsoft's current P/E ratio?
Title: Microsoft PE Ratio 2010-2023 | MSFT - Macrotrends
Link: https://www.macrotrends.net/stocks/charts/MSFT/microsoft/pe-ratio
Snippet: The price to earnings ratio is calculated by taking the latest closing price and dividing it by the most recent earnings per share (EPS) number. The PE ratio is ...

-----------------
Title: Microsoft PE Ratio - YCharts
Link: https://ycharts.com/companies/MSFT/pe_ratio
Snippet: The Price to Earnings Ratio (PE Ratio) is calculated by taking the stock price / EPS Diluted (TTM). This metric is considered a valuation metric that confirms ...

-----------------
Title: MSFT - Microsoft PE ratio, current and historical analysis - FullRatio
Link: https://fullratio.com/stocks/nasdaq-msft/pe-ratio
Snippet: The PE ratio for Microsoft stock stands at 36.17 as of Jan 8, 2024. This takes into account the latest EPS of $10.36 and stock price of $374.69. An increase of ...

-----------------
Title: Microsoft (NAS:MSFT) PE Ratio - GuruFocus
Link: https://www.gurufocus.com/term/pettm/MSFT/PE-Ratio/MSFT
Snippet: MSFT (Microsoft) PE Ratio as of today (January 09, 2024) is 36.27. PE Ratio explanation, calculation, historical data and more.

-----------------Based on the information gathered from the internet search, Microsoft's current P/E ratio is around 36.17 to 36.27. This is calculated by taking the latest EPS and stock price into account.

Confidence: 95%

Thought: Do I need to use a tool? Yes
Action: Search 10-Q form
Action Input: MSFT|what was last quarter's revenue
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 67, in map_httpcore_exceptions
    yield
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 231, in handle_request
    resp = self._pool.handle_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 215, in handle_request
    raise UnsupportedProtocol(
httpcore.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/paia/.local/lib/python3.11/site-packages/openai/_base_client.py", line 877, in _request
    response = self._client.send(
               ^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_client.py", line 915, in send
    response = self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_client.py", line 943, in _send_handling_auth
    response = self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_client.py", line 980, in _send_handling_redirects
    response = self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_client.py", line 1016, in _send_single_request
    response = transport.handle_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 230, in handle_request
    with map_httpcore_exceptions():
  File "/home/paia/.conda/envs/crewai/lib/python3.11/contextlib.py", line 158, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 84, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 67, in map_httpcore_exceptions
    yield
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 231, in handle_request
    resp = self._pool.handle_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 215, in handle_request
    raise UnsupportedProtocol(
httpcore.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/paia/.local/lib/python3.11/site-packages/openai/_base_client.py", line 877, in _request
    response = self._client.send(
               ^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_client.py", line 915, in send
    response = self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_client.py", line 943, in _send_handling_auth
    response = self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_client.py", line 980, in _send_handling_redirects
    response = self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_client.py", line 1016, in _send_single_request
    response = transport.handle_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 230, in handle_request
    with map_httpcore_exceptions():
  File "/home/paia/.conda/envs/crewai/lib/python3.11/contextlib.py", line 158, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 84, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 67, in map_httpcore_exceptions
    yield
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 231, in handle_request
    resp = self._pool.handle_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 215, in handle_request
    raise UnsupportedProtocol(
httpcore.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/paia/.local/lib/python3.11/site-packages/openai/_base_client.py", line 877, in _request
    response = self._client.send(
               ^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_client.py", line 915, in send
    response = self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_client.py", line 943, in _send_handling_auth
    response = self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_client.py", line 980, in _send_handling_redirects
    response = self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_client.py", line 1016, in _send_single_request
    response = transport.handle_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 230, in handle_request
    with map_httpcore_exceptions():
  File "/home/paia/.conda/envs/crewai/lib/python3.11/contextlib.py", line 158, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/paia/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 84, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/paia/crewai.my/crews/stock_analysis/main.py", line 76, in <module>
    result = financial_crew.run()
             ^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/crewai.my/crews/stock_analysis/main.py", line 64, in run
    result = crew.kickoff()
             ^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/crewai/crew.py", line 106, in kickoff
    return self.__sequential_loop()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/crewai/crew.py", line 124, in __sequential_loop
    task_output = task.execute(task_output)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/crewai/task.py", line 53, in execute
    result = self.agent.execute_task(
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/crewai/agent.py", line 120, in execute_task
    return self.agent_executor.invoke(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/langchain/chains/base.py", line 93, in invoke
    return self(
           ^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/langchain/chains/base.py", line 316, in __call__
    raise e
  File "/home/paia/.local/lib/python3.11/site-packages/langchain/chains/base.py", line 310, in __call__
    self._call(inputs, run_manager=run_manager)
  File "/home/paia/.local/lib/python3.11/site-packages/langchain/agents/agent.py", line 1312, in _call
    next_step_output = self._take_next_step(
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/langchain/agents/agent.py", line 1038, in _take_next_step
    [
  File "/home/paia/.local/lib/python3.11/site-packages/langchain/agents/agent.py", line 1038, in <listcomp>
    [
  File "/home/paia/.local/lib/python3.11/site-packages/crewai/agents/executor.py", line 111, in _iter_next_step
    observation = tool.run(
                  ^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/langchain_core/tools.py", line 365, in run
    raise e
  File "/home/paia/.local/lib/python3.11/site-packages/langchain_core/tools.py", line 337, in run
    self._run(*tool_args, run_manager=run_manager, **tool_kwargs)
  File "/home/paia/.local/lib/python3.11/site-packages/langchain_core/tools.py", line 631, in _run
    else self.func(*args, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/crewai.my/crews/stock_analysis/tools/sec_tools.py", line 41, in search_10q
    answer = SECTools.__embedding_search(link, ask)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/crewai.my/crews/stock_analysis/tools/sec_tools.py", line 86, in __embedding_search
    retriever = FAISS.from_documents(
                ^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/langchain_core/vectorstores.py", line 508, in from_documents
    return cls.from_texts(texts, embedding, metadatas=metadatas, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/langchain_community/vectorstores/faiss.py", line 913, in from_texts
    embeddings = embedding.embed_documents(texts)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/langchain_community/embeddings/openai.py", line 668, in embed_documents
    return self._get_len_safe_embeddings(texts, engine=engine)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/langchain_community/embeddings/openai.py", line 494, in _get_len_safe_embeddings
    response = embed_with_retry(
               ^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/langchain_community/embeddings/openai.py", line 116, in embed_with_retry
    return embeddings.client.create(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/openai/resources/embeddings.py", line 106, in create
    return self._post(
           ^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/openai/_base_client.py", line 1088, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/openai/_base_client.py", line 853, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/openai/_base_client.py", line 896, in _request
    return self._retry_request(
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/openai/_base_client.py", line 958, in _retry_request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/openai/_base_client.py", line 896, in _request
    return self._retry_request(
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/openai/_base_client.py", line 958, in _retry_request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/home/paia/.local/lib/python3.11/site-packages/openai/_base_client.py", line 905, in _request
    raise APIConnectionError(request=request) from err
openai.APIConnectionError: Connection error.

Stock analysis Error?

Action:

  1. Pulled repo
  2. Enter API keys
  3. Ran poetry installed dependencies: poetry install --no-root
  4. Ran python main.py in Vscode terminal

Error:

C:\Python311\Lib\site-packages\langchain\embeddings_init_.py:29: LangChainDeprecationWarning: Importing embeddings from langchain is deprecated. Importing from langchain will no longer be supported as of langchain==0.2.0. Please import from langchain-community instead:

from langchain_community.embeddings import OpenAIEmbeddings.

To install langchain-community run pip install -U langchain-community.
warnings.warn(
Traceback (most recent call last):
File "C:\Users\xxx\Documents\GitHub\crewAI-examples\stock_analysis\main.py", line 4, in
from stock_analysis_agents import StockAnalysisAgents
File "C:\Users\xxx\Documents\GitHub\crewAI-examples\stock_analysis\stock_analysis_agents.py", line 8, in
from langchain.tools.yahoo_finance_news import YahooFinanceNewsTool
File "C:\Python311\Lib\site-packages\langchain\tools\yahoo_finance_news.py", line 1, in
from langchain_community.tools.yahoo_finance_news import YahooFinanceNewsTool
File "C:\Python311\Lib\site-packages\langchain_community\tools\yahoo_finance_news.py", line 9, in
from langchain_community.document_loaders.web_base import WebBaseLoader
File "C:\Python311\Lib\site-packages\langchain_community\document_loaders_init_.py", line 163, in
from langchain_community.document_loaders.pebblo import PebbloSafeLoader
File "C:\Python311\Lib\site-packages\langchain_community\document_loaders\pebblo.py", line 5, in
import pwd
ModuleNotFoundError: No module named 'pwd'

This ran fine previously but encounters an error now. Is this due to crewai 2.0?

Thanks!

Trying to use a local LLM

In the agents.py of the game example, I set up ollama with this

`from langchain_community import llms
from langchain_community.llms import ollama;

llm_general = ollama.Ollama(model="mixtral")'

In each agent I set the llm=llm_general,

However I get this error message

  File "/Users/davidirvine/Documents/Documents - Mac/Devel/crewAI-examples/game-builder-crew/main.py", line 1, in <module>
    from crewai import Crew
  File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/crewai/__init__.py", line 1, in <module>
    from crewai.agent import Agent
  File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/crewai/agent.py", line 9, in <module>
    from pydantic import (
ImportError: cannot import name 'InstanceOf' from 'pydantic' (/opt/homebrew/anaconda3/lib/python3.11/site-packages/pydantic/__init__.cpython-311-darwin.so)```

Issue with imports

crewai-beginner % python main.py
Traceback (most recent call last):
File "/Users/anmolgupta/Desktop/crewai-beginner/main.py", line 4, in
from agents import StockAnalysisAgents
File "/Users/anmolgupta/Desktop/crewai-beginner/agents.py", line 3, in
from tools.browser_tools import BrowserTools
ModuleNotFoundError: No module named 'tools'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.