Skip to content

Commit ce5b90e

Browse files
committed
Remove TestController that was used for evaluation and add analysis prompt variants
1 parent 466fbb3 commit ce5b90e

3 files changed

Lines changed: 78 additions & 89 deletions

File tree

src/main/java/de/unistuttgart/iste/meitrex/assignment_service/service/uml_assignment/UmlEvaluationService.java

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package de.unistuttgart.iste.meitrex.assignment_service.service.uml_assignment;
22

3-
import de.unistuttgart.iste.meitrex.assignment_service.controller.UmlTestController;
43
import de.unistuttgart.iste.meitrex.assignment_service.exception.AiEvaluationException;
54
import de.unistuttgart.iste.meitrex.assignment_service.persistence.entity.umlExercise.UmlEvaluationJobEntity;
65
import de.unistuttgart.iste.meitrex.assignment_service.persistence.entity.umlExercise.UmlFeedbackEntity;
@@ -161,94 +160,6 @@ private UmlFeedbackResponse performGrading(
161160
return response;
162161
}
163162

164-
/**
165-
* Executes the evaluation pipeline without saving to the database.
166-
* Returns granular timings for benchmarking LLM configurations.
167-
*/
168-
public UmlTestController.TestEvalResponse dryRunEvaluation(
169-
final String studentModel,
170-
final String tutorModel,
171-
final String gradingRules,
172-
final int maxPoints,
173-
final double requiredPercentage,
174-
final String analysisModelOverride,
175-
final String gradingModelOverride,
176-
final String promptMode,
177-
final String taskDescription
178-
) {
179-
long startTotal = System.currentTimeMillis();
180-
181-
// 1. Run Analysis with Timer
182-
long startAnalysis = System.currentTimeMillis();
183-
Map<String, String> analysisArgs = new HashMap<>();
184-
analysisArgs.put("studentModel", studentModel);
185-
186-
UmlAnalysisResponse fallbackAnalysis = new UmlAnalysisResponse(
187-
Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), false, "Analysis failed."
188-
);
189-
190-
String prompt;
191-
if ("TASK_BASED".equals(promptMode)) {
192-
prompt = "analysis_task.md";
193-
analysisArgs.put("taskDescription", taskDescription);
194-
analysisArgs.put("tutorModel", tutorModel);
195-
} else if ("PURE_TASK".equals(promptMode)) {
196-
prompt = "uml_analysis_pure_task.md";
197-
analysisArgs.put("taskDescription", taskDescription);
198-
} else {
199-
prompt = TEMPLATE_ANALYSIS;
200-
analysisArgs.put("tutorModel", tutorModel);
201-
}
202-
203-
UmlAnalysisResponse analysis = ollamaClient.startQuery(
204-
UmlAnalysisResponse.class, prompt, analysisArgs, fallbackAnalysis, analysisModelOverride);
205-
206-
long endAnalysis = System.currentTimeMillis();
207-
double analysisDuration = (endAnalysis - startAnalysis) / 1000.0;
208-
209-
if ("Analysis failed.".equals(analysis.analysisSummary())) {
210-
throw new RuntimeException("Analysis LLM failed during dry run.");
211-
}
212-
213-
// 2. Run Grading with Timer
214-
long startGrading = System.currentTimeMillis();
215-
String effectiveRules = (gradingRules != null && !gradingRules.isBlank()) ? gradingRules : "Standard UML grading.";
216-
Map<String, String> gradingArgs = Map.of(
217-
"maxPoints", String.valueOf(maxPoints),
218-
"passingThreshold", String.valueOf(requiredPercentage * maxPoints),
219-
"showSolution", "true",
220-
"gradingRules", effectiveRules,
221-
"isValid", String.valueOf(analysis.isSemanticallyValid()),
222-
"correctElements", formatListForPrompt(analysis.correctElements()),
223-
"semanticErrors", formatListForPrompt(analysis.semanticErrors()),
224-
"missingElements", formatListForPrompt(analysis.missingElements())
225-
);
226-
227-
UmlFeedbackResponse fallbackGrading = new UmlFeedbackResponse("Grading unavailable.", 0);
228-
229-
UmlFeedbackResponse grading = ollamaClient.startQuery(
230-
UmlFeedbackResponse.class, TEMPLATE_GRADING, gradingArgs, fallbackGrading, gradingModelOverride);
231-
232-
long endGrading = System.currentTimeMillis();
233-
double gradingDuration = (endGrading - startGrading) / 1000.0;
234-
235-
if ("Grading unavailable.".equals(grading.feedbackText())) {
236-
throw new RuntimeException("Grading LLM failed during dry run.");
237-
}
238-
239-
long endTotal = System.currentTimeMillis();
240-
double totalDuration = (endTotal - startTotal) / 1000.0;
241-
242-
// Return the combined payload
243-
return new UmlTestController.TestEvalResponse(
244-
grading.points(),
245-
grading.feedbackText(),
246-
analysisDuration,
247-
gradingDuration,
248-
totalDuration
249-
);
250-
}
251-
252163
/**
253164
* Safely formats a list of strings into a single semicolon-separated string.
254165
* <p>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
### ROLE
2+
You are a Requirements-Driven Software Architecture Evaluator.
3+
You are evaluating a student's UML class diagram based *strictly on the original assignment task*. A Tutor Reference Solution is provided, but it is only *one possible valid solution*, not the absolute truth.
4+
5+
### DATA TO ANALYZE
6+
- **Original Assignment Task:**
7+
---
8+
{{taskDescription}}
9+
---
10+
- **Tutor Reference Solution (Use as a complexity hint only):**
11+
---
12+
{{tutorModel}}
13+
---
14+
- **Student Submission:**
15+
---
16+
{{studentModel}}
17+
---
18+
19+
### EVALUATION STRATEGY
20+
1. Read the **Assignment Task** to understand the required entities, attributes, and relationships.
21+
2. Analyze the **Student Submission**. Does it fulfill the core requirements of the task?
22+
3. If the student diverges from the Tutor Reference but still logically satisfies the Assignment Task (e.g., using a List of Enum values instead of a dedicated Rating class), mark it as **CORRECT**.
23+
4. Do NOT penalize for minor syntax variations (`int` vs `Integer`) or slightly different but logical association names.
24+
25+
### CATEGORIZATION STRICTNESS
26+
- **correctElements:** List elements that successfully fulfill a requirement from the Assignment Task.
27+
- **missingElements:** List elements explicitly requested by the Assignment Task that the student failed to include.
28+
- **semanticErrors:** List elements that violate UML logic or explicitly contradict the Assignment Task.
29+
30+
### CRITICAL OUTPUT RULES
31+
- Ignore visual layout coordinates.
32+
- Output ONLY valid JSON matching the exact schema below.
33+
34+
**Output Format (JSON):**
35+
{
36+
"correctElements": ["Elements fulfilling the task requirements."],
37+
"semanticErrors": ["Logical violations or contradictions of the task."],
38+
"missingElements": ["Elements required by the task that are missing."],
39+
"isSemanticallyValid": <boolean>,
40+
"analysisSummary": "A concise summary of how well the student met the task requirements."
41+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
### ROLE
2+
You are an Expert Requirements Engineer and Software Architecture Evaluator.
3+
Your task is to evaluate a student's UML class diagram based STRICTLY and ONLY on the original assignment task. You do not have a reference solution. You must deduce the correctness entirely from domain logic and the provided requirements.
4+
5+
### DATA TO ANALYZE
6+
- **Original Assignment Task:**
7+
---
8+
{{taskDescription}}
9+
---
10+
- **Student Submission:**
11+
---
12+
{{studentModel}}
13+
---
14+
15+
### EVALUATION STRATEGY
16+
1. Read the **Assignment Task** and extract every explicit requirement (entities, attributes, and relationships).
17+
2. Analyze the **Student Submission**. Check if every requirement from the task is fulfilled.
18+
3. Because there is no reference solution, you must be tolerant of different architectural choices. If a student uses an Enum, a Class, or an Interface in a way that logically solves the domain problem described in the task, mark it as CORRECT.
19+
4. Only penalize elements if they directly contradict the task description or violate standard UML logic.
20+
21+
### CATEGORIZATION STRICTNESS
22+
- **correctElements:** List elements that successfully fulfill a requirement from the Assignment Task.
23+
- **missingElements:** List elements explicitly requested by the Assignment Task that the student failed to include.
24+
- **semanticErrors:** List elements that violate UML logic or explicitly contradict the Assignment Task.
25+
26+
### CRITICAL OUTPUT RULES
27+
- Ignore visual layout coordinates (pos, vdist, layout, etc.).
28+
- Output ONLY valid JSON matching the exact schema below.
29+
30+
**Output Format (JSON):**
31+
{
32+
"correctElements": ["Elements fulfilling the task requirements."],
33+
"semanticErrors": ["Logical violations or contradictions of the task."],
34+
"missingElements": ["Elements required by the task that are missing."],
35+
"isSemanticallyValid": <boolean>,
36+
"analysisSummary": "A concise summary of how well the student met the task requirements based ONLY on the text prompt."
37+
}

0 commit comments

Comments
 (0)