File size: 2,607 Bytes
d9e3edb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | from crewai import Agent
from dotenv import load_dotenv
from agents_rag.tools import tool
load_dotenv()
import os
from langchain_google_genai import ChatGoogleGenerativeAI
## call the gemini models
llm = ChatGoogleGenerativeAI(
model="gemini-2.0-flash-exp",
verbose=True,
temperature=0.5,
google_api_key=os.getenv("GEMINI_API_KEY"),
)
# Creating a senior researcher agent with memory and verbose mode
news_researcher = Agent(
role="Senior Researcher",
goal="Unccover ground breaking technologies in {topic}",
verbose=True,
memory=True,
backstory=(
"Driven by curiosity, you're at the forefront of"
"innovation, eager to explore and share knowledge that could change"
"the world."
),
tools=[tool],
llm=llm,
allow_delegation=True,
)
## creating a write agent with custom tools responsible in writing news blog
news_writer = Agent(
role="Writer",
goal="Narrate compelling tech stories about {topic}",
verbose=True,
memory=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=[tool],
llm=llm,
allow_delegation=False,
)
writer_rag = Agent(
role="Query Answerer using Web Search",
goal="Create comprehensive and well-structured answers to given queries based on web search content.",
backstory=(
"Specialized in synthesizing information from multiple sources into "
"coherent and engaging content while maintaining accuracy."
),
tools=[tool], # Ensure 'tool' is suitable for web search tasks
llm=llm, # Ensure 'llm' is configured for this agent's needs
verbose=True,
memory=True,
allow_delegation=False,
)
rag_agent = Agent(
role="RAG agent that answer of given query in quick manner along with citation using provided context only don't search on only of you don't found relvatent context then denie to give answer and also answer give in given format",
goal="Create comprehensive and well-structured answers to given queries with citation based on given context only and also give the answer in given format.",
backstory=(
"Specialized in synthesizing information from multiple sources into "
"coherent and engaging content while maintaining accuracy."
), # Ensure 'tool' is suitable for web search tasks
llm=llm, # Ensure 'llm' is configured for this agent's needs
verbose=True,
memory=True,
allow_delegation=False,
)
|