mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
Proper README example (#48)
This commit is contained in:
50
README.md
50
README.md
@@ -34,32 +34,59 @@ pip install crewai
|
|||||||
|
|
||||||
2. **Setting Up Your Crew**:
|
2. **Setting Up Your Crew**:
|
||||||
|
|
||||||
|
```python
|
||||||
```python
|
```python
|
||||||
import os
|
import os
|
||||||
from crewai import Agent, Task, Crew, Process
|
from crewai import Agent, Task, Crew, Process
|
||||||
|
|
||||||
os.environ["OPENAI_API_KEY"] = "Your Key"
|
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
|
# Define your agents with roles and goals
|
||||||
researcher = Agent(
|
researcher = Agent(
|
||||||
role='Researcher',
|
role='Senior Research Analyst',
|
||||||
goal='Discover new insights',
|
goal='Uncover cutting-edge developments in AI and data science in',
|
||||||
backstory="You're a world class researcher working on a major data science company",
|
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,
|
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
|
# llm=OpenAI(temperature=0.7, model_name="gpt-4"). It uses langchain.chat_models, default is GPT4
|
||||||
)
|
)
|
||||||
writer = Agent(
|
writer = Agent(
|
||||||
role='Writer',
|
role='Tech Content Strategist',
|
||||||
goal='Create engaging content',
|
goal='Craft compelling content on tech advancements',
|
||||||
backstory="You're a famous technical writer, specialized on writing data related content",
|
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,
|
verbose=True,
|
||||||
allow_delegation=False
|
allow_delegation=True
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create tasks for your agents
|
# Create tasks for your agents
|
||||||
task1 = Task(description='Search and investigate the latest AI trends', agent=researcher)
|
task1 = Task(
|
||||||
task2 = Task(description='Write a blog post on AI advancements', agent=writer)
|
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
|
# Instantiate your crew with a sequential process
|
||||||
crew = Crew(
|
crew = Crew(
|
||||||
@@ -71,6 +98,9 @@ crew = Crew(
|
|||||||
|
|
||||||
# Get your crew to work!
|
# Get your crew to work!
|
||||||
result = crew.kickoff()
|
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.
|
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.
|
||||||
|
|||||||
Reference in New Issue
Block a user