Amazon Knowledge Bases for Bedrock Conversation Context

0

Question for the experts: I took that from KB Bedrock documentation - A knowledge base can be used not only to answer user queries, and analyze documents, but also to augment prompts provided to foundation models by providing context to the prompt. When answering user queries, the knowledge base retains conversation context. The knowledge base also grounds answers in citations so that users can find further information by looking up the exact text that a response is based on and also check that the response makes sense and is factually correct. TL:DR - the knowledge base retains conversation context Is that true ? How is that implemented ? Where is the context retained ? Is this related to a specific API request ? Can I try that on console (or only via code/notebook/etc.)?

Thanks in advance

2 Answers
0

Yes, It's True: The knowledge base in Amazon Bedrock can remember and use the context of a conversation to give better, more relevant answers as the conversation goes on.

How It Works:

Session Memory: The system can store information about the conversation in memory while you’re chatting. This helps the AI remember what you’ve already talked about. Session IDs or Tokens: These can link your current question to previous parts of the conversation, allowing the AI to pull in relevant details from earlier. Persistent Storage: For long-term memory, like remembering details across different sessions, the context might be stored in a database. Related to API Requests:

When you send a request to the API, you might include a session ID or previous conversation data to help the system remember the context. Can You Try It on the Console?

Yes, but… You can play around with some basic features in the Bedrock console. However, if you want to do more advanced stuff, like managing conversation memory over time, you’ll probably need to write some code or use a notebook with the Bedrock SDK. Citations in Responses:

The knowledge base can also provide citations or references to the exact documents or information it used to generate an answer, so you can check where the information came from. In short, Bedrock can remember what you’re talking about and use that memory to improve its responses, but for deeper control over this, using code is the way to go.

profile picture
answered 2 months ago
0

Hi,

AFAIK, the context is not retained by Bedrock KB but by Bedrock Agent: see https://docs.aws.amazon.com/bedrock/latest/userguide/agents-session-state.html to understand which levers you have to control / influence session state. Their are a few context parameters that you can influence to obtain better results for your use case.

On KB retrieval, please have a look at my article https://repost.aws/articles/AR-LV1HoR_S0m-qy89wXwHmw/the-leverage-of-llm-system-prompt-by-knowledge-bases-for-bedrock-in-rag-workflows

You will understand in full details (traces included) how it works to leverage text chunks of your KB in the responses and retain corresponding citations.

Best,

Didier

profile pictureAWS
EXPERT
answered 2 months 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