This is a Streamlit application that combines the capabilities of Amazon Bedrock Knowledge Bases with multimodal Large Language Models (LLMs). The application allows users to ask questions and receive relevant responses based on the selected knowledge base and multimodal LLM. Users can also upload images to supplement their queries.
- Clone the repository:
git clone https://github.com/aws-samples/sample-chatbot-for-bedrock-knowledge-base-and-multimodal-llms.git
cd sample-chatbot-for-bedrock-knowledge-base-and-multimodal-llms/
- Create and activate a virtual environment
python3 -m venv venv
source venv/bin/activate
- Install the required Python packages:
pip install -r requirements.txt
-
Go to AWS Console. Go to Amazon Bedrock console and on left menu, click on Model access:
- Access to Claude Models:
- On the Model access screen, click on button "Modify model access":
- On "edit model access" screen, select Titan Embeddings G1 - Text and Claude 3 models (Haiku, Sonnet, Opus), and click on "Request model access" button
- Access to Nova Models:
- Select region "us-east-1" in the AWS console
- On the Model access screen, click on button "Modify model access":
- On "edit model access" screen, select Nova Micro, Nova Lite, Nova Pro, Nova Canvas and Nova Reel
- Access to Claude Models:
-
If you want to create a new knoweldge base, take a look at the CLI tool
create_kb.py
in thescripts/
folder
python scripts/create_kb.py --help
In that case, you would need to have an AWS Role with the follwoing polices here
If you want to upload documents from local to the KnowledgeBase, add the documents to scripts/data
folder. Otherwise, you can also specify a custom S3 bucket name to the create_kb.py
script.
- [Optional] You can delete the created knowledgeBase from setp 4 with the following script:
python scripts/delete_kb.py --knowledge_base_name <your-kb-name>
- Ensure your terminal session can access the AWS account via SSO, environment variables or any mechanism you use
- Take a look at the
app/configs.json
to adjust different variables such asregion_name
- Start the Streamlit application:
streamlit run app/main.py