dylanmeca commited on
Commit
9dd4089
·
1 Parent(s): fa8be0b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -8,14 +8,15 @@ def answer_chatgpt(api_key, message, history):
8
  lista.append(message)
9
  # OPENAI API KEY
10
  openai.api_key = api_key
11
- prompt = (f"You are GPT-3, you are in a web interface and reply to my following message: {message}")
12
- response = openai.Completion.create(
13
- engine="text-davinci-003",
14
- prompt=prompt,
15
- max_tokens=1024
 
16
  )
17
  # Displaying the answer on the screen
18
- answer = response["choices"][0]["text"]
19
  history.append((message, answer))
20
  return history, history
21
 
 
8
  lista.append(message)
9
  # OPENAI API KEY
10
  openai.api_key = api_key
11
+ prompt = f"{message}"
12
+ response = openai.ChatCompletion.create(
13
+ model="gpt-3.5-turbo",
14
+ messages=[
15
+ {"role": "system", "content": f"{prompt}"},
16
+ ]
17
  )
18
  # Displaying the answer on the screen
19
+ answer = response["choices"][0]["message"]["content"]
20
  history.append((message, answer))
21
  return history, history
22