Commit
·
04ae05e
1
Parent(s):
7d59900
Update messages for demo
Browse files
app.py
CHANGED
|
@@ -35,13 +35,16 @@ def get_assistant_response(gpt_history):
|
|
| 35 |
print("\n" + response_message)
|
| 36 |
return response_message
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
instructions = {
|
| 41 |
-
2:
|
| 42 |
-
3: "Based on these responses, ask follow up questions that help them narrow down the focus of the essay",
|
| 43 |
-
|
| 44 |
-
|
| 45 |
}
|
| 46 |
|
| 47 |
def grad_demo():
|
|
@@ -54,9 +57,14 @@ def grad_demo():
|
|
| 54 |
def bot(history):
|
| 55 |
step = len(history)
|
| 56 |
print(f"STEP: {step}")
|
|
|
|
| 57 |
if step in instructions:
|
|
|
|
|
|
|
| 58 |
gpt_history.append({"role": ChatRoles.SYSTEM, "content": instructions[step]})
|
| 59 |
-
|
|
|
|
|
|
|
| 60 |
history[-1][1] = bot_message
|
| 61 |
gpt_history.append({"role": ChatRoles.ASSISTANT, "content": bot_message})
|
| 62 |
print(f"Length of gpt_history: {gpt_history}")
|
|
|
|
| 35 |
print("\n" + response_message)
|
| 36 |
return response_message
|
| 37 |
|
| 38 |
+
hardcoded = {
|
| 39 |
+
1: "Hi, I'm an AI powered college counselor from Cledge! What prompt do you want help with?",
|
| 40 |
+
3: "Let me know if you want more suggestions."
|
| 41 |
+
}
|
| 42 |
|
| 43 |
instructions = {
|
| 44 |
+
2: "Based on these responses, generate 5 questions to help them brainstorm.",
|
| 45 |
+
# 3: "Based on these responses, ask follow up questions that help them narrow down the focus of the essay",
|
| 46 |
+
# 4: "Based on these responses, ask follow up questions that help them identify key themes in the essay",
|
| 47 |
+
3: "Based on these responses, think of 5 ideas for personal statement essays. Write a synopsis of each idea.",
|
| 48 |
}
|
| 49 |
|
| 50 |
def grad_demo():
|
|
|
|
| 57 |
def bot(history):
|
| 58 |
step = len(history)
|
| 59 |
print(f"STEP: {step}")
|
| 60 |
+
bot_message = ""
|
| 61 |
if step in instructions:
|
| 62 |
+
if step > 3:
|
| 63 |
+
step = (step - 2) % 2 + 2
|
| 64 |
gpt_history.append({"role": ChatRoles.SYSTEM, "content": instructions[step]})
|
| 65 |
+
bot_message = get_assistant_response(gpt_history)
|
| 66 |
+
if step in hardcoded:
|
| 67 |
+
bot_message = f"{bot_message}\n\n {hardcoded[step]}"
|
| 68 |
history[-1][1] = bot_message
|
| 69 |
gpt_history.append({"role": ChatRoles.ASSISTANT, "content": bot_message})
|
| 70 |
print(f"Length of gpt_history: {gpt_history}")
|