From 793bcbdebacb480138961e4980a1cfd3adc2b06e Mon Sep 17 00:00:00 2001
From: Max Winter <68556857+winmaxim@users.noreply.github.com>
Date: Thu, 26 Oct 2023 20:11:08 -0400
Subject: [PATCH] Prompt bug: question not denoted by an XML tag, so LLM gets
confused about what it's answering. #12
---
lambdas/bedrock-embeddings-and-llm/src/settings.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lambdas/bedrock-embeddings-and-llm/src/settings.py b/lambdas/bedrock-embeddings-and-llm/src/settings.py
index aaeee64..410de7d 100644
--- a/lambdas/bedrock-embeddings-and-llm/src/settings.py
+++ b/lambdas/bedrock-embeddings-and-llm/src/settings.py
@@ -3,7 +3,7 @@
# Default prompt templates
AMAZON_GENERATE_QUERY_PROMPT_TEMPLATE = """Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question.
Chat History:
{history}
Follow up question: {input}
Standalone question:"""
-AMAZON_QA_PROMPT_TEMPLATE = """
Human: You are a friendly AI assistant. You provide answers only based on the provided reference passages. Here are reference passages in tags:
{context}
If the references contain the information needed to respond, then write a confident response in under 50 words, quoting the relevant references.
Otherwise, if you can make an informed guess based on the reference passages, then write a less confident response in under 50 words, stating your assumptions.
Finally, if the references do not have any relevant information, then respond saying \\"Sorry, I don't know\\".
{query}
Assistant: According to the reference passages, in under 50 words:"""
+AMAZON_QA_PROMPT_TEMPLATE = """
Human: You are a friendly AI assistant. Answer the question in tags only based on the provided reference passages. Here are reference passages in tags:
{context}
If the references contain the information needed to respond, then write a confident response in under 50 words, quoting the relevant references.
Otherwise, if you can make an informed guess based on the reference passages, then write a less confident response in under 50 words, stating your assumptions.
Finally, if the references do not have any relevant information, then respond saying \\"Sorry, I don't know\\".
{query}
Assistant: According to the reference passages, in under 50 words:"""
ANTHROPIC_GENERATE_QUERY_PROMPT_TEMPLATE = """
Human: Here is a chat history in tags:
{history}
Human: And here is a follow up question or statement from the human in tags:
{input}
Human: Rephrase the follow up question or statement as a standalone question or statement that makes sense without reading the chat history.
Assistant: Here is the rephrased follow up question or statement:"""
ANTHROPIC_QA_PROMPT_TEMPLATE = AMAZON_QA_PROMPT_TEMPLATE
AI21_GENERATE_QUERY_PROMPT_TEMPATE = ANTHROPIC_GENERATE_QUERY_PROMPT_TEMPLATE