joefarrington commited on
Commit
9ebc44b
·
1 Parent(s): fab5646

Restore examples, updated prompt re unknown qs

Browse files
app.py CHANGED
@@ -20,6 +20,13 @@ Please refer to the official [UCL module catalogue](https://www.ucl.ac.uk/module
20
  for accurate and up-to-date information.
21
  """
22
 
 
 
 
 
 
 
 
23
 
24
  def convert_history(history: list[dict]) -> list[BaseMessage]:
25
  """Convert conversation history into Langchain messages"""
@@ -55,8 +62,7 @@ def main(cfg: omegaconf.DictConfig) -> None:
55
  gr.Markdown("# Chat with the module catalogue")
56
  gr.Markdown(description)
57
  gr.ChatInterface(
58
- fn=chat,
59
- type="messages",
60
  )
61
 
62
  module_chat.launch()
 
20
  for accurate and up-to-date information.
21
  """
22
 
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
+
30
 
31
  def convert_history(history: list[dict]) -> list[BaseMessage]:
32
  """Convert conversation history into Langchain messages"""
 
62
  gr.Markdown("# Chat with the module catalogue")
63
  gr.Markdown(description)
64
  gr.ChatInterface(
65
+ fn=chat, type="messages", examples=examples, cache_examples=False
 
66
  )
67
 
68
  module_chat.launch()
src/ucl_module_chat/chains/rag_chain.py CHANGED
@@ -24,7 +24,9 @@ rag_prompt = """You are an assistant for question-answering tasks related
24
  The first time you refer to a module in the conversation, refer to
25
  it by it's full name followed by the module code in brackets, e.g.
26
  Supervised Learning (COMP0078).
27
- If you don't know the answer, say that you don't know.
 
 
28
  Use five sentences maximum and keep the answer concise.
29
  Use professional British English and avoid using slang.
30
  Do not refer to the context directly in your answer, but you
 
24
  The first time you refer to a module in the conversation, refer to
25
  it by it's full name followed by the module code in brackets, e.g.
26
  Supervised Learning (COMP0078).
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.
30
  Use five sentences maximum and keep the answer concise.
31
  Use professional British English and avoid using slang.
32
  Do not refer to the context directly in your answer, but you