From 250887b9fbd112b8abb42792196c3723f2d43c7b Mon Sep 17 00:00:00 2001 From: Ayyub Ibrahim Date: Tue, 2 Jan 2024 21:51:48 -0600 Subject: [PATCH 1/2] fix: prompted model to return answers less than 4k tokens --- packages/googlecloud/functions/getanswer/inquirer.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/googlecloud/functions/getanswer/inquirer.py b/packages/googlecloud/functions/getanswer/inquirer.py index aabafa70..2895751f 100644 --- a/packages/googlecloud/functions/getanswer/inquirer.py +++ b/packages/googlecloud/functions/getanswer/inquirer.py @@ -208,12 +208,12 @@ def get_indepth_response_from_query(df, db, query, k): docs = sort_retrived_documents(doc_list) docs_page_content = append_metadata_to_content(docs) - print(docs_page_content) template = """ Question: {question} Based on the information from the New Orleans city council documents provided, answer the following question: {question}. + Your answer must not exceed 4,000 tokens. If possible, extract the key points, decisions, and actions discussed during the city council meetings relevant to {question}; highlight any immediate shortcomings, mistakes, or negative actions by the city council relevant to {question}; @@ -235,10 +235,7 @@ def get_indepth_response_from_query(df, db, query, k): Word: Definition - Please break the definitions onto new lines with - - - The final output should be in paragraph form without any formatting, such as prefixing your points with "a.", "b.", or "c." + The final output should be in paragraph form without any formatting, such as prefixing your points with "a.", "b.", or "c.", "1.", "2.", "3.", The final output should not include any reference to the model's active sorting by date. Documents: {docs} From 052f1fb4af6f480583eef1ac2bbe6d0602a66649 Mon Sep 17 00:00:00 2001 From: Ayyub Ibrahim Date: Tue, 2 Jan 2024 21:53:55 -0600 Subject: [PATCH 2/2] edit: prompted model to return answers no greater than 5k tokens in length --- packages/googlecloud/functions/getanswer/inquirer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/googlecloud/functions/getanswer/inquirer.py b/packages/googlecloud/functions/getanswer/inquirer.py index 2895751f..6ed2e2e4 100644 --- a/packages/googlecloud/functions/getanswer/inquirer.py +++ b/packages/googlecloud/functions/getanswer/inquirer.py @@ -213,7 +213,7 @@ def get_indepth_response_from_query(df, db, query, k): Question: {question} Based on the information from the New Orleans city council documents provided, answer the following question: {question}. - Your answer must not exceed 4,000 tokens. + Your answer must not exceed 5,000 tokens. If possible, extract the key points, decisions, and actions discussed during the city council meetings relevant to {question}; highlight any immediate shortcomings, mistakes, or negative actions by the city council relevant to {question};