The ChatOpenAI
class has been deprecated some time ago. CrewAI’s LLM class leverages LiteLLM in the background, which supports a wide range of LLM providers. Among these is Ollama, enabling you to run models like Llama 3.2.
Here’s a code example:
from crewai import Agent, LLM
my_llm = LLM(
api_base="http://localhost:11434",
model="ollama/llama3.2",
)
my_agent = Agent(
...,
llm=my_llm,
)