You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
!pip install --q crewai
!pip install --q -U duckduckgo-search
!pip install --q langchain_google_genai
import os
from langchain_google_genai import ChatGoogleGenerativeAI
from crewai import Agent, Task, Crew, Process
# Set gemini pro as llm
llm = ChatGoogleGenerativeAI(model="gemini-pro",
verbose = True,
temperature = 0.6,
google_api_key="")
llm
# Make sure to 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='Senior Research Analyst',
goal='Uncover cutting-edge developments in AI and data science',
backstory="""You work at a leading tech think tank.
Your expertise lies in identifying emerging trends.
You have a knack for dissecting complex data and presenting
actionable insights.""",
verbose=True,
llm = llm, #using google gemini pro API
tools=[
search_tool
]
)
writer = Agent(
role='Tech Content Strategist',
goal='Craft compelling content on tech advancements',
backstory="""You are a renowned Content Strategist, known for
your insightful and engaging articles.
You transform complex concepts into compelling narratives.""",
verbose=True,
llm = llm
)
# Create tasks for your agents
task1 = Task(
description="""Conduct a comprehensive analysis of the latest advancements in AI in 2024.
Identify key trends, breakthrough technologies, and potential industry impacts.
Your final answer MUST be a full analysis report""",
expected_output='A bullet list summary of the top 5 most important AI news',
async_execution=True,
agent=researcher,
tools=[],
)
task2 = Task(
description="""Using the insights provided, 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.
Make it sound cool, avoid complex words so it doesn't sound like AI.
Your final answer MUST be the full blog post of at least 4 paragraphs.""",
expected_output='A bullet list summary of the top 5 most important AI news',
async_execution=True,
agent=researcher,
tools=[]
)
# Instantiate your crew with a sequential process
crew = Crew(
agents=[researcher, writer],
tasks=[task1, task2],
verbose=2, # You can set it to 1 or 2 to different logging levels
)
crew
# Get your crew to work!
result = crew.kickoff()
[DEBUG]: == Working Agent: Senior Research Analyst
[INFO]: == Starting Task: Conduct a comprehensive analysis of the latest advancements in AI in 2024.
Identify key trends, breakthrough technologies, and potential industry impacts.
Your final answer MUST be a full analysis report
[DEBUG]: == [Senior Research Analyst] Task output:
[DEBUG]: == Working Agent: Senior Research Analyst
[INFO]: == Starting Task: Using the insights provided, 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.
Make it sound cool, avoid complex words so it doesn't sound like AI.
Your final answer MUST be the full blog post of at least 4 paragraphs.
[DEBUG]: == [Senior Research Analyst] Task output:
> Entering new CrewAgentExecutor chain...
> Entering new CrewAgentExecutor chain...
print(result)
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: