BtB-ExpC commited on
Commit
0aee0a2
·
1 Parent(s): 6ef93fb

new client

Browse files
Files changed (1) hide show
  1. app.py +5 -2
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 = openai.ChatCompletion.create(
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 = openai.ChatCompletion.create(
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
  )