Complete implementation of a RAG chatbot using AWS Bedrock with OpenSearch for vector storage and Claude for responses.
PDF (S3) → Lambda/Script → Bedrock Embeddings → OpenSearch → Bedrock LLM → Response
pip install -r requirements.txtcp .env.example .env
# Run interactive setup to configure your environment
python setup_env.pypython setup_aws_resources.pyaws s3 cp your-document.pdf s3://your-bucket/pdfs/- Process PDFs and Create Embeddings:
python pdf_processor.py- Run Interactive Chatbot:
python rag_chatbot.py- Run Web Interface:
streamlit run streamlit_app.py- pdf_processor.py: Extracts text, chunks documents, generates embeddings
- opensearch_manager.py: Manages vector storage and similarity search
- rag_chatbot.py: Main RAG pipeline with Claude integration
- streamlit_app.py: Web interface
- setup_aws_resources.py: AWS infrastructure setup
- OpenSearch: ~$50-100/month (t3.small)
- Bedrock Embeddings: ~$0.0001/1K tokens
- Bedrock Claude: ~$0.008/1K tokens
- Use IAM roles with minimal permissions
- Enable VPC for OpenSearch
- Encrypt data at rest and in transit
- Use AWS Secrets Manager for credentials
- Enable CloudTrail logging
- OpenSearch connection issues: Check security groups and access policies
- Bedrock model access: Ensure model access is enabled in Bedrock console
- Memory issues: Reduce chunk size or batch processing