Spaces:
Runtime error
Runtime error
workflows(course_learn_suggest_expectations): Refactor to handle exisiting expectations in prompt
Browse files
workflows/courses/suggest_expectations.py
CHANGED
|
@@ -56,10 +56,16 @@ class SuggestExpectations:
|
|
| 56 |
Check Question: {expectation.check_question}
|
| 57 |
""")
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
response = chain.invoke({
|
| 60 |
"course": self.course, "module": self.module, "tasks": "* " + ("\n* ".join(self.tasks)),
|
| 61 |
"format_instructions": parser.get_format_instructions(),
|
| 62 |
-
"existing_expectations":
|
| 63 |
})
|
| 64 |
|
| 65 |
return response
|
|
|
|
| 56 |
Check Question: {expectation.check_question}
|
| 57 |
""")
|
| 58 |
|
| 59 |
+
existing_expectations_str = ""
|
| 60 |
+
if len(existing_expectations) > 0:
|
| 61 |
+
existing_expectations_str = "Here are existing Learning Outcomes & Check Questions for the module, don't repeat these learning outcomes:\n ```"
|
| 62 |
+
existing_expectations_str += "\n".join(existing_expectations)
|
| 63 |
+
existing_expectations_str += "\n```"
|
| 64 |
+
|
| 65 |
response = chain.invoke({
|
| 66 |
"course": self.course, "module": self.module, "tasks": "* " + ("\n* ".join(self.tasks)),
|
| 67 |
"format_instructions": parser.get_format_instructions(),
|
| 68 |
+
"existing_expectations": existing_expectations_str
|
| 69 |
})
|
| 70 |
|
| 71 |
return response
|