Skip to content

Using SessionId with Bedrock knowledgebase

0

Hi All,

To carry on with the context of the conversation, I am using the sessionID returned in the response of first retrieve_and_generate call and sending the further questions alongwith this sessionID. But whenever I ask to 'further elaborate on the previous answer', it always responds to the first question I have asked instead of responding to the current question which I had asked. Eg, Q1 - Who is a CS? A1 - CS stands for company secretary Q2 - How to become a CS? A2 - To become a CS, we have to do abc things. Q3 - Can you further elaborate on the previous answer A3 - CS stands for company secretary who are appointed by institute of company secretary of India.

In Q3, it has responded to Q1 instead of elaborating on Q2. What am I doing wrong?

1 Answer
2

Hi,

I'd suggest to start by tracing your activity with Bedrock KB in the way it is described in my article: https://repost.aws/articles/AR-LV1HoR_S0m-qy89wXwHmw/the-leverage-of-llm-system-prompt-by-knowledge-bases-for-bedrock-in-rag-workflows

This way you will if the Message API for invocation contains the history of previous prompts in the discussion or not: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-anthropic-claude-messages.html (I supposed that you use Anthropic's Claude messages)

Best,

Didier

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

  • Ok, what I have understood looking at invocation logs is that - If you ask "Please elaborate on above answer", the system will look into the chat history and pickup a question randomly from the past questions IF it is doesn't have any more information to elaborate on the previous answer. This is a very very weird behaviour where in, it should have responded that there is nothing more to elaborate.

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.