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
39de7efd
Commit
39de7efd
authored
Feb 10, 2026
by
Kantz
Browse files
anpassung des retrival fertig und kleine anpassung an der Hint generierung.
parent
9bd364f5
Changes
4
Show whitespace changes
Inline
Side-by-side
math-tutor/backend/app/LLM_services/hint_LLM.py
View file @
39de7efd
...
...
@@ -2,6 +2,7 @@ from app.deterministic_services import llm_client
def
generate_hint
(
query
:
str
,
task
:
str
,
LLM_solution
:
str
,
math_solution
:
str
|
None
=
None
,
...
...
@@ -10,9 +11,9 @@ def generate_hint(
)
->
str
:
system_prompt
=
(
"Du bist ein didaktischer Tutor. "
"Gebe dem Nutzer hilfreiche Tipps um mathematische Aufgaben zu lösen.
"
"
Antworte nur mit dem Tipp, oh
ne
w
ei
tere Erklärungen
."
"G
i
be keine komplette Lösung der Aufgabe."
"Gebe dem Nutzer hilfreiche Tipps um mathematische Aufgaben zu lösen."
"
Gebe kei
ne
B
ei
spiele oder Erklärungen, sondern nur den Tipp
."
"G
e
be keine komplette Lösung der Aufgabe."
"Die Mathematische Lösung hat immer Vorrang vor der LLM Lösung."
"Halte dich kurz und prägnant."
)
...
...
@@ -27,10 +28,12 @@ def generate_hint(
if
math_solution
:
prompt
+=
"Mathematische Loesung:
\n
"
+
math_solution
+
"
\n
"
if
history
:
prompt
+
=
"
\n
Historie:
\n
"
+
history
+
"
\n
"
prompt
=
"
\n
Historie:
\n
"
+
history
+
"
\n
"
+
prompt
if
sources
:
prompt
=
"
\n
Kontext:
\n
"
+
sources
+
"
\n
"
+
prompt
prompt
+=
"
\n
Gebe einen hilfreichen Tipp zur Lösung der Aufgabe. Halte dich kurz und prägnant."
if
query
:
prompt
+=
"
\n
Aktuelle Frage:"
+
query
prompt
+=
"
\n
Gebe einen hilfreichen Tipp zur Lösung der Aufgabe der mir bei meiner aktuellen Frage hilft. Halte dich kurz und prägnant."
result
=
llm_client
.
chat
(
messages
=
[{
"role"
:
"system"
,
"content"
:
system_prompt
},
{
"role"
:
"user"
,
"content"
:
prompt
}],
)
...
...
math-tutor/backend/app/api/chat.py
View file @
39de7efd
...
...
@@ -8,8 +8,8 @@ from fastapi import APIRouter, HTTPException, Path, Query
from
pydantic
import
BaseModel
,
Field
from
app.deterministic_services
import
session_store
from
app.deterministic_services.orchestrators
import
orchestrator_tutor
from
app.deterministic_services.orchestrators
import
orchestrator_QA
as
orchestrator
from
app.deterministic_services.orchestrators
import
orchestrator_tutor
as
orchestrator
from
app.deterministic_services.orchestrators
import
orchestrator_QA
...
...
math-tutor/backend/app/deterministic_services/orchestrators/orchestrator_tutor.py
View file @
39de7efd
...
...
@@ -91,6 +91,7 @@ def run_chat(messages: list[dict], draft: str | None = None) -> dict:
# Hinweis und Ausgaben generierung
hint_args
=
{
"query"
:
last_user
if
not
new_chat
else
None
,
"task"
:
context_store
.
get_task
(
sheet
),
"LLM_solution"
:
context_store
.
last_LLM_solution
(
sheet
),
"math_solution"
:
context_store
.
first_math_solution
(
sheet
),
...
...
math-tutor/backend/app/deterministic_services/retrieval_service.py
View file @
39de7efd
...
...
@@ -11,7 +11,7 @@ from app.deterministic_services import vector_store
def
retrieve_context
(
query_text
:
str
,
pg_url
:
str
|
None
=
None
)
->
List
[
Source
]:
embedder
=
EmbeddingFactory
.
create
(
config
.
get_embedding_
config
())
embedder
=
EmbeddingFactory
.
create
(
config
.
get_embedding_
settings
())
url
=
pg_url
or
config
.
get_postgres_url
()
sources
=
vector_store
.
retrieve
(
pg_url
=
url
,
...
...
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