A modern Streamlit chatbot interface that integrates with AWS Bedrock Knowledge Base for intelligent document retrieval and AI-powered responses.
- 🤖 AI-Powered Chat: Uses Claude 3 Sonnet via AWS Bedrock for intelligent responses
- 📚 Knowledge Base Integration: Retrieves relevant documents from your Bedrock Knowledge Base
- 🔍 Source Attribution: Shows document sources for transparency
- 🎨 Modern UI: Clean, responsive Streamlit interface
- ⚙️ Configurable: Adjustable retrieval settings and model parameters
- Python 3.8+
- AWS Account with Bedrock access
- AWS Bedrock Knowledge Base set up
- AWS credentials configured
# Clone the repository
git clone <your-repo-url>
cd panther-pathfinder-aws
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtYou have two options for configuration:
# Copy the template
cp .env.template .env
# Edit .env with your actual values
nano .envEdit config.py and uncomment the AWS_CONFIG section at the bottom, filling in your values.
- AWS Bedrock Access: Ensure your AWS account has access to Bedrock
- Knowledge Base: Create a Bedrock Knowledge Base and note its ID
- IAM Permissions: Your AWS credentials need these permissions:
bedrock:InvokeModelbedrock:Retrievebedrock:RetrieveAndGenerate
Set these required values in your .env file or config.py:
AWS_ACCESS_KEY_ID: Your AWS access keyAWS_SECRET_ACCESS_KEY: Your AWS secret keyAWS_REGION: AWS region (default: us-east-1)BEDROCK_KNOWLEDGE_BASE_ID: Your Bedrock Knowledge Base IDBEDROCK_MODEL_ID: Model to use (default: Claude 3 Sonnet)
streamlit run app.pyThe application will be available at http://localhost:8501
- Ask Questions: Type your questions in the chat input
- View Sources: Expand the "Sources" section to see retrieved documents
- Adjust Settings: Use the sidebar to configure retrieval parameters
- Clear History: Use the sidebar button to reset the conversation
- Automatically retrieves relevant documents from your Bedrock Knowledge Base
- Shows relevance scores and source document information
- Configurable number of retrieved documents (1-10)
- Uses Claude 3 Sonnet for high-quality responses
- Implements Retrieval-Augmented Generation (RAG) pattern
- Provides context-aware answers based on your documents
- Modern, responsive design
- Chat history persistence during session
- Source attribution for transparency
- Real-time status indicators
panther-pathfinder-aws/
├── app.py # Main Streamlit application
├── config.py # Configuration management
├── requirements.txt # Python dependencies
├── .env.template # Environment variables template
├── README.md # This file
└── venv/ # Virtual environment (created locally)
- Connection Failed: Check your AWS credentials and region
- Knowledge Base Not Found: Verify your Knowledge Base ID
- Permission Denied: Ensure your IAM user has required Bedrock permissions
- No Results: Check if your Knowledge Base has indexed documents
- "Failed to initialize Bedrock Knowledge Base": Check AWS configuration
- "Error querying knowledge base": Verify Knowledge Base ID and permissions
- "Error generating response": Check model access and quotas
The application is modular and easy to extend:
BedrockKnowledgeBaseclass: Handles AWS Bedrock interactionsmain()function: Contains the Streamlit UI logicconfig.py: Manages configuration and validation
- Modify CSS in the
main()function for styling changes - Adjust model parameters in
generate_response_with_rag() - Add new sidebar controls for additional features
- Due to current LLM limitations, queries are only accurate up to two classes/locations
- RAG system setup using Amazon Bedrock Knowledge Bases
- Frontend developed using Streamlit
- Python script developed to gather information from Hartnell course catalog (failure of web scraper)
- Gathered information uploaded to S3 buckets
- Python script developed to automatically generate Google Map link to destination
- Multilingual support added
- Better map integration
- Make the school databases more AI-accessible (right now, it's very user-focused, but data ingestion is difficult for AI)
- Build on project to add scalability
- Automate processes to make it easy to implement across campuses
- Never commit AWS credentials to version control
- Use environment variables or AWS IAM roles for production
- Rotate access keys regularly
- Follow AWS security best practices
This project is open source. Please check the license file for details.
For issues and questions:
- Check the troubleshooting section above
- Review AWS Bedrock documentation
- Open an issue in this repository