Commit 403696e4 authored by Kantz's avatar Kantz
Browse files

anpassung des Tools um Laufzeit zu verkürzen

parent 436a6311
import sympy as sp import sympy as sp
import json
from app.deterministic_services import llm_client from app.deterministic_services import llm_client
...@@ -33,15 +32,20 @@ def sympy_solve(task: str, input: str, symbols: list[str] | None = None) -> str: ...@@ -33,15 +32,20 @@ def sympy_solve(task: str, input: str, symbols: list[str] | None = None) -> str:
SYSTEM = """ SYSTEM = """
Du bist ein Mathe-Assistent. Du bist ein Mathe-Assistent.
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 final mit dem vereinfachten Ergebnis (kein Doppelbruch). Antworte nach folgendem Muster:
"Rechung: <Rechung>
Lösung: <Lösung>"
ODER
"Keine Lösung"
""" """
def solve_with_tools(user_text: str, model: str = "ministral-3") -> str: def solve_with_tools(user_text: str, model: str = "ministral-3") -> str:
messages = [ messages = [
{"role": "system", "content": SYSTEM}, {"role": "system", "content": SYSTEM},
{"role": "user", "content": user_text}, {"role": "user", "content": user_text + "\nAntworte mit 'None' falls es in dieser Nachricht KEINE Berechung gibt."},
] ]
result, tool_outputs = llm_client.chat_with_tools( result, tool_outputs = llm_client.chat_with_tools(
......
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