Skip to content

JustSaX/Bedrock-ChatBot-with-LangChain-and-Streamlit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bedrock ChatBot with LangChain and Streamlit 💬

A simple and clear example for implement a chatbot with Bedrock + LangChain + Streamlit. Just install and run the code~ 🚀

pip install -r requirements.txt
streamlit run bedrock/bedrock_chatbot.py

24/04/05 Updates

1. Add Dockfile for container enviroment and remove the packages installation! 🎉🎉🎉

You could build your own, and I've also uploaded a public container image at public.ecr.aws for you~

docker run -d -v $HOME/.aws/config:/root/.aws/config:ro -p 8502:8501 public.ecr.aws/shtian/bedrock-claude-3-langchain-streamlit:latest

2. NEW! Mistral Large on Bedrock Supported! 🎉🎉🎉 image

24/03/14 Updates

NEW! Claude 3 Haiku on Bedrock Supported! Let's Go Faster! 🎉🎉🎉 image

Install via the command:

pip install -r requirements.txt

24/03/11 Updates

NEW! Claude 3 Sonnet on Bedrock Supported! New Message API Plus Vision Multimodal Chat! 🎉🎉🎉

Add system prompt option.

image

24/03/10 Updates

NEW! Claude 3 Sonnet on Bedrock Supported! New Message API Plus Vision Multimodal Chat! 🎉🎉🎉

Install langchain from source, for new Bedrock API support.

Note: No need to hack in bedrock code! Just change the langchain_messages state of streamlit in the app code. Complete this code with the help of Claude itself :)

git clone https://github.com/langchain-ai/langchain.git
pip install -e langchain/libs/langchain

Then run the command:

streamlit run bedrock_chatbot_claude_3_sonnet_vision.py

Bingo! image

Note: Some details like - smooth history catchup with new message api, support mulitple images in one chat, image keep in the thumbnail in one line, multimodal and text-only mixed chat, no some bump up after rerun and re-initialize, fix lots of format mismatch...

24/03/09 Updates

NEW! Claude 3 Sonnet on Bedrock Supported~ Message API Plus Vision Multimodal! 🎉🎉🎉

Extra action needed (till now) - install langchain from source.

Note: A little bit hack for streamlit conversation history format mismatch, and modify langchain community bedrock source code, no impact on BedrockChat invoke ~

git clone https://github.com/davidshtian/langchain.git
pip install -e langchain/libs/langchain

Then run the command:

streamlit run bedrock_chatbot_claude_3_sonnet_vision.py

Bingo! image

24/03/08 Updates

NEW! Claude 3 Sonnet on Bedrock Supported~ Message API

Extra action needed (till now) - install langchain from source:

git clone https://github.com/langchain-ai/langchain.git
pip install -e langchain/libs/langchain

Note: Only text supported now, vision later!

Then run the command:

streamlit run bedrock_chatbot_claude_3_sonnet.py

The bot is equipped with chat history using ConversationBufferWindowMemory and StreamlitChatMessageHistory, and provided with both simple(batch) and streaming modes. Demo shown as below:

Bedrock_Chat_Fast.mp4

Streaming mode demo shown as below:

Bedrock_Chat_Streaming_Fast.mp4

About

A simple and clear example for implement a chatbot with Bedrock (Claude and Mistral) + LangChain + Streamlit.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.5%
  • Dockerfile 1.5%