agent.py gelöscht

This commit is contained in:
2026-07-04 19:36:57 +00:00
parent 10f7cd9a29
commit cb0eb4fc4d
-55
View File
@@ -1,55 +0,0 @@
import json
from llm import ask_llm
from mcp_client import MCPClient
mcp = MCPClient()
SYSTEM = """
Du bist JARVIS, ein Smart-Home Assistent.
Du kannst MCP Tools verwenden.
Wenn du ein Tool benutzen willst, antworte exakt im JSON Format:
{
"tool": "tool_name",
"args": { }
}
Wenn kein Tool nötig ist:
{
"response": "Text"
}
Beispiele Tools:
- openhab.items.set
- openhab.items.get
"""
def run_agent(user_input):
messages = [
{"role": "system", "content": SYSTEM},
{"role": "user", "content": user_input}
]
response = ask_llm(messages)
try:
data = json.loads(response)
if "tool" in data:
result = mcp.call_tool(data["tool"], data["args"])
followup = ask_llm([
{"role": "system", "content": "Formuliere eine natürliche Antwort aus diesem Ergebnis."},
{"role": "user", "content": str(result)}
])
return followup
return data["response"]
except:
return response