19 lines
817 B
Python
19 lines
817 B
Python
"""Test /ask on live Fractonaut."""
|
|
import json, urllib.request, sys, time
|
|
URL = "http://127.0.0.1:28822/ask"
|
|
q = sys.argv[1] if len(sys.argv) > 1 else (
|
|
"Describe what you observe right now. Three injection channels are active. "
|
|
"Is the field ordered or turbulent? What is the relationship between "
|
|
"asymmetry and coherence telling you, and what does stress_xx vs stress_yy "
|
|
"say about the buy/sell skew?"
|
|
)
|
|
data = json.dumps({"question": q}).encode()
|
|
req = urllib.request.Request(URL, data=data, headers={"Content-Type": "application/json"}, method="POST")
|
|
t0 = time.time()
|
|
with urllib.request.urlopen(req, timeout=180) as r:
|
|
res = json.loads(r.read())
|
|
el = time.time() - t0
|
|
print(f"({el:.1f}s) model={res.get('model')} turn={res.get('turn')}")
|
|
print()
|
|
print(res.get("response", "(none)"))
|