Chad commited on
Commit ·
b3b43c2
1
Parent(s): a342b4d
prowdwdwd
Browse files
app.py
CHANGED
|
@@ -73,21 +73,21 @@ def toggle_profound_mode(current_state, language_state):
|
|
| 73 |
def generate_quiz(subject, num_questions, chat_history, language_state):
|
| 74 |
"""Generate a history quiz with multiple-choice questions and append it to the chat."""
|
| 75 |
try:
|
| 76 |
-
print(language_state)
|
| 77 |
if language_state == "english":
|
| 78 |
prompt = f"Generate {num_questions} multiple-choice history questions about {subject}. "
|
| 79 |
prompt += "For each question, provide the question text, four options labeled A, B, C, and D. "
|
| 80 |
prompt += "At the end of all questions, list the correct answers in the format: 'Correct Answers: X, Y, Z, ...'. "
|
| 81 |
prompt += "Ensure that the correct answers are evenly distributed among A, B, C, and D. For example, if there are 12 questions, there should be roughly 3 correct answers for each letter. "
|
| 82 |
prompt += "Randomize their order so that they are not in a repeating pattern, but still evenly spread (e.g., B, A, C, C, A, B, D, D, B, A, D, C)."
|
|
|
|
| 83 |
|
| 84 |
else:
|
| 85 |
-
print('frfrfrfrfrfrfrffrfrfrffrfr bdkkdwdjwjdj')
|
| 86 |
prompt = f"Générez {num_questions} questions à choix multiples sur l'histoire de {subject}. "
|
| 87 |
prompt += "Pour chaque question, fournissez l'énoncé de la question, quatre options étiquetées A, B, C et D. "
|
| 88 |
prompt += "À la fin de toutes les questions, listez les bonnes réponses au format : 'Réponses correctes : X, Y, Z, ...'. "
|
| 89 |
prompt += "Assurez-vous que les bonnes réponses sont réparties uniformément entre A, B, C et D. Par exemple, s'il y a 12 questions, il devrait y avoir environ 3 bonnes réponses pour chaque lettre. "
|
| 90 |
prompt += "Mélangez l'ordre de ces réponses pour éviter les modèles répétitifs, tout en maintenant une répartition équilibrée (par ex., B, A, C, C, A, B, D, D, B, A, D, C)."
|
|
|
|
| 91 |
|
| 92 |
response = client.chat.completions.create(
|
| 93 |
model="llama3-70b-8192",
|
|
|
|
| 73 |
def generate_quiz(subject, num_questions, chat_history, language_state):
|
| 74 |
"""Generate a history quiz with multiple-choice questions and append it to the chat."""
|
| 75 |
try:
|
|
|
|
| 76 |
if language_state == "english":
|
| 77 |
prompt = f"Generate {num_questions} multiple-choice history questions about {subject}. "
|
| 78 |
prompt += "For each question, provide the question text, four options labeled A, B, C, and D. "
|
| 79 |
prompt += "At the end of all questions, list the correct answers in the format: 'Correct Answers: X, Y, Z, ...'. "
|
| 80 |
prompt += "Ensure that the correct answers are evenly distributed among A, B, C, and D. For example, if there are 12 questions, there should be roughly 3 correct answers for each letter. "
|
| 81 |
prompt += "Randomize their order so that they are not in a repeating pattern, but still evenly spread (e.g., B, A, C, C, A, B, D, D, B, A, D, C)."
|
| 82 |
+
prompt += "Reply only in english"
|
| 83 |
|
| 84 |
else:
|
|
|
|
| 85 |
prompt = f"Générez {num_questions} questions à choix multiples sur l'histoire de {subject}. "
|
| 86 |
prompt += "Pour chaque question, fournissez l'énoncé de la question, quatre options étiquetées A, B, C et D. "
|
| 87 |
prompt += "À la fin de toutes les questions, listez les bonnes réponses au format : 'Réponses correctes : X, Y, Z, ...'. "
|
| 88 |
prompt += "Assurez-vous que les bonnes réponses sont réparties uniformément entre A, B, C et D. Par exemple, s'il y a 12 questions, il devrait y avoir environ 3 bonnes réponses pour chaque lettre. "
|
| 89 |
prompt += "Mélangez l'ordre de ces réponses pour éviter les modèles répétitifs, tout en maintenant une répartition équilibrée (par ex., B, A, C, C, A, B, D, D, B, A, D, C)."
|
| 90 |
+
prompt += "Répondez uniquement en français."
|
| 91 |
|
| 92 |
response = client.chat.completions.create(
|
| 93 |
model="llama3-70b-8192",
|