Used model-agnostic examples in quickstart/firsts. (#2773)

Updated prereqs and setup steps to point to the now-more-model-agnostic
LLM setup guide, and updated the relevant text to go with it.

Co-authored-by: Tony Kipkemboi <iamtonykipkemboi@gmail.com>
This commit is contained in:
Mark McDonald
2025-05-07 23:30:27 +08:00
committed by GitHub
parent e23bc2aaa7
commit e3887ae36e
3 changed files with 29 additions and 15 deletions

View File

@@ -35,7 +35,8 @@ Let's get started building your first crew!
Before starting, make sure you have: Before starting, make sure you have:
1. Installed CrewAI following the [installation guide](/installation) 1. Installed CrewAI following the [installation guide](/installation)
2. Set up your OpenAI API key in your environment variables 2. Set up your LLM API key in your environment, following the [LLM setup
guide](/concepts/llms#setting-up-your-llm)
3. Basic understanding of Python 3. Basic understanding of Python
## Step 1: Create a New CrewAI Project ## Step 1: Create a New CrewAI Project
@@ -92,7 +93,8 @@ For our research crew, we'll create two agents:
1. A **researcher** who excels at finding and organizing information 1. A **researcher** who excels at finding and organizing information
2. An **analyst** who can interpret research findings and create insightful reports 2. An **analyst** who can interpret research findings and create insightful reports
Let's modify the `agents.yaml` file to define these specialized agents: Let's modify the `agents.yaml` file to define these specialized agents. Be sure
to set `llm` to the provider you are using.
```yaml ```yaml
# src/research_crew/config/agents.yaml # src/research_crew/config/agents.yaml
@@ -107,7 +109,7 @@ researcher:
finding relevant information from various sources. You excel at finding relevant information from various sources. You excel at
organizing information in a clear and structured manner, making organizing information in a clear and structured manner, making
complex topics accessible to others. complex topics accessible to others.
llm: openai/gpt-4o-mini llm: provider/model-id # e.g. openai/gpt-4o, google/gemini-2.0-flash, anthropic/claude...
analyst: analyst:
role: > role: >
@@ -120,7 +122,7 @@ analyst:
and technical writing. You have a talent for identifying patterns and technical writing. You have a talent for identifying patterns
and extracting meaningful insights from research data, then and extracting meaningful insights from research data, then
communicating those insights effectively through well-crafted reports. communicating those insights effectively through well-crafted reports.
llm: openai/gpt-4o-mini llm: provider/model-id # e.g. openai/gpt-4o, google/gemini-2.0-flash, anthropic/claude...
``` ```
Notice how each agent has a distinct role, goal, and backstory. These elements aren't just descriptive - they actively shape how the agent approaches its tasks. By crafting these carefully, you can create agents with specialized skills and perspectives that complement each other. Notice how each agent has a distinct role, goal, and backstory. These elements aren't just descriptive - they actively shape how the agent approaches its tasks. By crafting these carefully, you can create agents with specialized skills and perspectives that complement each other.
@@ -282,12 +284,12 @@ This script prepares the environment, specifies our research topic, and kicks of
Create a `.env` file in your project root with your API keys: Create a `.env` file in your project root with your API keys:
``` ```sh
OPENAI_API_KEY=your_openai_api_key
SERPER_API_KEY=your_serper_api_key SERPER_API_KEY=your_serper_api_key
# Add your provider's API key here too.
``` ```
You can get a Serper API key from [Serper.dev](https://serper.dev/). See the [LLM Setup guide](/concepts/llms#setting-up-your-llm) for details on configuring your provider of choice. You can get a Serper API key from [Serper.dev](https://serper.dev/).
## Step 8: Install Dependencies ## Step 8: Install Dependencies

View File

@@ -45,7 +45,8 @@ Let's dive in and build your first flow!
Before starting, make sure you have: Before starting, make sure you have:
1. Installed CrewAI following the [installation guide](/installation) 1. Installed CrewAI following the [installation guide](/installation)
2. Set up your OpenAI API key in your environment variables 2. Set up your LLM API key in your environment, following the [LLM setup
guide](/concepts/llms#setting-up-your-llm)
3. Basic understanding of Python 3. Basic understanding of Python
## Step 1: Create a New CrewAI Flow Project ## Step 1: Create a New CrewAI Flow Project
@@ -107,6 +108,8 @@ Now, let's modify the generated files for the content writer crew. We'll set up
1. First, update the agents configuration file to define our content creation team: 1. First, update the agents configuration file to define our content creation team:
Remember to set `llm` to the provider you are using.
```yaml ```yaml
# src/guide_creator_flow/crews/content_crew/config/agents.yaml # src/guide_creator_flow/crews/content_crew/config/agents.yaml
content_writer: content_writer:
@@ -119,7 +122,7 @@ content_writer:
You are a talented educational writer with expertise in creating clear, engaging You are a talented educational writer with expertise in creating clear, engaging
content. You have a gift for explaining complex concepts in accessible language content. You have a gift for explaining complex concepts in accessible language
and organizing information in a way that helps readers build their understanding. and organizing information in a way that helps readers build their understanding.
llm: openai/gpt-4o-mini llm: provider/model-id # e.g. openai/gpt-4o, google/gemini-2.0-flash, anthropic/claude...
content_reviewer: content_reviewer:
role: > role: >
@@ -132,7 +135,7 @@ content_reviewer:
content. You have an eye for detail, clarity, and coherence. You excel at content. You have an eye for detail, clarity, and coherence. You excel at
improving content while maintaining the original author's voice and ensuring improving content while maintaining the original author's voice and ensuring
consistent quality across multiple sections. consistent quality across multiple sections.
llm: openai/gpt-4o-mini llm: provider/model-id # e.g. openai/gpt-4o, google/gemini-2.0-flash, anthropic/claude...
``` ```
These agent definitions establish the specialized roles and perspectives that will shape how our AI agents approach content creation. Notice how each agent has a distinct purpose and expertise. These agent definitions establish the specialized roles and perspectives that will shape how our AI agents approach content creation. Notice how each agent has a distinct purpose and expertise.
@@ -441,10 +444,15 @@ This is the power of flows - combining different types of processing (user inter
## Step 6: Set Up Your Environment Variables ## Step 6: Set Up Your Environment Variables
Create a `.env` file in your project root with your API keys: Create a `.env` file in your project root with your API keys. See the [LLM setup
guide](/concepts/llms#setting-up-your-llm) for details on configuring a provider.
``` ```sh .env
OPENAI_API_KEY=your_openai_api_key OPENAI_API_KEY=your_openai_api_key
# or
GEMINI_API_KEY=your_gemini_api_key
# or
ANTHROPIC_API_KEY=your_anthropic_api_key
``` ```
## Step 7: Install Dependencies ## Step 7: Install Dependencies
@@ -547,7 +555,10 @@ Let's break down the key components of flows to help you understand how to build
Flows allow you to make direct calls to language models when you need simple, structured responses: Flows allow you to make direct calls to language models when you need simple, structured responses:
```python ```python
llm = LLM(model="openai/gpt-4o-mini", response_format=GuideOutline) llm = LLM(
model="model-id-here", # gpt-4o, gemini-2.0-flash, anthropic/claude...
response_format=GuideOutline
)
response = llm.call(messages=messages) response = llm.call(messages=messages)
``` ```

View File

@@ -180,8 +180,9 @@ Follow the steps below to get Crewing! 🚣‍♂️
</Step> </Step>
<Step title="Set your environment variables"> <Step title="Set your environment variables">
Before running your crew, make sure you have the following keys set as environment variables in your `.env` file: Before running your crew, make sure you have the following keys set as environment variables in your `.env` file:
- An [OpenAI API key](https://platform.openai.com/account/api-keys) (or other LLM API key): `OPENAI_API_KEY=sk-...`
- A [Serper.dev](https://serper.dev/) API key: `SERPER_API_KEY=YOUR_KEY_HERE` - A [Serper.dev](https://serper.dev/) API key: `SERPER_API_KEY=YOUR_KEY_HERE`
- The configuration for your choice of model, such as an API key. See the
[LLM setup guide](/concepts/llms#setting-up-your-llm) to learn how to configure models from any provider.
</Step> </Step>
<Step title="Lock and install the dependencies"> <Step title="Lock and install the dependencies">
- Lock the dependencies and install them by using the CLI command: - Lock the dependencies and install them by using the CLI command:
@@ -317,7 +318,7 @@ email_summarizer:
Summarize emails into a concise and clear summary Summarize emails into a concise and clear summary
backstory: > backstory: >
You will create a 5 bullet point summary of the report You will create a 5 bullet point summary of the report
llm: openai/gpt-4o llm: provider/model-id # Add your choice of model here
``` ```
<Tip> <Tip>