Chandranshu Jain
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,68 @@ import os
|
|
| 8 |
from crewai import Agent,Task,Crew,Process
|
| 9 |
import google.generativeai as genai
|
| 10 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
|
|
|
| 11 |
llm=ChatGoogleGenerativeAI(model="gemini-pro",
|
| 12 |
verbose = True,
|
| 13 |
temperature = 0.2,
|
| 14 |
-
google_api_key=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
from crewai import Agent,Task,Crew,Process
|
| 9 |
import google.generativeai as genai
|
| 10 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 11 |
+
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
| 12 |
llm=ChatGoogleGenerativeAI(model="gemini-pro",
|
| 13 |
verbose = True,
|
| 14 |
temperature = 0.2,
|
| 15 |
+
google_api_key=GOOGLE_API_KEY)
|
| 16 |
+
researcher = Agent(
|
| 17 |
+
role='Senior AI Researcher',
|
| 18 |
+
goal='Uncover groundbreaking technologies in field of AI Agents and their different frameworks and AGI',
|
| 19 |
+
verbose=False,
|
| 20 |
+
backstory=(
|
| 21 |
+
"Driven by curiosity, you're at the forefront of AI Agents and AGI and the"
|
| 22 |
+
"innovation, eager to explore and share knowledge that could change"
|
| 23 |
+
"the world."
|
| 24 |
+
"You are extremly curious of AI agent building and want to explore"
|
| 25 |
+
"the research done in Agent buiding and frameworks available like AutoGen and CrewAI."
|
| 26 |
+
),
|
| 27 |
+
tools=[search],
|
| 28 |
+
allow_delegation=False,
|
| 29 |
+
llm = llm
|
| 30 |
+
)
|
| 31 |
+
# Creating a writer agent with custom tools and delegation capability
|
| 32 |
+
writer = Agent(
|
| 33 |
+
role='Research Paper writer and AI influencer blog writer',
|
| 34 |
+
goal='Narrate compelling frameworks and latest updates about AI Agents and the research and their different frameworks and AGI',
|
| 35 |
+
verbose=True,
|
| 36 |
+
backstory=(
|
| 37 |
+
"With a flair for simplifying complex topics, you craft"
|
| 38 |
+
"engaging narratives that captivate and educate, bringing new"
|
| 39 |
+
"discoveries to light in an accessible manner."
|
| 40 |
+
),
|
| 41 |
+
tools=[search],
|
| 42 |
+
allow_delegation=True,
|
| 43 |
+
llm = llm)
|
| 44 |
+
# Research task
|
| 45 |
+
research_task = Task(
|
| 46 |
+
description=(
|
| 47 |
+
"Focus on identifying frameworks in Agents and how can we use them in building gen ai powered apps."
|
| 48 |
+
"Your final report should clearly articulate the key points like top options available with links to access them,"
|
| 49 |
+
"its learning opportunities, and free research papers with links."
|
| 50 |
+
"Use limkenin posts, research paper websites and google searches to identify the required information."
|
| 51 |
+
),
|
| 52 |
+
expected_output='A comprehensive 3 paragraphs long report on the latest Agents trends and frameworks and research paper links.',
|
| 53 |
+
tools=[search],
|
| 54 |
+
agent=researcher,
|
| 55 |
+
)
|
| 56 |
+
# Writing task with language model configuration
|
| 57 |
+
write_task = Task(
|
| 58 |
+
description=(
|
| 59 |
+
"Compose an insightful article on AI Agents and the research and their different frameworks and AGI."
|
| 60 |
+
"Focus on the latest AI agents and the frameworks and how it can be used to build ai apps."
|
| 61 |
+
"This article should be easy to understand, engaging, and positive."
|
| 62 |
+
"It should include points with links to access the resources."
|
| 63 |
+
),
|
| 64 |
+
expected_output='A short article on AI Agents and the research and their different frameworks and AGI advancements formatted as markdown.Try to include a research paper name.',
|
| 65 |
+
tools=[search],
|
| 66 |
+
agent=writer
|
| 67 |
+
)
|
| 68 |
+
# Forming the tech-focused crew with some enhanced configurations
|
| 69 |
+
crew = Crew(
|
| 70 |
+
agents=[researcher, writer],
|
| 71 |
+
tasks=[research_task, write_task],
|
| 72 |
+
process=Process.sequential # Optional: Sequential task execution is default
|
| 73 |
+
|
| 74 |
+
)
|
| 75 |
+
results=crew.kickoff()
|