Hi,
I am trying to use crewai with Cohere and not OpenAI. This is for first notebook in the course, with create-agents-to-research-and-write-an-article-(code)
I also added llm = ChatCohere() to both research agent as well as writer agent, created tasks and created crew with these 2 agents. No errors till this point.
When I ran the last step,
result = crew.kickoff(inputs={‘topic’: ‘AI in healthcare’})
print(result)
I am getting error:
AuthenticationError: Error code: 401 - {‘error’: {‘message’: ‘Incorrect API key provided: fake. You can find your API key at https://platform.openai.com/account/api-keys.’, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: ‘invalid_api_key’}}
How do I make sure that I can use Cohere LLM for crewAI?
Thanks for your help!
issue is with incorrect api keys as you are running the codes in your local environment, use OpenAI platform where you need to get your OpenAI API keys.
Hi Deepti,
I do not want to use OpenAI, and want to use Cohere. I am running code in Colab.
Based on documentation Connect CrewAI to LLMs - crewAI I thought it was possible to use Cohere or other LLMs with CrewAI.
If that is not the case, then I misunderstood what CrewAI could and could not do.
Thanks and Regards,
Sachin
I’m guessing you have taken the code as it is and just replaced the call to openai with cohere ?
Firstly, you need to have a valid cohere API key. Secondly, adjust the code accordingly so that it loads cohere API and not expects an openai API (which is why it is calling it “fake”).
Hi Mubsi,
It is working now. Thanks for the help. Actually I did not use the code from the DeepLearning Notebook, but used the code from your website- Getting Started:
I found out from other errors that memory=True in Step 3 does not work with Cohere API.
from crewai import Crew, Process
Forming the tech-focused crew with some enhanced configurations
I made memory=False and then it works.
Actually notebook in this course works correctly with Cohere. No issues, it is just the code on your website does not.
Thanks for the help.
Regards,
Sachin