peterkros commited on
Commit
2288685
·
verified ·
1 Parent(s): c9d5e25

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -29,14 +29,15 @@ def generate_response(selected_question):
29
  prompt = selected_question # Ensure selected_question is a string
30
 
31
  try:
32
- response = openai.Completion.create(
33
- engine="gpt-3.5-turbo",
34
- prompt=prompt,
 
 
 
35
  max_tokens=150,
36
- n=1,
37
- stop=None,
38
  temperature=0.7,
39
- ).choices[0].text.strip()
40
 
41
  topics_str = "Topic analysis not available"
42
 
 
29
  prompt = selected_question # Ensure selected_question is a string
30
 
31
  try:
32
+ response = openai.ChatCompletion.create(
33
+ model="gpt-3.5-turbo",
34
+ messages=[
35
+ {"role": "system", "content": "You are a friendly and helpful chatbot."},
36
+ {"role": "user", "content": prompt}
37
+ ],
38
  max_tokens=150,
 
 
39
  temperature=0.7,
40
+ ).choices[0].message['content'].strip()
41
 
42
  topics_str = "Topic analysis not available"
43