Spaces:
Sleeping
Sleeping
Create interview_engine.py
Browse files- interview_engine.py +36 -0
interview_engine.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from llm import ask_llm
|
| 2 |
+
|
| 3 |
+
INTERVIEW_PROMPT = """
|
| 4 |
+
You are a strict technical examiner conducting a student project interview.
|
| 5 |
+
|
| 6 |
+
You are given:
|
| 7 |
+
1. Extracted project content (slides, code snippets, diagrams, UI elements)
|
| 8 |
+
2. The student's spoken explanation
|
| 9 |
+
|
| 10 |
+
Your task:
|
| 11 |
+
- Ask ONE clear, specific, technically deep follow-up question.
|
| 12 |
+
- Refer to implementation details where possible.
|
| 13 |
+
- Avoid generic or vague questions.
|
| 14 |
+
- Do NOT provide feedback or explanations.
|
| 15 |
+
- Output only the question.
|
| 16 |
+
"""
|
| 17 |
+
|
| 18 |
+
def generate_question(context: str, student_response: str) -> str:
|
| 19 |
+
prompt = f"""
|
| 20 |
+
{INTERVIEW_PROMPT}
|
| 21 |
+
|
| 22 |
+
--- Project Content ---
|
| 23 |
+
{context}
|
| 24 |
+
|
| 25 |
+
--- Student Explanation ---
|
| 26 |
+
{student_response}
|
| 27 |
+
|
| 28 |
+
Question:
|
| 29 |
+
"""
|
| 30 |
+
try:
|
| 31 |
+
question = ask_llm(prompt).strip()
|
| 32 |
+
if not question:
|
| 33 |
+
return "Could you explain more about your implementation details?"
|
| 34 |
+
return question
|
| 35 |
+
except Exception:
|
| 36 |
+
return "Could you elaborate further on a technical aspect of your project?"
|