Skip to content

Commit 8b2951e

Browse files
committed
Final AI Agent Implementation
1 parent ac705b0 commit 8b2951e

File tree

6 files changed

+31
-16
lines changed

6 files changed

+31
-16
lines changed

backend/EduAssistant_Agents/agent.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
),
99
instruction=(
1010
"You are the Quizzes Agent responsible for generating MCQ questions with 4 options and answers of the content provided to you by the Manager Agent. Also you are to return this output back to the manager agent."
11-
)
11+
),
12+
output_key="quiz"
1213
)
1314

1415
summarizer_agent = Agent(
@@ -27,31 +28,34 @@
2728
- Structure summaries logically with clear headings when appropriate
2829
2930
When given content, analyze it thoroughly and provide a well-structured summary that captures the essential information in a clear, academic style."""
30-
)
31+
),
32+
output_key="summary"
3133
)
3234

3335
reference_agent = Agent(
3436
name="Reference_Agent",
3537
model="gemini-2.0-flash",
3638
description=(
37-
"This is an AI agent which is responsible for extracting relevant references or citations from the content provided to it."
39+
"This is an AI agent which is responsible for giving relevant references or citations related to the content provided to it."
3840
),
3941
instruction=(
40-
"""You are a Reference Extraction Agent specialized in identifying and extracting citations, references, and source materials from educational content.
42+
"""You are a Reference Agent specialized in identifying the content and giving relavent citations, references, and source materials from educational content.
4143
4244
Your role:
43-
- Scan content for all types of references including:
45+
- Provide all types of references relavant to the content including:
4446
* Academic citations (APA, MLA, Chicago, etc.)
4547
* URLs and web links
48+
* PDFs and other documents
49+
* Images and other media
4650
* Book titles and authors
4751
* Journal articles and papers
4852
* Document titles and section references
49-
* Footnotes and endnotes
5053
- Format extracted references clearly and organized
5154
- Include page numbers, dates, and other citation details when available
5255
5356
Provide a comprehensive list of all references related to the content provided to you."""
54-
)
57+
),
58+
output_key="references"
5559
)
5660

5761
flash_card_agent = Agent(
@@ -70,7 +74,8 @@
7074
- Cover all important topics from the provided content
7175
7276
Create comprehensive flashcards that facilitate active recall and help students understand key concepts."""
73-
)
77+
),
78+
output_key="flashcards"
7479
)
7580

7681
root_agent = Agent(
@@ -101,5 +106,5 @@
101106
102107
When users ask for specific functions, delegate to the appropriate agent and provide the results in a clear, helpful format asked by the user."""
103108
),
104-
sub_agents=[quizzes_agent, reference_agent, flash_card_agent, summarizer_agent]
109+
sub_agents=[quizzes_agent, reference_agent, flash_card_agent, summarizer_agent],
105110
)

frontend/Pipfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
8+
[dev-packages]
9+
10+
[requires]
11+
python_version = "3.13"

frontend/src/ai/flows/generate-flashcards.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export async function generateFlashcards(input: GenerateFlashcardsInput): Promis
3939
const ADK_URL = process.env.NEXT_PUBLIC_AGENT_API_URL || "http://localhost:8000";
4040
try {
4141
const { user, signOut } = useAuth();
42-
const userId = user || 'u_123'; // TODO: Get from AuthContext
42+
const userId = user?.email || 'u_123'; // TODO: Get from AuthContext
4343
const sessionId = localStorage.getItem('sessionId') || 's_' + Math.random().toString(36).substr(2, 9);
4444

4545
const res = await fetch(`${ADK_URL}/run`, {

frontend/src/ai/flows/generate-quizzes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export async function generateQuizzes(
4444
try {
4545
const { user, signOut } = useAuth();
4646

47-
const userId = user || 'u_123'; // TODO: Get from AuthContext
47+
const userId = user?.email || 'u_123'; // TODO: Get from AuthContext
4848
const sessionId = localStorage.getItem('sessionId') || 's_' + Math.random().toString(36).substr(2, 9);
4949

5050
const res = await fetch(`${ADK_URL}/run`, {

frontend/src/ai/flows/suggest-resources.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export async function suggestResources(input: SuggestResourcesInput): Promise<Su
3434
const ADK_URL = process.env.NEXT_PUBLIC_AGENT_API_URL || "http://localhost:8000";
3535
try {
3636
const { user, signOut } = useAuth();
37-
const userId = user || 'u_123'; // TODO: Get from AuthContext
37+
const userId = user?.email || 'u_123';
3838
const sessionId = localStorage.getItem('sessionId') || 's_' + Math.random().toString(36).substr(2, 9);
3939

4040
const res = await fetch(`${ADK_URL}/run`, {
@@ -47,7 +47,7 @@ export async function suggestResources(input: SuggestResourcesInput): Promise<Su
4747
newMessage: {
4848
role: "user",
4949
parts: [{
50-
text: `Suggest 3-5 relevant study resources for this content. For each resource, provide a title, URL, and a brief reason why it's relevant. Format your response as a JSON array of objects with 'title' (string), 'url' (string, must be a valid URL), and 'reason' (string) fields. Here's the content: ${input.courseContent}\n\nFormat your response like this: [{\"title\": \"...\", \"url\": \"https://...\", \"reason\": \"...\"}]`
50+
text: `Suggest 3-5 relevant references for this content. For each resource, provide a title, URL, and a brief reason why it's relevant. Format your response as a JSON array of objects with 'title' (string), 'url' (string, must be a valid URL), and 'reason' (string) fields. Here's the content: ${input.courseContent}\n\nFormat your response like this: [{\"title\": \"...\", \"url\": \"https://...\", \"reason\": \"...\"}]`
5151
}]
5252
}
5353
})

frontend/src/app/dashboard/page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ export default function DashboardPage() {
4646
},
4747
];
4848

49-
const userID = user || 'u_123';
49+
const userID = user?.email || 'u_123';
5050
const sessionId = localStorage.getItem('sessionId') || 's_' + Math.random().toString(36).substr(2, 9);
5151

52-
5352
const makeSession = async () => {
5453
const session = await fetch('http://localhost:8000/apps/EduAssistant_Agents/users/' + userID + '/sessions/' + sessionId, {
5554
method: 'POST',
@@ -68,7 +67,7 @@ export default function DashboardPage() {
6867
throw new Error('Failed to create session');
6968
}
7069

71-
const session_id = (await session.json()).session_id;
70+
const session_id = sessionId;
7271
localStorage.setItem('session_id', session_id);
7372
console.log(session_id);
7473
}

0 commit comments

Comments
 (0)