crewAIInc / crewAI-examples

2.58k stars 947 forks source link

Problems with trip_planner #136

Open ureshvahalia opened 1 month ago

ureshvahalia commented 1 month ago

I downloaded trip_planner and tried to make it run. It has been a struggle. Below are the main issues: Trying to run with no modifications, I get:

Problem 1: ======= (.venv) sh-4.4$ poetry run python main.py E:\SoftwareDev\agents\crewAI-examples\trip_planner.venv\Lib\site-packages\langchain\llmsinit.py:548: LangChainDeprecationWarning: Importing LLMs 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.llms import OpenAI.

To install langchain-community run pip install -U langchain-community. warnings.warn(

I found the OpenAI import call in trip_agents.py and incorporated the suggested revision: from langchain_community.llms import OpenAI

and ran the program again, but got the exact same error. By the way, after printing the error, the program freezes, and the only way to get back is to kill the terminal window. (I am running this in a VSCode terminal on Windows 11 using "sh".)

Problem 2: ======= I worked around problem 1 by switching to Ubuntu, where I got the deprecation warning, changed over to langchain_community, and it worked. The program ran to completion using the default gpt-4, but of course cost me a few dollars. I tried to change over to gpt-3.5 by adding llm=ChatOpenAI(model_name="gpt-3.5-turbo-0125"), importing ChatOpenAI from langchain_openai. Now I tried to run the program, but get this error:

Entering new CrewAgentExecutor chain... Thought: Do I need to use a tool? Yes Action: Search the internet Action Input: Weather forecast in Tokyo in April 2025, upcoming cultural events in Tokyo in April 2025, flight costs from San Francisco to Tokyo in April 2025

It seems we encountered an unexpected error while trying to use the tool.

Do I need to use a tool? Yes Action: Search the internet Action Input: Weather forecast in Tokyo in April 2025, upcoming cultural events in Tokyo in April 2025, flight costs from San Francisco to Tokyo in April 2025

It seems we encountered an unexpected error while trying to use the tool.

ureshvahalia commented 1 month ago

It seems the problem is caused by gpt-4 and gpt-3.5 passing input to search_internet() in different formats. When I replaced search_internet() with a simple call to SerperDevTool(), the problem goes away and everything works great. I am surprised this hasn't hit more people already

chinmayajha commented 1 month ago

You need to share your code as well, it must be a problem with the way your prompts/tool is structured. (SerperDevTool kind of a default tool so the Crew knows how to handle it, might not be the case with your own tool)

github-actions[bot] commented 5 hours ago

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.