new client
Browse files
app.py
CHANGED
|
@@ -6,6 +6,9 @@ import os
|
|
| 6 |
CORRECT_PASSWORD = os.getenv("APP_PASSWORD") # Set this in Hugging Face Spaces secrets
|
| 7 |
openai.api_key = os.getenv("OPENAI_API_KEY") # Also store securely
|
| 8 |
|
|
|
|
|
|
|
|
|
|
| 9 |
# -------------------------------
|
| 10 |
# Define Functions for App Logic
|
| 11 |
# -------------------------------
|
|
@@ -28,7 +31,7 @@ def diagnoser_query(user_query):
|
|
| 28 |
Process the Diagnoser query.
|
| 29 |
(For now, simply pass the query to the OpenAI API.)
|
| 30 |
"""
|
| 31 |
-
response =
|
| 32 |
model="gpt-4o-mini",
|
| 33 |
messages=[
|
| 34 |
{
|
|
@@ -49,7 +52,7 @@ def distractors_query(user_query):
|
|
| 49 |
Process the Distractors brainstorm query.
|
| 50 |
(For now, simply pass the query to the OpenAI API.)
|
| 51 |
"""
|
| 52 |
-
response =
|
| 53 |
model="gpt-4o-mini",
|
| 54 |
messages=[{"role": "user", "content": user_query}]
|
| 55 |
)
|
|
|
|
| 6 |
CORRECT_PASSWORD = os.getenv("APP_PASSWORD") # Set this in Hugging Face Spaces secrets
|
| 7 |
openai.api_key = os.getenv("OPENAI_API_KEY") # Also store securely
|
| 8 |
|
| 9 |
+
client = openai.OpenAI() # ✅ New format
|
| 10 |
+
|
| 11 |
+
|
| 12 |
# -------------------------------
|
| 13 |
# Define Functions for App Logic
|
| 14 |
# -------------------------------
|
|
|
|
| 31 |
Process the Diagnoser query.
|
| 32 |
(For now, simply pass the query to the OpenAI API.)
|
| 33 |
"""
|
| 34 |
+
response = client.chat.completions.create(
|
| 35 |
model="gpt-4o-mini",
|
| 36 |
messages=[
|
| 37 |
{
|
|
|
|
| 52 |
Process the Distractors brainstorm query.
|
| 53 |
(For now, simply pass the query to the OpenAI API.)
|
| 54 |
"""
|
| 55 |
+
response = client.chat.completions.create(
|
| 56 |
model="gpt-4o-mini",
|
| 57 |
messages=[{"role": "user", "content": user_query}]
|
| 58 |
)
|