34 lines
1023 B
Python
34 lines
1023 B
Python
import json
|
|
import re
|
|
|
|
from config import OPENROUTER_MODEL
|
|
from openrouter_client import client
|
|
from mcp_client import MCPClient
|
|
|
|
|
|
class Agent:
|
|
def __init__(self):
|
|
self.mcp = MCPClient()
|
|
self.tools = []
|
|
self.messages = [
|
|
{
|
|
"role": "system",
|
|
"content": (
|
|
"Du bist JARVIS, ein Smart-Home Assistent.\n"
|
|
"Du kannst MCP Tools verwenden.\n\n"
|
|
"Wenn du ein Tool benutzen willst, antworte STRICT als JSON:\n"
|
|
"{\n"
|
|
' "tool": "tool_name",\n'
|
|
' "args": {...}\n'
|
|
"}\n\n"
|
|
"Wenn kein Tool nötig ist:\n"
|
|
"{\n"
|
|
' "response": "Text"\n'
|
|
"}\n\n"
|
|
"WICHTIG:\n"
|
|
"- KEIN Markdown\n"
|
|
"- KEIN zusätzlicher Text\n"
|
|
"- NUR JSON\n"
|
|
)
|
|
}
|
|
] |