Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -45,17 +45,16 @@ def generate_question_with_chatgpt(context, topic):
|
|
45 |
'correct_answer': "Unknown"
|
46 |
}
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
{"role": "system", "content": "You are a helpful assistant."},
|
54 |
{"role": "user", "content": f"What is the question on {topic} for the following? {context}"},
|
55 |
-
]
|
56 |
-
}
|
57 |
|
58 |
-
|
59 |
result = response.json()
|
60 |
|
61 |
print("API Response:", result) # Add this line for debugging
|
|
|
45 |
'correct_answer': "Unknown"
|
46 |
}
|
47 |
|
48 |
+
response = client.chat.completions.create(
|
49 |
+
model="gpt-3.5-turbo",
|
50 |
+
max_tokens=1024,
|
51 |
+
temperature = 0.7,
|
52 |
+
messages = [
|
53 |
{"role": "system", "content": "You are a helpful assistant."},
|
54 |
{"role": "user", "content": f"What is the question on {topic} for the following? {context}"},
|
55 |
+
]
|
|
|
56 |
|
57 |
+
)
|
58 |
result = response.json()
|
59 |
|
60 |
print("API Response:", result) # Add this line for debugging
|