aws-samples / aws-genai-llm-chatbot

A modular and comprehensive solution to deploy a Multi-LLM and Multi-RAG powered chatbot (Amazon Bedrock, Anthropic, HuggingFace, OpenAI, Meta, AI21, Cohere, Mistral) using AWS CDK on AWS
https://aws-samples.github.io/aws-genai-llm-chatbot/
MIT No Attribution
1.1k stars 332 forks source link

New sessions table that allows for chat history and metadata greater than 400KB #584

Open gbone-restore opened 1 month ago

gbone-restore commented 1 month ago

Issue #, if available: https://github.com/aws-samples/aws-genai-llm-chatbot/issues/580

Description of changes: Session History table was redesigned to handle chat history and meta data that is greater than 400KB. The partition key is now users and the sort key is sessions. And there are two types of items to make selecting session history and dealing with chat history a little easier. I can submit a PR with a working example. The bulk of the changes are in lib/shared/layers/python-sdk/python/genai_core/langchain/chat_message_history.py and lib/shared/layers/python-sdk/python/genai_core/sessions.py.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

gbone-restore commented 1 month ago

I will take a look at the failed tests. I made this change prior to the tests being available, so there probably is a little cleanup needed to get the tests to pass.

charles-marion commented 1 month ago

Hi @gbone-restore , Thank you for creating this PR! It is greatly appreciated.

I reviewed the change and I have minor suggestions (not published) However, this change would break existing deployments of the project since the change of partition key would invalidate existing sessions.

A possible option is to apply a similar change with a new table for messages.

We will follow up with a new PR based on your change.