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
Copy file name to clipboardExpand all lines: backend/EduAssitant_Agents/agent.py
+58-55Lines changed: 58 additions & 55 deletions
Original file line number
Diff line number
Diff line change
@@ -1,66 +1,69 @@
1
-
importdatetime
2
-
fromzoneinfoimportZoneInfo
3
1
fromgoogle.adk.agentsimportAgent, LoopAgent
2
+
fromgoogle.adk.toolsimportgoogle_search
4
3
5
-
defget_weather(city: str) ->dict:
6
-
"""Retrieves the current weather report for a specified city.
7
-
8
-
Args:
9
-
city (str): The name of the city for which to retrieve the weather report.
10
-
11
-
Returns:
12
-
dict: status and result or error msg.
13
-
"""
14
-
ifcity.lower() =="new york":
15
-
return {
16
-
"status": "success",
17
-
"report": (
18
-
"The weather in New York is sunny with a temperature of 25 degrees"
19
-
" Celsius (77 degrees Fahrenheit)."
20
-
),
21
-
}
22
-
else:
23
-
return {
24
-
"status": "error",
25
-
"error_message": f"Weather information for '{city}' is not available.",
26
-
}
27
-
28
-
29
-
defget_current_time(city: str) ->dict:
30
-
"""Returns the current time in a specified city.
31
-
32
-
Args:
33
-
city (str): The name of the city for which to retrieve the current time.
34
-
35
-
Returns:
36
-
dict: status and result or error msg.
37
-
"""
4
+
summarizer_agent=Agent(
5
+
name="Summarizer_Agent",
6
+
model="gemini-2.0-flash",
7
+
description=(
8
+
"You are a Summarizer Agent operating under the control of a Manager Agent in a multi-agent system. Your sole purpose is to generate concise, accurate, and coherent summaries from the content provided to you."
9
+
),
10
+
instruction=(
11
+
"You are the Summarizer Agent responsible for generating accurate, concise summaries of the content provided to you by the Manager Agent. Also you are to return this output back to the manager agent."
12
+
)
13
+
)
38
14
39
-
ifcity.lower() =="new york":
40
-
tz_identifier="America/New_York"
41
-
else:
42
-
return {
43
-
"status": "error",
44
-
"error_message": (
45
-
f"Sorry, I don't have timezone information for {city}."
46
-
),
47
-
}
15
+
reference_agent=Agent(
16
+
name="Reference_Agent",
17
+
model="gemini-2.0-flash",
18
+
description=(
19
+
"This is an AI agent which is responsible for extracting relevant references or citations from the content provided to it."
20
+
),
21
+
instruction=(
22
+
"""You are a Reference Extraction Agent working under a Manager Agent in a multi-agent system.
23
+
Your primary responsibility is to carefully scan the provided content and extract all relevant references or citations strictly from this content. These may include:
48
24
49
-
tz=ZoneInfo(tz_identifier)
50
-
now=datetime.datetime.now(tz)
51
-
report= (
52
-
f'The current time in {city} is {now.strftime("%Y-%m-%d %H:%M:%S %Z%z")}'
25
+
- Document titles
26
+
- Section or subsection headings/numbers
27
+
- In-text citations
28
+
- Footnotes
29
+
- Bibliographic references
30
+
- URLs or document links
31
+
- Mentioned papers, books, articles, datasets, standards, or guidelines
32
+
- Any internal or external reference points stated in the content
33
+
34
+
35
+
Also you are to return this output back to the manager agent."""
53
36
)
54
-
return {"status": "success", "report": report}
37
+
)
55
38
56
-
summarizer_agent=Agent(
57
-
name="Summarizer_Agent",
39
+
flash_card_agent=Agent(
40
+
name="Flash_Card_Agent",
58
41
model="gemini-2.0-flash",
59
42
description=(
60
-
"You are a Summarizer Agent operating under the control of a Manager Agent in a multi-agent system. Your sole purpose is to generate concise, accurate, and coherent summaries from the content provided to you."
43
+
"This is an AI agent which is responsible for generating flash cards from the content provided to it."
61
44
),
62
45
instruction=(
63
-
"You are the Summarizer Agent responsible for generating accurate, concise summaries of the content provided by the Manager Agent."
46
+
"""You are a Flashcard Generation Agent working under the Manager Agent in a multi-agent system.
47
+
Your primary responsibility is to generate a list of question-answer flashcards designed to aid in the quick revision of the concepts, facts, and ideas present in the provided content.
48
+
49
+
These flashcards are intended to cover all critical points, definitions, formulas, principles, processes, or factual data contained within the content.
50
+
You must not use any outside knowledge, assumptions, or inference beyond what is present in the provided material.
51
+
52
+
You are to return the flashcards in a json format with the following structure:
53
+
{
54
+
"flashcards": [
55
+
{
56
+
"question": "Question 1",
57
+
"answer": "Answer 1"
58
+
},
59
+
{
60
+
"question": "Question 2",
61
+
"answer": "Answer 2"
62
+
}
63
+
]
64
+
}
65
+
66
+
Also you are to return this output back to the manager agent."""
"This AI agent functions as an orchestrator and coordinator in a multi-agent system designed to answer queries based on domain-specific content provided to it. Its primary role is to manage the interactions between multiple specialized agents and ensure accurate, context-aware, and efficient responses to user queries."
72
75
),
73
76
instruction=(
74
-
"You are the Manager Agent responsible for managing and directing a set of specialized AI sub-agents. Your purpose is to answer user queries solely based on the content provided to you, ensuring accuracy, relevance, and clarity."
77
+
"You are the Manager Agent responsible for managing and directing a set of specialized AI sub-agents. Your purpose is to answer user queries solely based on the content provided to you, ensuring accuracy, relevance, and clarity. You are also responsible for giving the output to the user in whatever structure it desires be it json or pdf or any other format."
0 commit comments