From 14a081b814aeafbf0d4034d33f1eb71c7e862561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moura?= Date: Thu, 4 Jan 2024 10:03:23 -0300 Subject: [PATCH] Proper README example (#48) --- README.md | 50 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 467560afa..4bf05a00f 100644 --- a/README.md +++ b/README.md @@ -34,32 +34,59 @@ pip install crewai 2. **Setting Up Your Crew**: +```python ```python import os from crewai import Agent, Task, Crew, Process os.environ["OPENAI_API_KEY"] = "Your Key" +# Define your tools, custom or not. +# Install duckduckgo-search for this example: +# +# !pip install -U duckduckgo-search +from langchain.tools import DuckDuckGoSearchRun +search_tool = DuckDuckGoSearchRun() + # Define your agents with roles and goals researcher = Agent( - role='Researcher', - goal='Discover new insights', - backstory="You're a world class researcher working on a major data science company", + role='Senior Research Analyst', + goal='Uncover cutting-edge developments in AI and data science in', + backstory="""You are a Senior Research Analyst at a leading tech think tank. + Your expertise lies in identifying emerging trends and technologies in AI and + data science. You have a knack for dissecting complex data and presenting + actionable insights.""", verbose=True, - allow_delegation=False + allow_delegation=False, + tools=[search_tool] # llm=OpenAI(temperature=0.7, model_name="gpt-4"). It uses langchain.chat_models, default is GPT4 ) writer = Agent( - role='Writer', - goal='Create engaging content', - backstory="You're a famous technical writer, specialized on writing data related content", + role='Tech Content Strategist', + goal='Craft compelling content on tech advancements', + backstory="""You are a renowned Tech Content Strategist, known for your insightful + and engaging articles on technology and innovation. With a deep understanding of + the tech industry, you transform complex concepts into compelling narratives.""", verbose=True, - allow_delegation=False + allow_delegation=True ) # Create tasks for your agents -task1 = Task(description='Search and investigate the latest AI trends', agent=researcher) -task2 = Task(description='Write a blog post on AI advancements', agent=writer) +task1 = Task( + description="""Conduct a comprehensive analysis of the latest advancements in AI in 2024. + Identify key trends, breakthrough technologies, and potential industry impacts. + Compile your findings in a detailed report.""", + agent=researcher +) + +task2 = Task( + description="""Using the insights from the researcher's report, develop an engaging blog + post that highlights the most significant AI advancements. + Your post should be informative yet accessible, catering to a tech-savvy audience. + Aim for a narrative that captures the essence of these breakthroughs and their + implications for the future.""", + agent=writer +) # Instantiate your crew with a sequential process crew = Crew( @@ -71,6 +98,9 @@ crew = Crew( # Get your crew to work! result = crew.kickoff() + +print("######################") +print(result) ``` Currently the only supported process is `Process.sequential`, where one task is executed after the other and the outcome of one is passed as extra content into this next.