crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

Default Agent LLM factory Mistral/other OpenAI compatible API problem

Open michaelwdombek opened this issue 1 year ago • 3 comments

Hi @ all

after some discussions in discord and testing with mistral it seems that the agent setup cases some problems.

https://github.com/joaomdmoura/crewAI/blob/2f0bf3b325c86d913ec0c58a280c85120330776d/src/crewai/agent.py#L94-L99

Right now if I do not explicitly set the LLM.model value, anything that is passed as variable is getting overwritten by the default factory.

export OPENAI_API_KEY=your-mistral-api-key                                  # ok
export OPENAI_API_BASE=https://api.mistral.ai/v1                          # ok
export MODEL_NAME="mistral-medium"                                           # get over written by default factory setting model="gpt4"

I can think of two solutions:

  • remove the default to gp4 and only add it in post_init after checking for the system environment variables
  • write a general wrapper around the agent instantiation that supports alternative settings i.e using the specific implementations from different llm providers.

I'm in discord up for discussion :) cheers Michael

michaelwdombek avatar Feb 05 '24 12:02 michaelwdombek

Me too!

jmbenedetto avatar Feb 09 '24 20:02 jmbenedetto

Possibly related to #244 ?

whoabuddy avatar Feb 11 '24 18:02 whoabuddy

Fixing this with a new patch and updating the docs tonight

joaomdmoura avatar Feb 12 '24 06:02 joaomdmoura