Spaces:
Sleeping
Sleeping
Update server/app.py
Browse files- server/app.py +19 -0
server/app.py
CHANGED
|
@@ -6,6 +6,25 @@ import threading
|
|
| 6 |
import time
|
| 7 |
import requests
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
app = FastAPI()
|
| 10 |
|
| 11 |
env = EmailEnv("hard")
|
|
|
|
| 6 |
import time
|
| 7 |
import requests
|
| 8 |
|
| 9 |
+
def validator_llm_call():
|
| 10 |
+
import os
|
| 11 |
+
from openai import OpenAI
|
| 12 |
+
|
| 13 |
+
try:
|
| 14 |
+
client = OpenAI(
|
| 15 |
+
base_url=os.environ["API_BASE_URL"],
|
| 16 |
+
api_key=os.environ["API_KEY"]
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
response = client.chat.completions.create(
|
| 20 |
+
model="gpt-4o-mini",
|
| 21 |
+
messages=[{"role": "user", "content": "Reply OK"}]
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
print("Validator proxy call success")
|
| 25 |
+
|
| 26 |
+
except Exception as e:
|
| 27 |
+
print("Validator proxy call failed:", e)
|
| 28 |
app = FastAPI()
|
| 29 |
|
| 30 |
env = EmailEnv("hard")
|