From d79f926addfb5833335f54823512f04bc5f64b67 Mon Sep 17 00:00:00 2001 From: Daniel O'Connell Date: Thu, 2 May 2024 15:30:58 +0200 Subject: [PATCH] change citations --- api/src/stampy_chat/chat.py | 2 +- api/src/stampy_chat/citations.py | 2 +- api/src/stampy_chat/settings.py | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/src/stampy_chat/chat.py b/api/src/stampy_chat/chat.py index b248cf7..77b94eb 100644 --- a/api/src/stampy_chat/chat.py +++ b/api/src/stampy_chat/chat.py @@ -302,7 +302,7 @@ def merge_history(history): messages = [] current_message = history[0] for message in history[1:]: - if message.get('role') == 'deleted': + if message.get('role') in ['deleted', 'error']: continue if message.get('role') != current_message.get('role'): messages.append(current_message) diff --git a/api/src/stampy_chat/citations.py b/api/src/stampy_chat/citations.py index 54453dd..8a68f10 100644 --- a/api/src/stampy_chat/citations.py +++ b/api/src/stampy_chat/citations.py @@ -56,7 +56,7 @@ class Config: @staticmethod def make_reference(i: int) -> str: """Make the reference used in citations - basically translate i -> 'a + i'""" - return chr(i + 97) + return str(i + 1) def fetch_docs(self, input_variables) -> List: ### Copied from parent - for some reason they ignore the ids of the returned items, so diff --git a/api/src/stampy_chat/settings.py b/api/src/stampy_chat/settings.py index 7085eb4..1959eec 100644 --- a/api/src/stampy_chat/settings.py +++ b/api/src/stampy_chat/settings.py @@ -10,8 +10,8 @@ SOURCE_PROMPT = ( "You are a helpful assistant knowledgeable about AI Alignment and Safety. " "Please give a clear and coherent answer to the user's questions. (written after \"Q:\") " - "using the following sources. Each source is labeled with a letter. Feel free to " - "use the sources in any order, and try to use multiple sources in your answers.\n\n" + "using the following sources. Each source is labeled with a number. Feel free to " + "use the sources in any order, and try to reference up to 8 sources in your answers.\n\n" ) HISTORY_PROMPT = ( "\n\n" @@ -29,8 +29,8 @@ QUESTION_PROMPT = ( "In your answer, please cite any claims you make back to each source " - "using the format: [a], [b], etc. If you use multiple sources to make a claim " - "cite all of them. For example: \"AGI is concerning [c, d, e].\"\n\n" + "using the format: [1], [2], etc. If you use multiple sources to make a claim " + "cite all of them. For example: \"AGI is concerning [1, 3, 8].\"\n\n" ) PROMPT_MODES = { 'default': "",