|
from langchain.tools import DuckDuckGoSearchRun |
|
from crewai_tools import tool |
|
import streamlit as st |
|
@tool('DuckDuckGoSearch') |
|
def search(search_query:str): |
|
"""Search the web for the topic""" |
|
return DuckDuckGoSearchRun().run(search_query) |
|
import os |
|
from crewai import Agent,Task,Crew,Process |
|
import google.generativeai as genai |
|
from langchain_google_genai import ChatGoogleGenerativeAI |
|
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY") |
|
llm=ChatGoogleGenerativeAI(model="gemini-pro", |
|
verbose = True, |
|
temperature = 0.2, |
|
google_api_key=GOOGLE_API_KEY) |
|
researcher = Agent( |
|
role='Senior AI Researcher', |
|
goal='Uncover groundbreaking technologies in field of AI Agents and their different frameworks and AGI', |
|
verbose=False, |
|
backstory=( |
|
"Driven by curiosity, you're at the forefront of AI Agents and AGI and the" |
|
"innovation, eager to explore and share knowledge that could change" |
|
"the world." |
|
"You are extremly curious of AI agent building and want to explore" |
|
"the research done in Agent buiding and frameworks available like AutoGen and CrewAI." |
|
), |
|
tools=[search], |
|
allow_delegation=False, |
|
llm = llm |
|
) |
|
|
|
writer = Agent( |
|
role='Research Paper writer and AI influencer blog writer', |
|
goal='Narrate compelling frameworks and latest updates about AI Agents and the research and their different frameworks and AGI', |
|
verbose=True, |
|
backstory=( |
|
"With a flair for simplifying complex topics, you craft" |
|
"engaging narratives that captivate and educate, bringing new" |
|
"discoveries to light in an accessible manner." |
|
), |
|
tools=[search], |
|
allow_delegation=True, |
|
llm = llm) |
|
|
|
research_task = Task( |
|
description=( |
|
"Focus on identifying frameworks in Agents and how can we use them in building gen ai powered apps." |
|
"Your final report should clearly articulate the key points like top options available with links to access them," |
|
"its learning opportunities, and free research papers with links." |
|
"Use limkenin posts, research paper websites and google searches to identify the required information." |
|
), |
|
expected_output='A comprehensive 3 paragraphs long report on the latest Agents trends and frameworks and research paper links.', |
|
tools=[search], |
|
agent=researcher, |
|
) |
|
|
|
write_task = Task( |
|
description=( |
|
"Compose an insightful article on AI Agents and the research and their different frameworks and AGI." |
|
"Focus on the latest AI agents and the frameworks and how it can be used to build ai apps." |
|
"This article should be easy to understand, engaging, and positive." |
|
"It should include points with links to access the resources." |
|
), |
|
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.', |
|
tools=[search], |
|
agent=writer |
|
) |
|
|
|
crew = Crew( |
|
agents=[researcher, writer], |
|
tasks=[research_task, write_task], |
|
process=Process.sequential |
|
|
|
) |
|
|
|
|
|
|
|
|
|
st.title("AI Research Agent") |
|
|
|
st.write("Question: What are AI Agents and what are the latest trends and research related to them?") |
|
|
|
if st.button("Run"): |
|
with st.spinner("Running the crew..."): |
|
results=crew.kickoff() |
|
st.success("Crew execution finished!") |
|
st.write(results) |