Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
math_tutor_dev
public_math_tutor
Commits
5e93567b
Commit
5e93567b
authored
Feb 17, 2026
by
Kantz
Browse files
Überarbeitung der Prompts
parent
ae81d3cd
Changes
5
Hide whitespace changes
Inline
Side-by-side
math-tutor/backend/app/LLM_services/decision_LLM.py
View file @
5e93567b
...
@@ -28,13 +28,12 @@ WICHTIG:
...
@@ -28,13 +28,12 @@ WICHTIG:
"""
"""
def
needs_more_context
(
context_sheet
:
str
)
->
dict
:
def
needs_more_context
(
context_sheet
:
str
)
->
dict
:
return
{
"needs_more_context"
:
False
,
"reason"
:
"nicht funktional"
}
messages
=
[{
"role"
:
"system"
,
"content"
:
CLASSIFIER_SYSTEM
}]
messages
=
[{
"role"
:
"system"
,
"content"
:
CLASSIFIER_SYSTEM
}]
messages
.
append
(
messages
.
append
(
{
{
"role"
:
"user"
,
"role"
:
"user"
,
"content"
:
"Kontextblatt:
\n
"
"content"
:
"Kontextblatt:
\n
"
f
"
{
context_sheet
}
\n\n
"
f
"
{
context_sheet
}
\n\n
Entscheide nur über den Kontext und nutze context_decision.
"
}
}
)
)
...
...
math-tutor/backend/app/LLM_services/hint_LLM.py
View file @
5e93567b
...
@@ -8,11 +8,11 @@ Du bist ein didaktischer Mathe-Tutor."
...
@@ -8,11 +8,11 @@ Du bist ein didaktischer Mathe-Tutor."
3) Wenn der Nutzer etwas Falsches sagt weiße ihn darauf hin gib aber keine Lösung an.
3) Wenn der Nutzer etwas Falsches sagt weiße ihn darauf hin gib aber keine Lösung an.
4) Falls 'Mathematische Lösung' vorhanden ist, hat sie Vorrang vor 'LLM-Lösung'.
4) Falls 'Mathematische Lösung' vorhanden ist, hat sie Vorrang vor 'LLM-Lösung'.
verwende die $
$
für mathematische Formeln, z.B.
$
$a^2 + b^2 = c^2$
$
verwende die $ für mathematische Formeln, z.B. $a^2 + b^2 = c^2$
Antworte mit folgender Struktur
Antworte mit folgender Struktur
Das war richtig/das ist noch nicht richtig/gute Frage
Das war richtig/das ist noch nicht richtig/gute Frage
<N
ächster Tipp um weiter zu machen/um den Fehler zu korrigieren
>
[Hier soll der n
ächster Tipp um weiter zu machen/um den Fehler zu korrigieren
stehen ohne Klammern]
"""
"""
def
generate_hint
(
def
generate_hint
(
...
...
math-tutor/backend/app/LLM_services/math_intent_LLM.py
View file @
5e93567b
...
@@ -36,16 +36,16 @@ Wenn es nichts zu berechnen gibt Rechung gibt gib "None" aus.
...
@@ -36,16 +36,16 @@ Wenn es nichts zu berechnen gibt Rechung gibt gib "None" aus.
Wenn eine Rechnung nötig ist, nutze das Tool sympy_solve.
Wenn eine Rechnung nötig ist, nutze das Tool sympy_solve.
Wichtig: Übergib in input eine gültige SymPy-Expression (kein LaTeX).
Wichtig: Übergib in input eine gültige SymPy-Expression (kein LaTeX).
Antworte nach folgendem Muster:
Antworte nach folgendem Muster:
"Rechung:
<Rechung>
"Rechung:
[hier soll die Rechung stehen ohne Klammern]
Lösung:
<Lösung>
"
Lösung:
[Hier soll die Lösung stehen ohne Klammern]
"
ODER
ODER
"Keine Lösung"
"Keine Lösung"
"""
"""
def
solve_with_tools
(
user_text
:
str
,
model
:
str
=
"ministral-3"
)
->
str
:
def
solve_with_tools
(
user_text
:
str
)
->
str
:
messages
=
[
messages
=
[
{
"role"
:
"system"
,
"content"
:
SYSTEM
},
{
"role"
:
"system"
,
"content"
:
SYSTEM
},
{
"role"
:
"user"
,
"content"
:
user_text
+
"
\n
Antworte mit '
None
' falls es in dieser Nachricht KEINE Berechung gibt."
},
{
"role"
:
"user"
,
"content"
:
user_text
+
"
\n
Antworte
nur
mit '
Keine Lösung
' falls es in dieser Nachricht KEINE Berechung gibt."
},
]
]
result
,
tool_outputs
=
llm_client
.
chat_with_tools
(
result
,
tool_outputs
=
llm_client
.
chat_with_tools
(
...
...
math-tutor/backend/app/deterministic_services/orchestrators/orchestrator_base.py
View file @
5e93567b
...
@@ -156,19 +156,7 @@ def bootstrap_retrieval(sheet: dict, query_text: str, tool_log: list[dict]) -> N
...
@@ -156,19 +156,7 @@ def bootstrap_retrieval(sheet: dict, query_text: str, tool_log: list[dict]) -> N
finished_at
=
finished_at
,
finished_at
=
finished_at
,
duration_ms
=
duration_ms
,
duration_ms
=
duration_ms
,
)
)
started_at
,
started_perf
=
_start_timing
()
context_store
.
update_retrieval_context
(
sheet
,
sources
)
context_store
.
update_retrieval_context
(
sheet
,
sources
)
finished_at
,
duration_ms
=
_finish_timing
(
started_perf
)
append_tool_log
(
tool_log
,
"update_retrieve_context"
,
{
"query"
:
query_text
},
source_dump
,
started_at
=
started_at
,
finished_at
=
finished_at
,
duration_ms
=
duration_ms
,
)
def
init_chat_state
(
messages
:
list
[
dict
],
draft
:
str
|
None
=
None
)
->
ChatState
:
def
init_chat_state
(
messages
:
list
[
dict
],
draft
:
str
|
None
=
None
)
->
ChatState
:
...
...
math-tutor/backend/app/deterministic_services/orchestrators/orchestrator_tutor.py
View file @
5e93567b
...
@@ -39,7 +39,7 @@ def _on_turn_logic(state: base.ChatState) -> None:
...
@@ -39,7 +39,7 @@ def _on_turn_logic(state: base.ChatState) -> None:
context_store
.
add_decision
(
state
.
sheet
,
decision
)
context_store
.
add_decision
(
state
.
sheet
,
decision
)
if
decision
.
get
(
"needs_more_context"
):
if
decision
.
get
(
"needs_more_context"
):
full_query
=
"
\n
"
.
join
(
base
.
extract_user_messages
(
state
.
sheet
))
full_query
=
"
\n
"
.
join
(
base
.
extract_user_messages
(
state
.
messages
))
_on_bootstrap
(
state
,
full_query
)
_on_bootstrap
(
state
,
full_query
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment