A Streamlit-based chatbot application that uses AWS Bedrock's Claude 3 Haiku model with a Knowledge Base integration. Users can upload documents to the knowledge base and chat with Claude, which will use the knowledge base context to provide more accurate responses.
- Integration with Claude 3 Haiku through AWS Bedrock
- Knowledge Base support for document context
- File upload capability to S3 bucket
- Interactive chat interface using Streamlit
- Message history management
- Environment variable configuration
- Python 3.8 or higher
- AWS Account with Bedrock access
- AWS Credentials with appropriate permissions
- Knowledge Base configured in AWS Bedrock
- S3 bucket for document storage
- Clone the repository:
git clone https://github.com/iniakunhuda/aws-rag-bedrock-example
cd aws-rag-bedrock-example- Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate- Install the required packages:
pip install -r requirements.txt- Create a
.envfile in the project root with your AWS credentials:
AWS_ACCESS_KEY_ID=your_access_key_here
AWS_SECRET_ACCESS_KEY=your_secret_key_here
AWS_REGION=us-east-1
KNOWLEDGE_BASE_ID=your_kb_id
S3_BUCKET_NAME=your_bucket_name
- Start the Streamlit application:
streamlit run main_claude.py-
Open your web browser and navigate to the provided URL (typically http://localhost:8501)
-
Use the file uploader to add documents to your knowledge base
-
Start chatting with Claude using the chat input field
.
├── main.py # Main application file
├── main_claude.py # Main application file with Claude 3
├── requirements.txt # Python dependencies
├── .env # Environment variables (not in version control)
├── .gitignore # Git ignore rules
└── README.md # Project documentation
AWS_ACCESS_KEY_ID: Your AWS access keyAWS_SECRET_ACCESS_KEY: Your AWS secret access keyAWS_REGION: AWS region (default: us-east-1)KNOWLEDGE_BASE_ID: ID of your AWS Bedrock Knowledge BaseS3_BUCKET_NAME: Name of your S3 bucket for document storage
- Never commit your
.envfile to version control - Keep your AWS credentials secure
- Ensure appropriate IAM permissions are set
- Monitor your AWS usage and costs
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details
For any queries or issues, please open an issue in the repository.