Error in library I have tried everything but I keep getting the same error, what am I doing wrong?
ModuleNotFoundError Traceback (most recent call last)
in <cell line: 1>()
----> 1 from crewapi_module import CrewAPI # Replace with the correct import path
2
3 crew_api = CrewAPI(api_key=“your_crewai_api_key”)
4
5 # Now you can interact with the API, for example:
ModuleNotFoundError: No module named ‘crewapi_module’
matt:
e
This is my code, I hope you can help me.
!pip install crewai==0.28.8 crewai_tools==0.1.6 langchain_community==0.0.29
First, import the os module
import os
Now you can set your environment variables
os.environ[“OPENAI_API_KEY”] = ‘your_openai_api_key’
os.environ[“SERPER_API_KEY”] = ‘your_serper_api_key’
os.environ[“OPENAI_API_KEY”] = ‘your_openai_api_key’
os.environ[“SERPER_API_KEY”] = ‘your_serper_api_key’
Warning control
import warnings
warnings.filterwarnings(‘ignore’)
from crewai import Agent, Crew, Task
import os
Define the functions manually to retrieve your API keys
def get_openai_api_key():
return “your_openai_api_key”
def get_serper_api_key():
return “your_serper_api_key”
Set the API keys as environment variables
openai_api_key = get_openai_api_key()
os.environ[“OPENAI_MODEL_NAME”] = ‘gpt-4-turbo’ # Change to gpt-3.5-turbo if needed
os.environ[“SERPER_API_KEY”] = get_serper_api_key()
from google.colab import files
uploaded = files.upload() # This allows you to upload files
import os
Define the functions manually to retrieve your API keys
def get_openai_api_key():
return “your_openai_api_key”
def get_serper_api_key():
return “your_serper_api_key”
Set the API keys as environment variables
openai_api_key = get_openai_api_key()
os.environ[“OPENAI_MODEL_NAME”] = ‘gpt-3.5-turbo’ # Change to gpt-4-turbo if running locally
os.environ[“SERPER_API_KEY”] = get_serper_api_key()
from crewapi_module import CrewAPI # Replace with the correct import path
crew_api = CrewAPI(api_key=“your_crewai_api_key”)
Now you can interact with the API, for example:
response = crew_api.list_crews()
print(response.json())
matt
September 24, 2024, 2:52pm
4
why are you using such an old version???
The previous person who did the project did it like this
what do you recommend me to do
matt
September 24, 2024, 11:03pm
6
You should upgrade to latest and build a crew using our CLI, use;
Crewai create crew