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
90e48a24
Commit
90e48a24
authored
Feb 03, 2026
by
Kantz
Browse files
hint Generator tests
parent
aab2c5f0
Changes
2
Show whitespace changes
Inline
Side-by-side
math-tutor/backend/app/LLM_services/hint_LLM.py
View file @
90e48a24
...
...
@@ -14,6 +14,7 @@ def generate_hint(
"Antworte nur mit dem Tipp, ohne weitere Erklärungen."
"Gibe keine komplette Lösung der Aufgabe."
"Die Mathematische Lösung hat immer Vorrang vor der LLM Lösung."
"Halte dich kurz und prägnant."
)
prompt
=
(
"Aufgabe:
\n
"
...
...
@@ -29,7 +30,7 @@ def generate_hint(
prompt
+=
"
\n
Historie:
\n
"
+
history
+
"
\n
"
if
retrival
:
prompt
=
"
\n
Kontext:
\n
"
+
retrival
+
"
\n
"
+
prompt
prompt
+=
"
\n
Gebe einen hilfreichen Tipp zur Lösung der Aufgabe. Halte dich kurz und prägnant."
result
=
llm_client
.
chat
(
messages
=
[{
"role"
:
"system"
,
"content"
:
system_prompt
},
{
"role"
:
"user"
,
"content"
:
prompt
}],
)
...
...
math-tutor/backend/app/test/hint_test.py
0 → 100644
View file @
90e48a24
import
argparse
import
json
import
os
from
typing
import
Any
from
app.LLM_services
import
hint_LLM
from
app.deterministic_services
import
context_store
def
_load_sheet_from_path
(
path
:
str
)
->
dict
[
str
,
Any
]:
with
open
(
path
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
return
json
.
load
(
f
)
def
_resolve_sheet
(
args
:
argparse
.
Namespace
)
->
dict
[
str
,
Any
]:
if
args
.
sheet
:
return
_load_sheet_from_path
(
args
.
sheet
)
if
args
.
chat_id
:
sheet
=
context_store
.
load_sheet
(
args
.
chat_id
)
if
sheet
is
None
:
raise
FileNotFoundError
(
f
"Kein Context-Sheet gefunden fuer chat_id=
{
args
.
chat_id
}
"
)
return
sheet
raise
ValueError
(
"Bitte --sheet oder --chat-id angeben."
)
def
main
()
->
None
:
parser
=
argparse
.
ArgumentParser
(
description
=
"Isolierter Hint-LLM Test mit Context Sheet."
)
parser
.
add_argument
(
"--sheet"
,
help
=
"Pfad zu einem Context Sheet JSON."
)
parser
.
add_argument
(
"--chat-id"
,
help
=
"Chat-ID zum Laden aus logs/context_sheets."
)
args
=
parser
.
parse_args
()
sheet
=
_resolve_sheet
(
args
)
hint_args
=
{
"task"
:
context_store
.
get_task
(
sheet
),
"LLM_solution"
:
context_store
.
last_LLM_solution
(
sheet
),
"math_solution"
:
context_store
.
first_math_solution
(
sheet
),
"history"
:
context_store
.
get_history
(
sheet
),
"retrival"
:
context_store
.
get_retrival
(
sheet
),
}
reply
=
hint_LLM
.
generate_hint
(
**
hint_args
)
print
(
reply
)
if
__name__
==
"__main__"
:
main
()
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