--- /dev/null
+all : .venv/touchfile
+ OPENAI_API_KEY="$$(cat api_key)" .venv/bin/flask --app main run --host 127.0.0.1 --port 5000 --debug
+
+.venv/touchfile : requirements.txt
+ python3 -m venv .venv
+ .venv/bin/python -m pip install -r requirements.txt
import xml.etree.ElementTree as et
-from ollama import Client
+from openai import OpenAI
import re
class commissioner():
self.log = []
self.dream = ""
- self.client = Client(host='http://127.0.0.1:11434')
+ self.client = OpenAI()
self.gamespace = """
<cardGame>
self.instability = 0
self.log = []
- response = self.client.chat(model='deepseek-r1:14b', messages=[{
- 'role': 'user',
- 'content': f"""
+ response = self.client.responses.create(model='gpt-5-nano', input=f"""
Below is some XML describing a card game.\n
The outer element is the "cardGame" element. Inside the game there are the "player" elements (denoting players), the "message" element and "rule" elements (denoting the rules of the game that should be applied). "rule" elements have the attribute "lifespan" describing when they should be removed from "cardGame". "player" elements contain cards but also the "state" element.\n
The state can either be "playing", "stuck", "bust" or "winner".\n
Card game XML follows:\n
{self.gamespace}
"""
- }])
+ )
think = re.search(r"<think>[\n\D\d]*<\/think>", response.message.content) # get bounds of <think>
body = response.message.content[think.span()[1]:] # get body by removing <think>
@app.route("/")
def home():
- return render_template("index.html", title = 'Test')
+ return render_template("index.html")
@app.route("/api")
def get_gamespace():
with lock:
c.observe()
return "", 200
-
-if __name__ == "__main__":
- app.run(host='127.0.0.1', port=5000, debug=True)