QuantumChecker 0.2.2__tar.gz → 0.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: QuantumChecker
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: A package to evaluate homework submissions in Python, SQL, PowerBI, and SSIS.
5
5
  Author: Qobiljon
6
6
  Author-email: qobiljonkhayrullayev@gmail.com
@@ -0,0 +1,125 @@
1
+ import logging
2
+ import os
3
+ from datetime import datetime
4
+ from typing import List, Dict, Optional
5
+ from .python_evaluator import PythonEvaluator
6
+ from .sql_evaluator import SQLEvaluator
7
+ from .powerbi_evaluator import PowerBIEvaluator
8
+ from .ssis_evaluator import SSISEvaluator
9
+
10
+
11
+ class HomeworkEvaluator:
12
+ EXTENSION_TO_TYPE = {
13
+ ".py": "python",
14
+ ".sql": "sql",
15
+ ".zip": "powerbi",
16
+ ".dtsx": "ssis",
17
+ ".DTSX": "ssis",
18
+ ".txt": "text",
19
+ ".md": "text"
20
+ }
21
+
22
+ def _setup_logger(self, file_type: str) -> logging.Logger:
23
+ base_log_dir = os.path.join(os.path.dirname(__file__), "logs")
24
+ type_log_dir = os.path.join(base_log_dir, file_type)
25
+ os.makedirs(type_log_dir, exist_ok=True)
26
+
27
+ timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
28
+ log_file_path = os.path.join(type_log_dir, f"evaluation_{timestamp}.log")
29
+
30
+ logger = logging.getLogger(f"{file_type}_{timestamp}")
31
+ logger.setLevel(logging.INFO)
32
+
33
+ if not logger.handlers:
34
+ file_handler = logging.FileHandler(log_file_path, encoding="utf-8")
35
+ formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
36
+ file_handler.setFormatter(formatter)
37
+ logger.addHandler(file_handler)
38
+
39
+ return logger
40
+
41
+ @staticmethod
42
+ def parse_questions(md_content: str) -> List[str]:
43
+ questions = [q.strip() for q in md_content.strip().split("\n\n") if q.strip()]
44
+ if not questions:
45
+ raise ValueError("No valid questions found in the question content")
46
+ return questions
47
+
48
+ def evaluate_from_content(
49
+ self,
50
+ question_content: str,
51
+ answer_path: str,
52
+ api_key: str,
53
+ backup_api_keys: Optional[List[str]] = None,
54
+ ) -> Dict[str, any]:
55
+ if backup_api_keys is None:
56
+ backup_api_keys = []
57
+
58
+ try:
59
+ questions = self.parse_questions(question_content)
60
+ except Exception as e:
61
+ base_logger = logging.getLogger("base")
62
+ base_logger.error("Failed to parse question content: %s", str(e))
63
+ raise ValueError(f"Failed to parse question content: {str(e)}")
64
+
65
+ answer_path = answer_path.strip()
66
+ _, ext = os.path.splitext(answer_path)
67
+ ext = ext.lower()
68
+ file_type = self.EXTENSION_TO_TYPE.get(ext, "text")
69
+
70
+ logger = self._setup_logger(file_type)
71
+ logger.info("Processing answer_path: %s", answer_path)
72
+ logger.info("Extracted extension: %s", ext)
73
+ logger.info("Detected file type: %s for file: %s", file_type, answer_path)
74
+
75
+ if not os.path.exists(answer_path):
76
+ logger.error("Answer file not found: %s", answer_path)
77
+ raise FileNotFoundError(f"Answer file not found: {answer_path}")
78
+
79
+ def create_evaluator(ftype, key):
80
+ if ftype == "python":
81
+ return PythonEvaluator(key)
82
+ elif ftype == "sql":
83
+ return SQLEvaluator(key)
84
+ elif ftype == "powerbi":
85
+ return PowerBIEvaluator(key)
86
+ elif ftype == "ssis":
87
+ return SSISEvaluator(key)
88
+ else:
89
+ return PythonEvaluator(key) # default fallback
90
+
91
+ keys_to_try = [api_key] + backup_api_keys[:5] # max 5 backups
92
+
93
+ last_exception = None
94
+ for i, key in enumerate(keys_to_try):
95
+ evaluator = create_evaluator(file_type, key)
96
+ try:
97
+ evaluation = evaluator.evaluate(questions, answer_path)
98
+ logger.info(f"Evaluation complete with API key #{i + 1}: Score = {evaluation.get('score')}")
99
+ break
100
+ except Exception as e:
101
+ error_msg = str(e).lower()
102
+ if (
103
+ "429" in error_msg
104
+ or "rate limit" in error_msg
105
+ or "quota exceeded" in error_msg
106
+ or "daily limit exceeded" in error_msg
107
+ or "quota" in error_msg
108
+ ):
109
+ logger.warning(f"API key #{i + 1} limited or quota exceeded. Trying next key if available.")
110
+ last_exception = e
111
+ continue
112
+ else:
113
+ logger.error(f"Evaluation failed with API key #{i + 1}: {str(e)}")
114
+ raise
115
+ else:
116
+ logger.error("All API keys exhausted and evaluation failed.")
117
+ if last_exception:
118
+ raise last_exception
119
+ else:
120
+ raise RuntimeError("Evaluation failed for unknown reasons.")
121
+
122
+ return {
123
+ "mark": evaluation["score"],
124
+ "feedback": evaluation["feedback"]
125
+ }
@@ -14,7 +14,7 @@ from PIL import Image
14
14
  import io
15
15
  import base64
16
16
 
17
- from prompts import prompt_text_powerbi
17
+ from .prompts import prompt_text_powerbi
18
18
 
19
19
  load_dotenv()
20
20
  logger = logging.getLogger(__name__)
@@ -0,0 +1,230 @@
1
+ def prompt_text_python(combined_content):
2
+ return (
3
+ "You are an expert Python instructor evaluating beginner Python code. "
4
+ "Focus on syntax, logic, code readability, and adherence to Python best practices (e.g., PEP 8).\n\n"
5
+ "Your evaluation should:\n"
6
+ "- Focus on clarity, correctness, and understanding of the Python content\n"
7
+ "- Be constructive and encouraging (students are beginners)\n"
8
+ "- Highlight both strengths and areas for improvement\n"
9
+ "- Identify major mistakes or misunderstandings (e.g., syntax errors, incorrect logic, missing components and conceptual part)\n"
10
+ "- Be concise but insightful\n\n"
11
+ "- If the student's answer is incomplete or too simplistic to fully address the question, "
12
+ "explain that the response lacks depth or coverage, but do not provide the missing or correct answer. "
13
+ "Encourage the student to research further or review the relevant concepts.\n"
14
+ "- If the student's submission is off-topic or unrelated to the question, "
15
+ "clearly state that the response does not address the question's requirements and "
16
+ "explain why it is irrelevant. Encourage the student to review the question carefully and "
17
+ "focus on the relevant Python concepts without providing the correct solution."
18
+ "Provide feedback in this format:\n\n"
19
+ "=== COMPREHENSIVE EVALUATION ===\n\n"
20
+ "OVERALL SCORE: /100\n\n"
21
+ "FEEDBACK SUMMARY:\n"
22
+ "- What was done well\n"
23
+ "- What needs improvement\n"
24
+ "- Any major issues (e.g., logic errors, misunderstanding, incomplete solutions)\n\n"
25
+ "KEY ADVICE:\n"
26
+ "- Top 2 or 3 suggestions to improve Python skills\n"
27
+ "- Highlight any concepts to revisit\n"
28
+ "- Encourage further learning and effort\n\n"
29
+ f"{combined_content}\n"
30
+ "=== EVALUATION COMPLETE ===\n\n"
31
+ "Notes:\n"
32
+ "- Be honest but supportive\n"
33
+ "- Include specific examples from the provided answers if helpful\n"
34
+ "- Keep language beginner-friendly\n"
35
+ "- Do not give too low marks. You may add from 5 up to 10 additional marks for effort or "
36
+ "partial relevance, ensuring the score does not exceed 100."
37
+ )
38
+
39
+
40
+ def prompt_text_sql(combined_content: str):
41
+ return (
42
+ "You are a SQL expert evaluating beginner SQL queries. "
43
+ "Focus on query correctness, efficiency, proper use of SQL syntax (e.g., SELECT, JOIN, WHERE), "
44
+ "and alignment with the question's requirements.\n\n"
45
+ "Your evaluation should:\n"
46
+ "- Focus on clarity, correctness, and understanding of the SQL content\n"
47
+ "- Be constructive and encouraging (students are beginners)\n"
48
+ "- Highlight both strengths and areas for improvement\n"
49
+ "- Identify major mistakes or misunderstandings (e.g., syntax errors, incorrect logic, missing components)\n"
50
+ "- Also assess whether the student’s answer demonstrates a proper understanding of the "
51
+ "SQL Server concepts being tested (e.g., joins, subqueries, indexing, optimization, "
52
+ "if required in homework's task), not just correct syntax.\n"
53
+ "- Be concise but insightful\n"
54
+ "- Look for correct use of SQL Server-specific features (e.g., Common Table Expressions, "
55
+ "Window Functions, transactions, if required in homework's task)\n"
56
+ "- If the student's answer is incomplete or too simplistic to fully address the question, "
57
+ "clearly state that it lacks sufficient detail or misses key components, but do not provide "
58
+ "the missing parts or solutions. Instead, suggest they revisit the relevant "
59
+ "concepts (e.g., joins, subqueries, indexing, if lacks) and encourage deeper exploration.\n"
60
+ "- If the student's submission is off-topic or unrelated to the question, "
61
+ "clearly state that the response does not address the question's requirements and "
62
+ "explain why it is irrelevant. Encourage the student to review the "
63
+ "question carefully and focus on the relevant SQL Server concepts without providing the correct solution."
64
+ "- Check for query optimization and adherence to the question's intent\n\n"
65
+ "Provide feedback in this format:\n\n"
66
+ "=== COMPREHENSIVE EVALUATION ===\n\n"
67
+ "OVERALL SCORE: <score>/100\n\n"
68
+ "FEEDBACK SUMMARY:\n"
69
+ "- What was done well\n"
70
+ "- What needs improvement\n"
71
+ "- Any major issues (e.g., logic errors, misunderstanding, incomplete solutions)\n\n"
72
+ "KEY ADVICE:\n"
73
+ "- Top 2 or 3 suggestions to improve SQL skills\n"
74
+ "- Highlight any concepts to revisit\n"
75
+ "- Encourage further learning and effort\n\n"
76
+ f"{combined_content}\n"
77
+ "=== EVALUATION COMPLETE ===\n\n"
78
+ "Notes:\n"
79
+ "- Be honest but supportive\n"
80
+ "- Include specific examples from the provided answers if helpful\n"
81
+ "- Keep language beginner-friendly\n"
82
+ "- Do not give too low marks. You may add from 5 up to 10 additional marks for "
83
+ "effort or partial relevance, ensuring the score does not exceed 100."
84
+ )
85
+
86
+ def prompt_text_ssis(combined_content):
87
+ return (
88
+ "You are a data engineer reviewing an SSIS package (.dtsx) summary. "
89
+ "Evaluate how well the package addresses the question, focusing on the correctness of tasks, "
90
+ "data flow, control flow, and configurations.\n\n"
91
+ "Your evaluation should:\n"
92
+ "- Assess how well the package addresses the question overall\n"
93
+ "- Focus on clarity, accuracy, and a basic understanding of key SSIS components "
94
+ "(e.g., Control Flow, Data Flow, Connection Managers)\n"
95
+ "- Be supportive and constructive — students are new to SSIS, so encourage learning and reward effort\n"
96
+ "- Highlight what was done well and gently suggest what could be improved\n"
97
+ "- Point out only major issues when necessary (e.g., missing essential components, "
98
+ "incorrect configurations, or clear misunderstandings)\n"
99
+ "- Keep feedback clear, concise, and insightful\n"
100
+ "- Also assess whether the student’s submission demonstrates a proper understanding of "
101
+ "SSIS concepts being tested (e.g., ETL processes, control flow sequencing, error handling), not just technical correctness\n"
102
+ "- Check for proper use of control flow tasks, data flow transformations, precedence constraints, "
103
+ "error handling (e.g., OnError events), and connection manager configurations\n"
104
+ "- If the student's submission is incomplete or too simplistic to fully address the question, "
105
+ "clearly state that it lacks sufficient detail or misses key components, "
106
+ "but do not provide the missing parts or solutions. Instead, suggest they revisit the relevant "
107
+ "SSIS concepts (e.g., control flow, data flow, error handling) and encourage deeper exploration\n"
108
+ "- If the student's submission is off-topic or unrelated to the question, "
109
+ "clearly state that the response does not address the question's requirements and "
110
+ "explain why it is irrelevant. Encourage the student to review the question carefully and "
111
+ "focus on the relevant SSIS concepts without providing the correct solution\n"
112
+ "- Understand that simple packages may only use one Data Flow Task, and that’s perfectly fine\n"
113
+ "- If scheduling (e.g., daily at 7 AM) is not included, just note it briefly — "
114
+ "it may be handled by SQL Server Agent and should not impact the score significantly (no more than 5–10 points)\n\n"
115
+ "When provided, check that:\n"
116
+ "- Data flow connections are properly linked\n"
117
+ "- Data types match the destination schema\n\n"
118
+ "Important Scoring Note:\n"
119
+ "Always give credit for effort, even if there are technical gaps. It’s better to nudge students forward "
120
+ "than to discourage them. Start from a generous baseline and avoid very low scores unless the submission "
121
+ "shows no attempt. Remember the student is not a pro programmer, so avoid low scores just because best "
122
+ "practices weren’t followed exactly. Score mainly based on what was asked. "
123
+ "Provide feedback in this format:\n\n"
124
+ "=== COMPREHENSIVE EVALUATION ===\n\n"
125
+ "OVERALL SCORE: <score>/100\n\n"
126
+ "FEEDBACK SUMMARY:\n"
127
+ "- What was done well\n"
128
+ "- What needs improvement\n"
129
+ "- Any major issues (e.g., logic errors, misunderstandings, incomplete solutions)\n\n"
130
+ "KEY ADVICE:\n"
131
+ "- Top 2-3 suggestions to improve SSIS skills\n"
132
+ "- Concepts to revisit\n"
133
+ "- Encouragement to keep learning and improving\n\n"
134
+ f"{combined_content}\n"
135
+ "=== EVALUATION COMPLETE ===\n\n"
136
+ "Notes:\n"
137
+ "- Be honest but supportive\n"
138
+ "- Include specific examples from the provided summary if helpful\n"
139
+ "- Keep language beginner-friendly\n"
140
+ "- Do not give too low marks. From 5 up to 10 additional marks for effort or partial relevance, ensuring the score does not exceed 100."
141
+ )
142
+
143
+ def prompt_text_powerbi(combined_content: str):
144
+ return (
145
+ "You are a BI professional evaluating Power BI report solutions, including DAX formulas, "
146
+ "data models, and visual design based on the given task.\n\n"
147
+ "Your evaluation should:\n"
148
+ "- Focus on clarity, correctness, and understanding of Power BI content (DAX, data models, visuals)\n"
149
+ "- Be constructive and encouraging (students are beginners)\n"
150
+ "- Highlight strengths and areas for improvement\n"
151
+ "- Identify major mistakes (e.g., incorrect DAX, poor data modeling, unclear visuals)\n"
152
+ "- Be concise but insightful\n"
153
+ "- Evaluate proper configuration of data model relationships, correctness and logic of DAX formulas, and "
154
+ "clarity of visuals (e.g., appropriate chart types, layout, readability, proper filtering)\n"
155
+ "- Also assess whether the student’s submission demonstrates a proper understanding of "
156
+ "Power BI concepts being tested (e.g., data modeling, DAX calculations, visualization principles), not just technical correctness\n"
157
+ "- If the student's submission is incomplete or too simplistic to fully address the question, "
158
+ "clearly state that it lacks sufficient detail or misses key components, but do not provide "
159
+ "the missing parts or solutions. Instead, suggest they revisit the relevant "
160
+ "Power BI concepts (e.g., data modeling, DAX, or visualization) and encourage deeper exploration\n"
161
+ "- If the student's submission is off-topic or unrelated to the question, "
162
+ "clearly state that the response does not address the question's requirements and "
163
+ "explain why it is irrelevant. Encourage the student to review the question carefully and "
164
+ "focus on the relevant Power BI concepts without providing the correct solution\n"
165
+ "- Do not penalize for advanced efficiency, data source paths, or separate measure tables\n"
166
+ "- Do not lower marks for redundant date tables or missing advanced design features\n\n"
167
+ "Provide feedback in this format:\n\n"
168
+ "=== COMPREHENSIVE EVALUATION ===\n\n"
169
+ "OVERALL SCORE: <score>/100\n\n"
170
+ "FEEDBACK SUMMARY:\n"
171
+ "- What was done well\n"
172
+ "- What needs improvement\n"
173
+ "- Any major issues (e.g., incorrect DAX, missing visuals, poor relationships)\n\n"
174
+ "KEY ADVICE:\n"
175
+ "- Top 2-3 suggestions to improve Power BI skills\n"
176
+ "- Highlight any concepts to revisit\n"
177
+ "- Encourage further learning and effort\n\n"
178
+
179
+ f"{combined_content}\n"
180
+ "=== EVALUATION COMPLETE ===\n\n"
181
+ "Notes:\n"
182
+ "- Be honest but supportive\n"
183
+ "- Include specific examples from the provided answers if helpful\n"
184
+ "- Keep language beginner-friendly\n"
185
+ "- Score submissions based on alignment with the question, effort, and technical correctness. "
186
+ "Off-topic or incomplete submissions should generally score low (e.g., 10-30/100), "
187
+ "but add from 5 up to 10 marks for effort or partial relevance, ensuring the score does not exceed 100."
188
+ )
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
@@ -1,6 +1,6 @@
1
1
  import logging
2
2
  import requests
3
- from prompts import prompt_text_python
3
+ from .prompts import prompt_text_python
4
4
  from typing import List, Dict
5
5
  from tenacity import retry, stop_after_attempt, wait_exponential, retry_if_exception_type
6
6
 
@@ -3,7 +3,7 @@ import requests
3
3
  from typing import List, Dict
4
4
  from tenacity import retry, stop_after_attempt, wait_exponential, retry_if_exception_type
5
5
 
6
- from prompts import prompt_text_sql
6
+ from .prompts import prompt_text_sql
7
7
 
8
8
  logger = logging.getLogger(__name__)
9
9
 
@@ -4,7 +4,7 @@ import xml.etree.ElementTree as ET
4
4
  from typing import List, Dict
5
5
  from tenacity import retry, stop_after_attempt, wait_exponential, retry_if_exception_type
6
6
 
7
- from prompts import prompt_text_ssis
7
+ from .prompts import prompt_text_ssis
8
8
 
9
9
  logger = logging.getLogger(__name__)
10
10
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: QuantumChecker
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: A package to evaluate homework submissions in Python, SQL, PowerBI, and SSIS.
5
5
  Author: Qobiljon
6
6
  Author-email: qobiljonkhayrullayev@gmail.com
@@ -11,4 +11,5 @@ QuantumChecker.egg-info/PKG-INFO
11
11
  QuantumChecker.egg-info/SOURCES.txt
12
12
  QuantumChecker.egg-info/dependency_links.txt
13
13
  QuantumChecker.egg-info/requires.txt
14
- QuantumChecker.egg-info/top_level.txt
14
+ QuantumChecker.egg-info/top_level.txt
15
+ tests/test.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="QuantumChecker",
5
- version="0.2.2",
5
+ version="0.2.4",
6
6
  author="Qobiljon",
7
7
  author_email="qobiljonkhayrullayev@gmail.com",
8
8
  description="A package to evaluate homework submissions in Python, SQL, PowerBI, and SSIS.",
@@ -0,0 +1,29 @@
1
+ from QuantumCheck import HomeworkEvaluator
2
+
3
+ if __name__ == "__main__":
4
+ evaluator = HomeworkEvaluator()
5
+
6
+ primary_api_key = "AIzaSyD0ptgEixhLLjCWjkyxhqDsUzO16ytQq2c"
7
+ question = "How to write print in python"
8
+
9
+ backup_keys = [
10
+ "BACKUP_KEY_1",
11
+ "BACKUP_KEY_2",
12
+ "BACKUP_KEY_3",
13
+ "BACKUP_KEY_4",
14
+ "BACKUP_KEY_5",
15
+ ]
16
+
17
+ result = evaluator.evaluate_from_content(
18
+ question_content="How to write print in python",
19
+ answer_path="../tests/answer/answer.py",
20
+ api_key=primary_api_key,
21
+ backup_api_keys=backup_keys
22
+ )
23
+
24
+ print(result)
25
+
26
+
27
+
28
+
29
+
@@ -1,72 +0,0 @@
1
- import logging
2
- import os
3
- from typing import List, Dict
4
- from python_evaluator import PythonEvaluator
5
- from sql_evaluator import SQLEvaluator
6
- from powerbi_evaluator import PowerBIEvaluator
7
- from ssis_evaluator import SSISEvaluator
8
-
9
- logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
10
- logger = logging.getLogger(__name__)
11
-
12
-
13
- class HomeworkEvaluator:
14
- EXTENSION_TO_TYPE = {
15
- ".py": "python",
16
- ".sql": "sql",
17
- ".zip": "powerbi",
18
- ".dtsx": "ssis",
19
- ".DTSX": "ssis",
20
- ".txt": "text",
21
- ".md": "text"
22
- }
23
-
24
- @staticmethod
25
- def parse_questions(md_content: str) -> List[str]:
26
- questions = [q.strip() for q in md_content.strip().split("\n\n") if q.strip()]
27
- if not questions:
28
- raise ValueError("No valid questions found in the question content")
29
- return questions
30
-
31
- def evaluate_from_content(self, question_content: str, answer_path: str, api_key: str) -> Dict[str, any]:
32
- try:
33
- questions = self.parse_questions(question_content)
34
- except Exception as e:
35
- logger.error("Failed to parse question content: %s", str(e))
36
- raise ValueError(f"Failed to parse question content: {str(e)}")
37
-
38
- answer_path = answer_path.strip()
39
- logger.info("Processing answer_path: %s", answer_path)
40
- _, ext = os.path.splitext(answer_path)
41
- ext = ext.lower()
42
- logger.info("Extracted extension: %s", ext)
43
- file_type = self.EXTENSION_TO_TYPE.get(ext, "text")
44
- logger.info("Detected file type: %s for file: %s", file_type, answer_path)
45
-
46
- if not os.path.exists(answer_path):
47
- logger.error("Answer file not found: %s", answer_path)
48
- raise FileNotFoundError(f"Answer file not found: {answer_path}")
49
-
50
- if file_type == "python":
51
- evaluator = PythonEvaluator(api_key)
52
- evaluation = evaluator.evaluate(questions, answer_path)
53
- elif file_type == "sql":
54
- evaluator = SQLEvaluator(api_key)
55
- evaluation = evaluator.evaluate(questions, answer_path)
56
- elif file_type == "powerbi":
57
- evaluator = PowerBIEvaluator(api_key)
58
- evaluation = evaluator.evaluate(questions, answer_path)
59
- elif file_type == "ssis":
60
- evaluator = SSISEvaluator(api_key)
61
- evaluation = evaluator.evaluate(questions, answer_path)
62
- else:
63
- logger.warning("Unrecognized file type '%s', defaulting to text (Python parser)", file_type)
64
- evaluator = PythonEvaluator(api_key)
65
- evaluation = evaluator.evaluate(questions, answer_path)
66
-
67
- return {
68
- "mark": evaluation["score"],
69
- "feedback": evaluation["feedback"]
70
- }
71
-
72
-
@@ -1,140 +0,0 @@
1
-
2
- def prompt_text_python(combined_content):
3
- return (
4
- "You are an expert Python instructor evaluating beginner Python code. "
5
- "Focus on syntax, logic, code readability, and adherence to Python best practices (e.g., PEP 8).\n\n"
6
- "IMPORTANT: First, check if the student's answer is relevant to Python. "
7
- "If it is clearly from a different subject (e.g., SQL, Power BI), assign a low score (10–25/100) "
8
- "and explain the mismatch supportively.\n\n"
9
- "Your evaluation should:\n"
10
- "- Focus on clarity, correctness, and understanding of the Python content\n"
11
- "- Be constructive and encouraging (students are beginners)\n"
12
- "- Highlight both strengths and areas for improvement\n"
13
- "- Identify major mistakes or misunderstandings (e.g., syntax errors, incorrect logic, missing components)\n"
14
- "- Be concise but insightful\n\n"
15
- "Provide feedback in this format:\n\n"
16
- "=== COMPREHENSIVE EVALUATION ===\n\n"
17
- "OVERALL SCORE: <score>/100\n\n"
18
- "FEEDBACK SUMMARY:\n"
19
- "- What was done well\n"
20
- "- What needs improvement\n"
21
- "- Any major issues (e.g., logic errors, misunderstanding, incomplete solutions)\n\n"
22
- "KEY ADVICE:\n"
23
- "- Top 2-3 suggestions to improve Python skills\n"
24
- "- Highlight any concepts to revisit\n"
25
- "- Encourage further learning and effort\n\n"
26
- f"{combined_content}\n"
27
- "=== EVALUATION COMPLETE ===\n\n"
28
- "Notes:\n"
29
- "- Be honest but supportive\n"
30
- "- Include specific examples from the provided answers if helpful\n"
31
- "- Keep language beginner-friendly\n"
32
- "- Do not give too low marks unless the answer is entirely unrelated."
33
- )
34
-
35
- def prompt_text_sql(combined_content):
36
- return (
37
- "You are a SQL expert evaluating beginner SQL queries. "
38
- "Focus on query correctness, efficiency, proper use of SQL syntax, and alignment with the question's requirements.\n\n"
39
- "IMPORTANT: First, check if the student's answer is relevant to SQL. "
40
- "If the answer is clearly about a different subject (e.g., Python or Power BI), assign a low score (10–25/100) "
41
- "and explain the mismatch in a supportive way.\n\n"
42
- "Your evaluation should:\n"
43
- "- Focus on clarity, correctness, and understanding of the SQL content\n"
44
- "- Be constructive and encouraging (students are beginners)\n"
45
- "- Highlight both strengths and areas for improvement\n"
46
- "- Identify major mistakes or misunderstandings\n"
47
- "- Be concise but insightful\n"
48
- "- Check for query optimization and adherence to the question's intent\n\n"
49
- "Provide feedback in this format:\n\n"
50
- "=== COMPREHENSIVE EVALUATION ===\n\n"
51
- "OVERALL SCORE: <score>/100\n\n"
52
- "FEEDBACK SUMMARY:\n"
53
- "- What was done well\n"
54
- "- What needs improvement\n"
55
- "- Any major issues (e.g., logic errors, misunderstanding, incomplete solutions)\n\n"
56
- "KEY ADVICE:\n"
57
- "- Top 2-3 suggestions to improve SQL skills\n"
58
- "- Highlight any concepts to revisit\n"
59
- "- Encourage further learning and effort\n\n"
60
- "FEEDBACK SUMMARY (in Uzbek):\n"
61
- "- Nima yaxshi bajarilgan\n"
62
- "- Nimalar ustida ishlash kerak\n"
63
- "- Jiddiy xatoliklar yoki noto‘g‘ri tushunchalar\n\n"
64
- f"{combined_content}\n"
65
- "=== EVALUATION COMPLETE ===\n\n"
66
- "Notes:\n"
67
- "- Be honest but supportive\n"
68
- "- Include specific examples from the provided answers if helpful\n"
69
- "- Keep language beginner-friendly\n"
70
- "- Do not give too low marks unless the subject is clearly unrelated."
71
- )
72
-
73
- def prompt_text_ssis(combined_content):
74
- return (
75
- "You are a data engineer reviewing an SSIS package (.dtsx) summary. "
76
- "Evaluate the correctness of tasks, data flow, control flow, and configurations.\n\n"
77
- "IMPORTANT: First, check if the answer is related to SSIS. "
78
- "If the answer is clearly unrelated (e.g., contains Python or SQL code), assign a low score (10–25/100) "
79
- "and explain the mismatch supportively.\n\n"
80
- "Your evaluation should:\n"
81
- "- Assess how well the package addresses the question\n"
82
- "- Focus on clarity, accuracy, and understanding of key SSIS components\n"
83
- "- Be supportive and constructive\n"
84
- "- Highlight what was done well and what could be improved\n"
85
- "- Point out only major issues if necessary\n"
86
- "- Keep feedback clear and insightful\n"
87
- "- Do not penalize for lack of advanced scheduling (e.g., SQL Agent use)\n\n"
88
- "Provide feedback in this format:\n\n"
89
- "=== COMPREHENSIVE EVALUATION ===\n\n"
90
- "OVERALL SCORE: <score>/100\n\n"
91
- "FEEDBACK SUMMARY:\n"
92
- "- What was done well\n"
93
- "- What needs improvement\n"
94
- "- Any major issues (e.g., logic errors, misunderstandings, incomplete solutions)\n\n"
95
- "KEY ADVICE:\n"
96
- "- Top 2-3 suggestions to improve SSIS skills\n"
97
- "- Concepts to revisit\n"
98
- "- Encouragement to keep learning and improving\n\n"
99
- f"{combined_content}\n"
100
- "=== EVALUATION COMPLETE ===\n\n"
101
- "Notes:\n"
102
- "- Be honest but supportive\n"
103
- "- Include specific examples if helpful\n"
104
- "- Keep language beginner-friendly\n"
105
- "- Give credit for effort, even if technically incorrect. Use low scores only if clearly unrelated."
106
- )
107
-
108
- def prompt_text_powerbi(combined_content):
109
- return (
110
- "You are a BI professional evaluating Power BI report solutions, including DAX formulas, "
111
- "data models, and visual design.\n\n"
112
- "IMPORTANT: First, check if the student's answer is related to Power BI. "
113
- "If it is clearly from a different domain (e.g., Python or SQL code), assign a low score (10–25/100) "
114
- "and clearly explain the mismatch.\n\n"
115
- "Your evaluation should:\n"
116
- "- Focus on clarity, correctness, and understanding of Power BI content\n"
117
- "- Be constructive and encouraging (students are beginners)\n"
118
- "- Highlight strengths and areas for improvement\n"
119
- "- Identify major mistakes (e.g., incorrect DAX, poor data modeling)\n"
120
- "- Be concise but insightful\n"
121
- "- Evaluate DAX, visuals, and data model structure\n"
122
- "- Avoid penalizing for advanced design features or best practices\n\n"
123
- "Provide feedback in this format:\n\n"
124
- "=== COMPREHENSIVE EVALUATION ===\n\n"
125
- "OVERALL SCORE: <score>/100\n\n"
126
- "FEEDBACK SUMMARY:\n"
127
- "- What was done well\n"
128
- "- What needs improvement\n"
129
- "- Any major issues (e.g., incorrect DAX, missing visuals, poor relationships)\n\n"
130
- "KEY ADVICE:\n"
131
- "- Top 2-3 suggestions to improve Power BI skills\n"
132
- "- Highlight any concepts to revisit\n"
133
- "- Encourage further learning and effort\n\n"
134
- f"{combined_content}\n"
135
- "=== EVALUATION COMPLETE ===\n\n"
136
- "Notes:\n"
137
- "- Be honest but supportive\n"
138
- "- If the subject is mismatched, clearly state that in feedback and give a low score (10–25/100)\n"
139
- "- Keep language beginner-friendly"
140
- )
File without changes
File without changes