How to change the LLM presented on DeepLearning.ai's CrewAI course in Lab 1?

I am taking the crew.ai short course in DeepLearning.ai called practical multi ai agents and advanced use cases with Crew.Ai

in the first lab, the code is like this

# Warning control
import warnings
warnings.filterwarnings('ignore')

# Load environment variables
from helper import load_env
load_env()


import os
import yaml
from crewai import Agent, Task, Crew

os.environ['OPENAI_MODEL_NAME'] = 'gpt-4o-mini'
# Creating Agents
project_planning_agent = Agent(
  config=agents_config['project_planning_agent']
)

estimation_agent = Agent(
  config=agents_config['estimation_agent']
)

resource_allocation_agent = Agent(
  config=agents_config['resource_allocation_agent']
)

I want to make my life easy so that there’s only 1 place I change the model to be google gemini flash 1.5 8B without changing the code in multiple places

I can switch to 1.5 8B but I need to write a lot more code and I needed to assign the parameter llm=llm at the agent definition.

Is there an easier way to do this?

No, as far as I know. You need to set the llm parameter to every agent. Otherwise, it will default to gpt-4o-mini.

However, you can do this in the agents.yaml, which makes your project a bit cleaner.

researcher:
    role: Research Specialist
    goal: Conduct comprehensive research and analysis to gather relevant information,
        synthesize findings, and produce well-documented insights.
    backstory: A dedicated research professional with years of experience in academic
        investigation, literature review, and data analysis, known for thorough and
        methodical approaches to complex research questions.
    verbose: true
    llm: openai/gpt-4o
    # llm: azure/gpt-4o-mini
    # llm: gemini/gemini-pro
    # llm: anthropic/claude-3-5-sonnet-20240620
    # llm: bedrock/anthropic.claude-3-sonnet-20240229-v1:0
    # llm: mistral/mistral-large-latest
    # llm: ollama/llama3:70b
    # llm: groq/llama-3.2-90b-vision-preview
    # llm: watsonx/meta-llama/llama-3-1-70b-instruct
    # llm: nvidia_nim/meta/llama3-70b-instruct
    # llm: sambanova/Meta-Llama-3.1-8B-Instruct
    # ...
1 Like

where is this list?

I have been looking at the docs, but I cannot find the canonical list that indicates the llm name LLMs - CrewAI

Here you go.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.