Hari-Prasath-M91 commited on
Commit
17d2c0f
·
1 Parent(s): bde2aa2

Updated Agent-4

Browse files
Files changed (1) hide show
  1. app.py +129 -126
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
- df = pd.DataFrame([
1633
- {
1634
- "Subject": "Physics",
1635
- "Chapter": "Vectors",
1636
- "Question Tag": "Concept Understanding",
1637
- "Question Complexity": "Easy",
1638
- "Question": "The vector projection of a vector on y-axis is",
1639
- "Options Given": "(a) 5 (b) 4 (c) 3 (d) Zero",
1640
- "Correct Option": "d",
1641
- "Selected Option": "d",
1642
- "Correct?": True,
1643
- "ELO Score": 1200
1644
- },
1645
- {
1646
- "Subject": "Physics",
1647
- "Chapter": "Vectors",
1648
- "Question Tag": "Concept Understanding",
1649
- "Question Complexity": "Easy",
1650
- "Question": "Position of a particle in a rectangular coordinate system is (3, 2, 5). Then its position vector will be",
1651
- "Options Given": "(a) 3i + 2j + 5k (b) 2i + 3j + 5k (c) 5i + 2j + 3k (d) None of these",
1652
- "Correct Option": "a",
1653
- "Selected Option": "b",
1654
- "Correct?": False,
1655
- "ELO Score": 1170
1656
- },
1657
- {
1658
- "Subject": "Physics",
1659
- "Chapter": "Vectors",
1660
- "Question Tag": "Question Practice",
1661
- "Question Complexity": "Easy",
1662
- "Question": "If a particle moves from point P (2,3,5) to point Q (3,4,5), its displacement vector is",
1663
- "Options Given": "(a) i + j (b) i + j + k (c) 2i + 2j (d) None of these",
1664
- "Correct Option": "a",
1665
- "Selected Option": "a",
1666
- "Correct?": True,
1667
- "ELO Score": 1185
1668
- },
1669
- {
1670
- "Subject": "Physics",
1671
- "Chapter": "Vectors",
1672
- "Question Tag": "Concept Understanding",
1673
- "Question Complexity": "Medium",
1674
- "Question": "A particle moving eastwards with 5 m/s. In 10 s the velocity changes to 5 m/s northwards. The average acceleration is",
1675
- "Options Given": "(a) 1/2 m/s² NE (b) 1/2 m/s² North (c) 1/2 m/s² NW (d) Zero",
1676
- "Correct Option": "a",
1677
- "Selected Option": "a",
1678
- "Correct?": True,
1679
- "ELO Score": 1225
1680
- },
1681
- {
1682
- "Subject": "Physics",
1683
- "Chapter": "Vectors",
1684
- "Question Tag": "Question Practice",
1685
- "Question Complexity": "Medium",
1686
- "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?",
1687
- "Options Given": "(a) 30° E of S (b) 60° E of N (c) South (d) 30° W of N",
1688
- "Correct Option": "c",
1689
- "Selected Option": "a",
1690
- "Correct?": False,
1691
- "ELO Score": 1190
1692
- },
1693
- {
1694
- "Subject": "Physics",
1695
- "Chapter": "Vectors",
1696
- "Question Tag": "Revision",
1697
- "Question Complexity": "Medium",
1698
- "Question": "Find a vector perpendicular to A = 2i + 3j in the same plane.",
1699
- "Options Given": "(a) -3i + 2j (b) 3i - 2j (c) i + j (d) None",
1700
- "Correct Option": "a",
1701
- "Selected Option": "a",
1702
- "Correct?": True,
1703
- "ELO Score": 1230
1704
- },
1705
- {
1706
- "Subject": "Physics",
1707
- "Chapter": "Vectors",
1708
- "Question Tag": "Revision",
1709
- "Question Complexity": "Medium",
1710
- "Question": "Two vectors A and B have same magnitude. If their resultant is perpendicular to A, what is the angle between A and B?",
1711
- "Options Given": "(a) 60° (b) 120° (c) 135° (d) None",
1712
- "Correct Option": "b",
1713
- "Selected Option": "b",
1714
- "Correct?": True,
1715
- "ELO Score": 1260
1716
- },
1717
- {
1718
- "Subject": "Physics",
1719
- "Chapter": "Vectors",
1720
- "Question Tag": "Test",
1721
- "Question Complexity": "Hard",
1722
- "Question": "A man walks 500 m and turns by 60° five times. What is displacement after 5th turn?",
1723
- "Options Given": "(a) 500 m (b) 1000 m (c) 500√3 m (d) None",
1724
- "Correct Option": "a",
1725
- "Selected Option": "c",
1726
- "Correct?": False,
1727
- "ELO Score": 1210
1728
- },
1729
- {
1730
- "Subject": "Physics",
1731
- "Chapter": "Vectors",
1732
- "Question Tag": "Test",
1733
- "Question Complexity": "Hard",
1734
- "Question": "Rain is falling vertically at 3 m/s and a man moves north at 4 m/s. Direction to hold umbrella?",
1735
- "Options Given": "(a) 37° N of vertical (b) 37° S of vertical (c) 53° N of vertical (d) 53° S of vertical",
1736
- "Correct Option": "c",
1737
- "Selected Option": "c",
1738
- "Correct?": True,
1739
- "ELO Score": 1265
1740
- },
1741
- {
1742
- "Subject": "Physics",
1743
- "Chapter": "Vectors",
1744
- "Question Tag": "Test",
1745
- "Question Complexity": "Hard",
1746
- "Question": "Which set of forces cannot be in equilibrium?",
1747
- "Options Given": "(a) 10N,10N,5N (b) 5N,7N,9N (c) 8N,4N,13N (d) 9N,6N,5N",
1748
- "Correct Option": "c",
1749
- "Selected Option": "c",
1750
- "Correct?": True,
1751
- "ELO Score": 1310
1752
- }
1753
- ])
1754
- df.sort_values(by=['Correct?'], ascending=False, inplace=True)
 
 
1755
 
1756
  @app.get("/agent4")
1757
  def agent4(
1758
- df: pd.DataFrame = Query(df, description="Dataframe of the Results of the students test"),
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(df, before, session_state["task_analysis"], current_dayNumber)
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,