From e3887ae36e6f7c2d8da7a2ad44f33a457880379b Mon Sep 17 00:00:00 2001 From: Mark McDonald Date: Wed, 7 May 2025 23:30:27 +0800 Subject: [PATCH] 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 --- docs/guides/crews/first-crew.mdx | 16 +++++++++------- docs/guides/flows/first-flow.mdx | 23 +++++++++++++++++------ docs/quickstart.mdx | 5 +++-- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/docs/guides/crews/first-crew.mdx b/docs/guides/crews/first-crew.mdx index 8eb2619d1..db770c0de 100644 --- a/docs/guides/crews/first-crew.mdx +++ b/docs/guides/crews/first-crew.mdx @@ -35,7 +35,8 @@ Let's get started building your first crew! Before starting, make sure you have: 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 ## 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 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 # src/research_crew/config/agents.yaml @@ -107,7 +109,7 @@ researcher: finding relevant information from various sources. You excel at organizing information in a clear and structured manner, making 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: role: > @@ -120,7 +122,7 @@ analyst: and technical writing. You have a talent for identifying patterns and extracting meaningful insights from research data, then 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. @@ -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: -``` -OPENAI_API_KEY=your_openai_api_key +```sh 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 diff --git a/docs/guides/flows/first-flow.mdx b/docs/guides/flows/first-flow.mdx index d5784f0a9..fab6f8e42 100644 --- a/docs/guides/flows/first-flow.mdx +++ b/docs/guides/flows/first-flow.mdx @@ -45,7 +45,8 @@ Let's dive in and build your first flow! Before starting, make sure you have: 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 ## 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: + Remember to set `llm` to the provider you are using. + ```yaml # src/guide_creator_flow/crews/content_crew/config/agents.yaml content_writer: @@ -119,7 +122,7 @@ content_writer: You are a talented educational writer with expertise in creating clear, engaging content. You have a gift for explaining complex concepts in accessible language 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: role: > @@ -132,7 +135,7 @@ content_reviewer: content. You have an eye for detail, clarity, and coherence. You excel at improving content while maintaining the original author's voice and ensuring 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. @@ -441,10 +444,15 @@ This is the power of flows - combining different types of processing (user inter ## 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 +# or +GEMINI_API_KEY=your_gemini_api_key +# or +ANTHROPIC_API_KEY=your_anthropic_api_key ``` ## 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: ```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) ``` diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx index 1f773fb23..b9f04dba4 100644 --- a/docs/quickstart.mdx +++ b/docs/quickstart.mdx @@ -180,8 +180,9 @@ Follow the steps below to get Crewing! 🚣‍♂️ 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` + - 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. - 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 backstory: > 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 ```