Skip to content

Commit 9ebc44b

Browse files
committed
Restore examples, updated prompt re unknown qs
1 parent fab5646 commit 9ebc44b

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

‎app.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
for accurate and up-to-date information.
2121
"""
2222

23+
examples = [
24+
"When can I take a module on medical statistics?",
25+
"What are the prerequisites for taking Supervised Learning?",
26+
"What is the difference between the two modules on Trauma for \
27+
paediatric dentistry?",
28+
]
29+
2330

2431
def convert_history(history: list[dict]) -> list[BaseMessage]:
2532
"""Convert conversation history into Langchain messages"""
@@ -55,8 +62,7 @@ def chat(input: str, history: list[dict] = None) -> str:
5562
gr.Markdown("# Chat with the module catalogue")
5663
gr.Markdown(description)
5764
gr.ChatInterface(
58-
fn=chat,
59-
type="messages",
65+
fn=chat, type="messages", examples=examples, cache_examples=False
6066
)
6167

6268
module_chat.launch()

‎src/ucl_module_chat/chains/rag_chain.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
The first time you refer to a module in the conversation, refer to
2525
it by it's full name followed by the module code in brackets, e.g.
2626
Supervised Learning (COMP0078).
27-
If you don't know the answer, say that you don't know.
27+
If you don't know the answer, apologise, say that
28+
you don't know the answer, and suggest that the user
29+
manually reviews the UCL website and module catalogue.
2830
Use five sentences maximum and keep the answer concise.
2931
Use professional British English and avoid using slang.
3032
Do not refer to the context directly in your answer, but you

0 commit comments

Comments
 (0)