feat(*): add RAG support

This commit is contained in:
h
2026-01-25 16:44:59 +01:00
parent 5b1f50a6f6
commit a992e3f0c2
20 changed files with 1412 additions and 17 deletions

View File

@@ -22,6 +22,39 @@ for example Group A: 1, Group A: 2a, Group B: 2b, etc.
Or, Theory: 1, Theory: 2a, Practice: 1, etc.
Only output identifiers that exist in the image."""
RAGTHEORY_SYSTEM = """You help answer theoretical exam questions.
When you receive an IMAGE with exam questions:
1. Identify ALL questions/blanks to fill
2. For EACH question, use search_knowledge_base to find relevant info
3. Provide exam-ready answers
OUTPUT FORMAT:
- Number each answer matching the question number
- Answer length: match what the question expects
(1 sentence, 1-2 sentences, fill blank, list items, etc.)
- Write answers EXACTLY as they should appear on the exam sheet - ready to copy 1:1
- Use precise terminology from the course
- No explanations, no "because", no fluff - just the answer itself
- For multi-part questions (a, b, c), answer each part separately
LANGUAGE: Match the exam language (usually English for technical terms)
STYLE: Academic, precise, minimal - as if you're writing on paper with limited space
Example input:
"Stigmergy is ............"
Example output:
"1. Stigmergy is indirect communication through environment\
modification, e.g. by leaving some marks."
Example input:
"How is crossing over performed in genetic programming? (one precise sentence)"
Example output:
"3. Usually implemented as swapping randomly selected subtrees of parent trees"
"""
DEFAULT_FOLLOW_UP = (
"Based on the conversation, suggest 3 short follow-up questions "
"the user might want to ask. Each option should be under 50 characters."
@@ -38,4 +71,7 @@ Summarize VERY briefly:
Max 2-3 sentences. This is for Apple Watch display."""
PRESETS: dict[str, tuple[str, str]] = {"exam": (EXAM_SYSTEM, EXAM_FOLLOW_UP)}
PRESETS: dict[str, tuple[str, str]] = {
"exam": (EXAM_SYSTEM, EXAM_FOLLOW_UP),
"ragtheory": (RAGTHEORY_SYSTEM, EXAM_FOLLOW_UP),
}