Commit dae35034 authored by Kantz's avatar Kantz
Browse files

more testing

parent ef617e1d
......@@ -67,7 +67,7 @@ def save_canvas(request: CanvasSaveRequest) -> CanvasSaveResponse:
with file_path.open("wb") as handle:
handle.write(raw)
latex = "\\frac{a}{b}"
latex = "\\frac{a}{b}" # Placeholder
if mathpix_client:
try:
image = mathpix_client.image_new(str(file_path))
......
......@@ -39,7 +39,7 @@ class IngestRequest(BaseModel):
class QueryRequest(BaseModel):
pg_url: Optional[str] = None
query: str = Field(..., min_length=1)
k: int = 8
k: int = 4
expand_links: bool = True
section_index: Optional[int] = None
subsection_index: Optional[int] = None
......
......@@ -19,7 +19,7 @@ Zitiere Quellen inline mit den eckigen Klammern, die im Kontext vorangestellt si
"""
CONTEXT_LIMITS = {
"direct": 8,
"direct": 4,
"indirect": 6,
"subsection": 2,
"section": 1,
......
......@@ -14,7 +14,7 @@ _LOG_DIR = os.path.join("logs", "context_sheets")
def _utc_now() -> str:
return datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
return datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ")
def is_new_chat(messages: list[dict]) -> bool:
......
......@@ -62,12 +62,15 @@ def run_chat(messages: list[dict], draft: str | None = None) -> dict:
_bootstrap_context(sheet, last_user.get("content", ""), tool_log)
sheet_text = context_store.format_sheet(sheet)
reply = hint_tool.generate_hint(
task=last_user.get("content", ""),
solution=context_store.latest_math_solution(sheet),
history=history_text,
context_sheet=sheet_text,
)
hint_args = {
"task": last_user.get("content", ""),
"solution": context_store.latest_math_solution(sheet),
"history": history_text,
"context_sheet": sheet_text,
}
reply = hint_tool.generate_hint(**hint_args)
context_store.add_tool_output(sheet, {"name": "generate_hint", "arguments": hint_args, "response": reply})
_append_tool_log(tool_log, "generate_hint", hint_args, reply)
if not reply:
reply = "Dazu steht nichts im Material"
......
......@@ -20,7 +20,7 @@ SYSTEM_PROMPT = (
)
CONTEXT_LIMITS = {
"direct": 8,
"direct": 4,
"indirect": 6,
"subsection": 2,
"section": 1,
......
......@@ -272,7 +272,7 @@ def retrieve(
pg_url: str,
embedder: EmbeddingLike,
query: str,
k: int = 8,
k: int = 4,
section_index: Optional[int] = None,
subsection_index: Optional[int] = None,
type_filter: Optional[List[str]] = None,
......
......@@ -9,7 +9,7 @@ def generate_hint(
) -> str:
prompt = (
"Du bist ein didaktischer Tutor. "
"Gib einen naechsten hilfreichen Hinweis, aber keine komplette Loesung. "
"Gib einen naechsten hilfreichen Hinweis, gib auf keinen Fall eine Lösung aus. Wiederhole nicht den Kontex"
"Halte dich kurz und klar.\n\n"
"Aufgabe:\n"
+ task
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment