AjithKSenthil commited on
Commit
0bcd8c0
·
verified ·
1 Parent(s): 6d39a16

Update chatbot.py

Browse files
Files changed (1) hide show
  1. chatbot.py +2 -2
chatbot.py CHANGED
@@ -6,7 +6,7 @@ from urllib.parse import urlparse
6
  import json
7
 
8
  # Initialize OpenAI client
9
- openai.api_key = os.getenv("OPENAI_API_KEY")
10
 
11
  # Database URL
12
  DATABASE_URL = os.getenv('DATABASE_URL')
@@ -161,7 +161,7 @@ def chatbot(input, state):
161
 
162
  if input:
163
  messages.append({"role": "user", "content": input})
164
- response = openai.ChatCompletion.create(
165
  model="gpt-3.5-turbo",
166
  messages=messages
167
  )
 
6
  import json
7
 
8
  # Initialize OpenAI client
9
+ client = openai.OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
10
 
11
  # Database URL
12
  DATABASE_URL = os.getenv('DATABASE_URL')
 
161
 
162
  if input:
163
  messages.append({"role": "user", "content": input})
164
+ response = client.chat.completions.create(
165
  model="gpt-3.5-turbo",
166
  messages=messages
167
  )