"""Test script for cog runtime API. Run with: .venv/Scripts/python.exe test_cog.py""" import httpx, sys, time API = "https://cog.loop42.de/api" TOKEN = "7Oorb9S3OpwFyWgm4zi_Tq7GeamefbjjTgooPVPWAwPDOf6B4TvgvQlLbhmT4DjsqBS_D1g" HEADERS = {"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"} def send(text): r = httpx.post(f"{API}/send", json={"text": text}, headers=HEADERS, timeout=30) d = r.json() return d.get("response", "").strip(), d.get("memorizer", {}) def clear(): httpx.post(f"{API}/clear", headers=HEADERS, timeout=10) tests = [ ("hello!", None), ("what is 42 * 137?", None), ("create a sqlite db with 5 customers and show them in a table", None), ("wie spaet ist es?", None), ] clear() print("=== COG TEST RUN ===\n") for i, (msg, _) in enumerate(tests, 1): print(f"--- {i}. USER: {msg}") resp, memo = send(msg) print(f" COG: {resp}") print(f" MEMO: name={memo.get('user_name')} mood={memo.get('user_mood')} topic={memo.get('topic')}") print() time.sleep(0.5) print("=== DONE ===")