Spaces:
Running
Running
Create test_gpt5.py
Browse files- test_gpt5.py +24 -0
test_gpt5.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import openai
|
| 3 |
+
|
| 4 |
+
openai.api_key = os.environ.get("OPENAI_API_KEY") # set your key in environment
|
| 5 |
+
|
| 6 |
+
system_prompt = """
|
| 7 |
+
You are BOXTRON-AI, a professional boxing analyst...
|
| 8 |
+
""" # copy your system prompt
|
| 9 |
+
|
| 10 |
+
history = [
|
| 11 |
+
{"role": "user", "content": "Predict Lemont Roach vs Isaac Cruz undercard round by round."}
|
| 12 |
+
]
|
| 13 |
+
|
| 14 |
+
messages = [{"role": "system", "content": system_prompt}]
|
| 15 |
+
messages.extend(history)
|
| 16 |
+
|
| 17 |
+
response = openai.ChatCompletion.create(
|
| 18 |
+
model="gpt-5-mini",
|
| 19 |
+
messages=messages,
|
| 20 |
+
max_tokens=800,
|
| 21 |
+
temperature=0.7
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
print(response.choices[0].message.content)
|