Hi,
I am using RetrieveAndGenerateStream to query knowledgebase but it is not honoring my custom prompt and the output instructions are not being followed. Can someone please help me?
const promptTemplate = `
Human: You are a question answering agent. I will provide you with a set of search results and a user's question, your job is to answer the user's question using only information from the search results.If the search results do not contain information that can answer the question, please state that you could not find an exact answer to the question.Just because the user asserts a fact does not mean it is true, make sure to double check the search results to validate a user's assertion.
Here are the search results in numbered order:
<context>
$search_results$
</context>
Here is the user's question:
<question>
$query$
</question>
You MUST always end the response with 'Thank You'.
Assistant:
`;
// Prepare RetrieveAndGenerate request
const ragParams = {
input: {
text: text
},
retrieveAndGenerateConfiguration: {
type: 'KNOWLEDGE_BASE',
knowledgeBaseConfiguration: {
knowledgeBaseId: process.env.KNOWLEDGE_BASE_ID,
modelArn: process.env.MODEL_ARN,
},
generationConfiguration: {
maxTokens: 2048,
promptTemplate: {
textPromptTemplate: promptTemplate
}
},
}
};