shreyanshknayak commited on
Commit
aa7f0f1
·
verified ·
1 Parent(s): aae9eab

Create main.py

Browse files
Files changed (1) hide show
  1. main.py +128 -0
main.py ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from embedchain import App
2
+ from fastapi import FastAPI
3
+ from mangum import Mangum
4
+ from pydantic import BaseModel
5
+ import os
6
+
7
+ app = FastAPI()
8
+ handler = Mangum(app)
9
+
10
+
11
+ api_key = os.environ.getattribute("API_KEY")
12
+
13
+ config = {
14
+ 'llm': {
15
+ 'provider': 'groq',
16
+ 'config': {
17
+ 'model':'llama3-70b-8192',
18
+ 'top_p': 0.5,
19
+ 'api_key': api_key,
20
+ 'stream': True
21
+ }
22
+ },
23
+ 'embedder': {
24
+ 'provider': 'gpt4all',
25
+ }
26
+ }
27
+
28
+ swot_bot = App.from_config(config=config)
29
+
30
+ swot_bot.add("web_page","https://www.allen.ac.in/engineering/jee-main/tips-tricks/")
31
+ swot_bot.add("https://motion.ac.in/blog/jee-main-weightage-chapter-wise/")
32
+ swot_bot.add("https://www.allen.ac.in/engineering/jee-main/preparation-strategy/")
33
+ swot_bot.add("https://byjus.com/jee/how-to-prepare-for-jee-at-home/")
34
+ swot_bot.add("https://www.askiitians.com/iit-jee/how-to-prepare-for-iit-jee-from-class-11.html")
35
+ swot_bot.add("https://byjus.com/jee/complete-study-plan-to-crack-jee-main/")
36
+ #swot_bot.add("https://mystudycart.com/iit-jee-preparation")
37
+ swot_bot.add("https://engineering.careers360.com/articles/how-prepare-for-jee-main")
38
+
39
+ swot_bot.add("https://www.allenoverseas.com/blog/jee-main-2024-exam-strategies-subject-wise-preparation-tips/")
40
+ swot_bot.add("https://www.vedantu.com/jee-main/topics")
41
+ swot_bot.add("https://www.pw.live/exams/wp-content/uploads/2024/01/syllabus-for-jee-main-2024-as-on-01-november-2023-1-3.pdf")
42
+ swot_bot.add("https://www.pw.live/exams/wp-content/uploads/2024/01/syllabus-for-jee-main-2024-as-on-01-november-2023-4-8.pdf")
43
+ swot_bot.add("https://www.pw.live/exams/jee/jee-main-chemistry-syllabus/")
44
+
45
+ swot_bot.add("https://www.pw.live/topics-chemistry-class-11")
46
+ swot_bot.add("https://www.pw.live/topics-chemistry-class-12")
47
+
48
+
49
+ system_prompt = """You are an advanced language model trained to analyze student responses from a questionnaire on Academic, Cognitive, and Study Profile aspects related to JEE Mains preparation. Your task is to generate a personalized SCO (Strengths, Challenges, Opportunities) analysis and an Action Plan section based on the user's inputs.
50
+
51
+ Questionnaire Structure:
52
+ Academic Profile:
53
+ - Confidence scores in various subjects/topics and subtopics covered in JEE Mains (e.g., Physical Chemistry: Electrochemistry, Redox Reactions; Inorganic Chemistry: Transition Elements, Periodic Table, Representative Elements)
54
+
55
+ Cognitive Profile:
56
+ - Learning styles (visual, auditory, kinesthetic)
57
+ - Problem-solving abilities
58
+ - Time management skills
59
+ - Attention span and focus
60
+
61
+ Study Profile:
62
+ - Study habits (consistent/irregular, self-study/coaching)
63
+ - Average study hours per day
64
+ - Revision strategies
65
+ - Test-taking strategies
66
+
67
+ Given: You have been provided with the weightages of different topics/subjects in the JEE Mains exam and common knowledge specific to the JEE context. Additionally, you have access to a database that maps specific subjects/topics to general cognitive traits and skills required for success in those areas.
68
+
69
+ Output Structure:
70
+
71
+ SCO Analysis:
72
+ Strengths:
73
+ - List the student's strengths based on their high confidence scores, favorable cognitive abilities, and effective study habits.
74
+ - Identify general cognitive traits and skills the student excels at based on their performance in specific subjects/topics and subtopics (e.g., strong visualization skills for organic chemistry, pattern recognition abilities for algebra, etc.)
75
+ - Highlight overarching trends in the student's strengths across related subjects/topics (e.g., strong in Physical Chemistry but struggles in Inorganic Chemistry)
76
+
77
+ Challenges:
78
+ - Identify the areas where the student faces difficulties based on low confidence scores, cognitive limitations, and ineffective study habits.
79
+ - Highlight general cognitive traits and skills the student struggles with based on their performance in specific subjects/topics and subtopics.
80
+ - Identify overarching trends in the student's weaknesses across related subjects/topics.
81
+
82
+ Opportunities:
83
+ - Suggest opportunities for improvement by leveraging the student's strengths and addressing their challenges.
84
+ - Recommend ways to enhance the general cognitive traits and skills required for success in specific subjects/topics and subtopics.
85
+
86
+ Action Plan:
87
+ - Provide a detailed, subject/topic/subtopic-specific action plan tailored to the student's SCO analysis.
88
+ - Recommend targeted strategies, resources, and techniques to improve their preparation in the identified areas of weakness, including subject-specific cognitive skills and study behaviors.
89
+ - Suggest ways to enhance their strengths and capitalize on opportunities, including leveraging their strong cognitive traits and effective study habits.
90
+ - Incorporate time management, revision, and test-taking strategies specific to JEE Mains and the identified subjects/topics/subtopics.
91
+ - Address overarching trends in the student's strengths and weaknesses across related subjects/topics, and categorize this insight under appropriate headings.
92
+
93
+ |
94
+
95
+ Your analysis and action plan should be comprehensive, consistent, and tailored to the individual student's responses while leveraging your knowledge of the JEE Mains exam context, the mapping of subjects/topics to general cognitive traits and skills, and the ability to identify overarching trends across related subjects/topics."""
96
+
97
+
98
+ class UserPromptInput(BaseModel):
99
+ confidence_scores_str: str
100
+ problem_solving_approach: str
101
+ thorough_understanding: str
102
+ feedback: str
103
+ misconception: str
104
+ time_management: str
105
+ time_division: str
106
+ mock_test_frequency: str
107
+ progress_monitoring: str
108
+ study_methods: str
109
+ study_techniques: str
110
+
111
+
112
+ @app.post("/")
113
+ async def get_analysis(user_prompt: UserPromptInput):
114
+ user_response = f"""Confidence score of the student across different subjects out of 10 :{getattr(user_prompt, 'confidence_scores_str')},
115
+ 'When faced with complex,multi-stemp problems in JEE, how likely are you to approach problem-solving systematically, breaking down each step ?':{getattr(user_prompt, 'problem_solving_approach')},
116
+ 'In your JEE preparation, how likely are you to ensure thorough understanding of fundamental concepts before moving on to advanced topics ?':{getattr(user_prompt, 'thorough_understanding')},
117
+ 'How likely are to integrate feedback from practice tests or teachers into your JEE preparation strategy ?':{getattr(user_prompt, 'feedback')},
118
+ 'When encountering a misconception or misunderstanding in a JEE concept, how likely are you to identify and resolve it ?': {getattr(user_prompt, 'misconception')},
119
+ 'How likely are you to effectively manage time during JEE exams, especially in sections with limited time constraints?':{getattr(user_prompt, 'time_management')},
120
+ 'How do you divide your study time among Physics, Chemistry and Mathematics for JEE ? (Allocate Percentage)': {getattr(user_prompt, 'time_division')},
121
+ 'How often do you use mock tests and past question papers for JEE preparation ?': {getattr(user_prompt, 'mock_test_frequency')},
122
+ 'How do you monitor your progress in JEE topics or chapters?': {getattr(user_prompt, 'progress_monitoring')},
123
+ 'How do you adjust your study methods for difficult or new JEE topics ?': {getattr(user_prompt, 'study_methods')},
124
+ 'What techniques do you use to remember JEE concepts and formulas for a long time ? eg: Flashcards, Mindmap, etc.': {getattr(user_prompt, 'study_techniques')}"""
125
+
126
+
127
+ output = swot_bot.query(system_prompt + user_response)
128
+ return {"message": output}