Commit ·
17d2c0f
1
Parent(s): bde2aa2
Updated Agent-4
Browse files
app.py
CHANGED
|
@@ -22,6 +22,7 @@ from fastapi.responses import HTMLResponse
|
|
| 22 |
# Session State replacement
|
| 23 |
session_state = {
|
| 24 |
"data": None,
|
|
|
|
| 25 |
"full_roadmap": None,
|
| 26 |
"report_data": None,
|
| 27 |
"final_report": None,
|
|
@@ -43,6 +44,7 @@ async def lifespan(app: FastAPI):
|
|
| 43 |
session_state["dependencies"] = json.load(file)
|
| 44 |
# Process tasks as incomplete
|
| 45 |
process_task_data()
|
|
|
|
| 46 |
print("✅ Roadmaps loaded successfully.")
|
| 47 |
except Exception as e:
|
| 48 |
print(f"❌ Error loading roadmaps: {e}")
|
|
@@ -1629,134 +1631,135 @@ def agent3(query: str = Query(..., description="User's message to the chatbot"))
|
|
| 1629 |
}}
|
| 1630 |
|
| 1631 |
# --- AGENT 4: Accountability and Analysis Agent
|
| 1632 |
-
|
| 1633 |
-
|
| 1634 |
-
|
| 1635 |
-
|
| 1636 |
-
|
| 1637 |
-
|
| 1638 |
-
|
| 1639 |
-
|
| 1640 |
-
|
| 1641 |
-
|
| 1642 |
-
|
| 1643 |
-
|
| 1644 |
-
|
| 1645 |
-
|
| 1646 |
-
|
| 1647 |
-
|
| 1648 |
-
|
| 1649 |
-
|
| 1650 |
-
|
| 1651 |
-
|
| 1652 |
-
|
| 1653 |
-
|
| 1654 |
-
|
| 1655 |
-
|
| 1656 |
-
|
| 1657 |
-
|
| 1658 |
-
|
| 1659 |
-
|
| 1660 |
-
|
| 1661 |
-
|
| 1662 |
-
|
| 1663 |
-
|
| 1664 |
-
|
| 1665 |
-
|
| 1666 |
-
|
| 1667 |
-
|
| 1668 |
-
|
| 1669 |
-
|
| 1670 |
-
|
| 1671 |
-
|
| 1672 |
-
|
| 1673 |
-
|
| 1674 |
-
|
| 1675 |
-
|
| 1676 |
-
|
| 1677 |
-
|
| 1678 |
-
|
| 1679 |
-
|
| 1680 |
-
|
| 1681 |
-
|
| 1682 |
-
|
| 1683 |
-
|
| 1684 |
-
|
| 1685 |
-
|
| 1686 |
-
|
| 1687 |
-
|
| 1688 |
-
|
| 1689 |
-
|
| 1690 |
-
|
| 1691 |
-
|
| 1692 |
-
|
| 1693 |
-
|
| 1694 |
-
|
| 1695 |
-
|
| 1696 |
-
|
| 1697 |
-
|
| 1698 |
-
|
| 1699 |
-
|
| 1700 |
-
|
| 1701 |
-
|
| 1702 |
-
|
| 1703 |
-
|
| 1704 |
-
|
| 1705 |
-
|
| 1706 |
-
|
| 1707 |
-
|
| 1708 |
-
|
| 1709 |
-
|
| 1710 |
-
|
| 1711 |
-
|
| 1712 |
-
|
| 1713 |
-
|
| 1714 |
-
|
| 1715 |
-
|
| 1716 |
-
|
| 1717 |
-
|
| 1718 |
-
|
| 1719 |
-
|
| 1720 |
-
|
| 1721 |
-
|
| 1722 |
-
|
| 1723 |
-
|
| 1724 |
-
|
| 1725 |
-
|
| 1726 |
-
|
| 1727 |
-
|
| 1728 |
-
|
| 1729 |
-
|
| 1730 |
-
|
| 1731 |
-
|
| 1732 |
-
|
| 1733 |
-
|
| 1734 |
-
|
| 1735 |
-
|
| 1736 |
-
|
| 1737 |
-
|
| 1738 |
-
|
| 1739 |
-
|
| 1740 |
-
|
| 1741 |
-
|
| 1742 |
-
|
| 1743 |
-
|
| 1744 |
-
|
| 1745 |
-
|
| 1746 |
-
|
| 1747 |
-
|
| 1748 |
-
|
| 1749 |
-
|
| 1750 |
-
|
| 1751 |
-
|
| 1752 |
-
|
| 1753 |
-
|
| 1754 |
-
|
|
|
|
|
|
|
| 1755 |
|
| 1756 |
@app.get("/agent4")
|
| 1757 |
def agent4(
|
| 1758 |
-
|
| 1759 |
-
current_dayNumber: int = Query(2, description="Today's day number for scheduling tasks"),
|
| 1760 |
):
|
| 1761 |
"""
|
| 1762 |
Agent 4 - Accountability and Analysis Agent.
|
|
@@ -1765,7 +1768,7 @@ def agent4(
|
|
| 1765 |
before = session_state['updated_roadmap']
|
| 1766 |
else:
|
| 1767 |
before = session_state['data']
|
| 1768 |
-
ag4_update_roadmap(
|
| 1769 |
|
| 1770 |
return {
|
| 1771 |
"original_roadmap": before,
|
|
|
|
| 22 |
# Session State replacement
|
| 23 |
session_state = {
|
| 24 |
"data": None,
|
| 25 |
+
"test_results": None,
|
| 26 |
"full_roadmap": None,
|
| 27 |
"report_data": None,
|
| 28 |
"final_report": None,
|
|
|
|
| 44 |
session_state["dependencies"] = json.load(file)
|
| 45 |
# Process tasks as incomplete
|
| 46 |
process_task_data()
|
| 47 |
+
load_ag4_data()
|
| 48 |
print("✅ Roadmaps loaded successfully.")
|
| 49 |
except Exception as e:
|
| 50 |
print(f"❌ Error loading roadmaps: {e}")
|
|
|
|
| 1631 |
}}
|
| 1632 |
|
| 1633 |
# --- AGENT 4: Accountability and Analysis Agent
|
| 1634 |
+
def load_ag4_data():
|
| 1635 |
+
df = pd.DataFrame([
|
| 1636 |
+
{
|
| 1637 |
+
"Subject": "Physics",
|
| 1638 |
+
"Chapter": "Vectors",
|
| 1639 |
+
"Question Tag": "Concept Understanding",
|
| 1640 |
+
"Question Complexity": "Easy",
|
| 1641 |
+
"Question": "The vector projection of a vector on y-axis is",
|
| 1642 |
+
"Options Given": "(a) 5 (b) 4 (c) 3 (d) Zero",
|
| 1643 |
+
"Correct Option": "d",
|
| 1644 |
+
"Selected Option": "d",
|
| 1645 |
+
"Correct?": True,
|
| 1646 |
+
"ELO Score": 1200
|
| 1647 |
+
},
|
| 1648 |
+
{
|
| 1649 |
+
"Subject": "Physics",
|
| 1650 |
+
"Chapter": "Vectors",
|
| 1651 |
+
"Question Tag": "Concept Understanding",
|
| 1652 |
+
"Question Complexity": "Easy",
|
| 1653 |
+
"Question": "Position of a particle in a rectangular coordinate system is (3, 2, 5). Then its position vector will be",
|
| 1654 |
+
"Options Given": "(a) 3i + 2j + 5k (b) 2i + 3j + 5k (c) 5i + 2j + 3k (d) None of these",
|
| 1655 |
+
"Correct Option": "a",
|
| 1656 |
+
"Selected Option": "b",
|
| 1657 |
+
"Correct?": False,
|
| 1658 |
+
"ELO Score": 1170
|
| 1659 |
+
},
|
| 1660 |
+
{
|
| 1661 |
+
"Subject": "Physics",
|
| 1662 |
+
"Chapter": "Vectors",
|
| 1663 |
+
"Question Tag": "Question Practice",
|
| 1664 |
+
"Question Complexity": "Easy",
|
| 1665 |
+
"Question": "If a particle moves from point P (2,3,5) to point Q (3,4,5), its displacement vector is",
|
| 1666 |
+
"Options Given": "(a) i + j (b) i + j + k (c) 2i + 2j (d) None of these",
|
| 1667 |
+
"Correct Option": "a",
|
| 1668 |
+
"Selected Option": "a",
|
| 1669 |
+
"Correct?": True,
|
| 1670 |
+
"ELO Score": 1185
|
| 1671 |
+
},
|
| 1672 |
+
{
|
| 1673 |
+
"Subject": "Physics",
|
| 1674 |
+
"Chapter": "Vectors",
|
| 1675 |
+
"Question Tag": "Concept Understanding",
|
| 1676 |
+
"Question Complexity": "Medium",
|
| 1677 |
+
"Question": "A particle moving eastwards with 5 m/s. In 10 s the velocity changes to 5 m/s northwards. The average acceleration is",
|
| 1678 |
+
"Options Given": "(a) 1/2 m/s² NE (b) 1/2 m/s² North (c) 1/2 m/s² NW (d) Zero",
|
| 1679 |
+
"Correct Option": "a",
|
| 1680 |
+
"Selected Option": "a",
|
| 1681 |
+
"Correct?": True,
|
| 1682 |
+
"ELO Score": 1225
|
| 1683 |
+
},
|
| 1684 |
+
{
|
| 1685 |
+
"Subject": "Physics",
|
| 1686 |
+
"Chapter": "Vectors",
|
| 1687 |
+
"Question Tag": "Question Practice",
|
| 1688 |
+
"Question Complexity": "Medium",
|
| 1689 |
+
"Question": "A river is flowing west to east with 5 m/min. A man can swim in still water at 10 m/min. Which direction should he swim to reach the south bank in shortest path?",
|
| 1690 |
+
"Options Given": "(a) 30° E of S (b) 60° E of N (c) South (d) 30° W of N",
|
| 1691 |
+
"Correct Option": "c",
|
| 1692 |
+
"Selected Option": "a",
|
| 1693 |
+
"Correct?": False,
|
| 1694 |
+
"ELO Score": 1190
|
| 1695 |
+
},
|
| 1696 |
+
{
|
| 1697 |
+
"Subject": "Physics",
|
| 1698 |
+
"Chapter": "Vectors",
|
| 1699 |
+
"Question Tag": "Revision",
|
| 1700 |
+
"Question Complexity": "Medium",
|
| 1701 |
+
"Question": "Find a vector perpendicular to A = 2i + 3j in the same plane.",
|
| 1702 |
+
"Options Given": "(a) -3i + 2j (b) 3i - 2j (c) i + j (d) None",
|
| 1703 |
+
"Correct Option": "a",
|
| 1704 |
+
"Selected Option": "a",
|
| 1705 |
+
"Correct?": True,
|
| 1706 |
+
"ELO Score": 1230
|
| 1707 |
+
},
|
| 1708 |
+
{
|
| 1709 |
+
"Subject": "Physics",
|
| 1710 |
+
"Chapter": "Vectors",
|
| 1711 |
+
"Question Tag": "Revision",
|
| 1712 |
+
"Question Complexity": "Medium",
|
| 1713 |
+
"Question": "Two vectors A and B have same magnitude. If their resultant is perpendicular to A, what is the angle between A and B?",
|
| 1714 |
+
"Options Given": "(a) 60° (b) 120° (c) 135° (d) None",
|
| 1715 |
+
"Correct Option": "b",
|
| 1716 |
+
"Selected Option": "b",
|
| 1717 |
+
"Correct?": True,
|
| 1718 |
+
"ELO Score": 1260
|
| 1719 |
+
},
|
| 1720 |
+
{
|
| 1721 |
+
"Subject": "Physics",
|
| 1722 |
+
"Chapter": "Vectors",
|
| 1723 |
+
"Question Tag": "Test",
|
| 1724 |
+
"Question Complexity": "Hard",
|
| 1725 |
+
"Question": "A man walks 500 m and turns by 60° five times. What is displacement after 5th turn?",
|
| 1726 |
+
"Options Given": "(a) 500 m (b) 1000 m (c) 500√3 m (d) None",
|
| 1727 |
+
"Correct Option": "a",
|
| 1728 |
+
"Selected Option": "c",
|
| 1729 |
+
"Correct?": False,
|
| 1730 |
+
"ELO Score": 1210
|
| 1731 |
+
},
|
| 1732 |
+
{
|
| 1733 |
+
"Subject": "Physics",
|
| 1734 |
+
"Chapter": "Vectors",
|
| 1735 |
+
"Question Tag": "Test",
|
| 1736 |
+
"Question Complexity": "Hard",
|
| 1737 |
+
"Question": "Rain is falling vertically at 3 m/s and a man moves north at 4 m/s. Direction to hold umbrella?",
|
| 1738 |
+
"Options Given": "(a) 37° N of vertical (b) 37° S of vertical (c) 53° N of vertical (d) 53° S of vertical",
|
| 1739 |
+
"Correct Option": "c",
|
| 1740 |
+
"Selected Option": "c",
|
| 1741 |
+
"Correct?": True,
|
| 1742 |
+
"ELO Score": 1265
|
| 1743 |
+
},
|
| 1744 |
+
{
|
| 1745 |
+
"Subject": "Physics",
|
| 1746 |
+
"Chapter": "Vectors",
|
| 1747 |
+
"Question Tag": "Test",
|
| 1748 |
+
"Question Complexity": "Hard",
|
| 1749 |
+
"Question": "Which set of forces cannot be in equilibrium?",
|
| 1750 |
+
"Options Given": "(a) 10N,10N,5N (b) 5N,7N,9N (c) 8N,4N,13N (d) 9N,6N,5N",
|
| 1751 |
+
"Correct Option": "c",
|
| 1752 |
+
"Selected Option": "c",
|
| 1753 |
+
"Correct?": True,
|
| 1754 |
+
"ELO Score": 1310
|
| 1755 |
+
}
|
| 1756 |
+
])
|
| 1757 |
+
df.sort_values(by=['Correct?'], ascending=False, inplace=True)
|
| 1758 |
+
session_state["test_results"] = df
|
| 1759 |
|
| 1760 |
@app.get("/agent4")
|
| 1761 |
def agent4(
|
| 1762 |
+
current_dayNumber: int = Query(2, description="Today's day number for scheduling tasks")
|
|
|
|
| 1763 |
):
|
| 1764 |
"""
|
| 1765 |
Agent 4 - Accountability and Analysis Agent.
|
|
|
|
| 1768 |
before = session_state['updated_roadmap']
|
| 1769 |
else:
|
| 1770 |
before = session_state['data']
|
| 1771 |
+
ag4_update_roadmap(session_state["test_results"], before, session_state["task_analysis"], current_dayNumber)
|
| 1772 |
|
| 1773 |
return {
|
| 1774 |
"original_roadmap": before,
|