diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4932494 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +# test/piped input +input.txt + +# session state +.last_model +*.last_model + +# transcripts +metatron-*.md + +# pycache +__pycache__/ +*.pyc diff --git a/test_metatron.py b/test_metatron.py new file mode 100644 index 0000000..f066467 --- /dev/null +++ b/test_metatron.py @@ -0,0 +1,25 @@ +import json +import urllib.request + +OLLAMA = "http://10.30.20.29:11434" + +# 1. model list +d = json.load(urllib.request.urlopen(OLLAMA + "/api/tags", timeout=15)) +names = [m["name"] for m in d["models"]] +print("MODELS:", len(names)) +for n in names: + print(" -", n) + +# 2. quick chat (non-streaming, think:false) +payload = { + "model": names[0], + "messages": [{"role": "user", "content": "Reply with exactly: METATRON OK"}], + "stream": False, + "think": False, + "options": {"num_predict": 30}, +} +req = urllib.request.Request( + OLLAMA + "/api/chat", data=json.dumps(payload).encode(), + headers={"Content-Type": "application/json"}) +r = json.load(urllib.request.urlopen(req, timeout=90)) +print("REPLY:", repr(r["message"].get("content", "")))