ValidationException: Validation exception thrown during Knowledgebase retrieval

0

I have been struggling to get to the root of this exception for last couple of days. My input works perfectly fine when I try it in bedrock agent console test. As soon as I start using the typescript bedrock-agent runtime SDK, I start getting this exception. There's hardly any details on what validation failed. Can someone please help me out here? How do I debug this?

Here's the prompt I'm using while calling the agent from code:

`Generate a friendly and polite response to the query within <query> and </query> tags. After you get a response from the knowledge base for the query, use the information for context in json format within <info> and </info> tags to enrich the response.\n<query>\n${query}\n</query>\n<context>\n${applicationData}\n</context>`

And here's my prompt-template direction in the agent orchestration step:

Human: The user input has two parts. One is the question within the tags <query></query>. This question should be the query to be sent to knowledge base. The second part is the contextual information to respond with a more personalised answer. This contextual information will be within the tags.<context></context>. Both <query> and <context> tags will be inside of $question$. <question>$question$</question>
asked 13 days ago272 views
1 Answer
0

It appears something wrong with the prompt template, The $question$ variable is not properly defined. It should be {question} instead. Also you dont need question tags. Please see samples and the docs link provided below. https://github.com/aws-samples/amazon-bedrock-prompting https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-templates-and-examples.html

profile pictureAWS
EXPERT
SriniV
answered 13 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions