Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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.
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
35 |
max_tokens=150,
|
36 |
-
n=1,
|
37 |
-
stop=None,
|
38 |
temperature=0.7,
|
39 |
-
).choices[0].
|
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 |
|