How uniabhi/pdf-chat-with-bedrock works
Project Type & Purpose
• The project is a full-stack application with two distinct components: the Admin Application and the User Application.
• It aims to allow administrators to upload and process PDF documents (transforming them into vector embeddings) and enable end users to query these documents conversationally.
• Key external dependencies include Amazon Bedrock (for LLM inferencing and embeddings), AWS S3 (for storing FAISS vector indices), LangChain (for RAG orchestration), and FAISS for efficient semantic search.
Main Components
• Admin Application:
• Containerized as specified by its Dockerfile.
• Responsible for PDF upload, text chunking, generating vector embeddings using the Amazon Titan Embedding Model, and storing indices (in FAISS format) to Amazon S3.
• User Application:
• Also containerized.
• Downloads vector indices from S3, converts user queries to vectors (again using the Titan Embedding Model), performs similarity search to retrieve relevant document chunks, and uses an LLM (Meta LLama 3 [8B]) for generating responses.
• Interfaces with the user via a Streamlit-based front-end.
• External Systems & Services:
• Amazon Bedrock for both embeddings-generation tasks and LLM inference.
• AWS S3 for storing and retrieving the FAISS indices.
• Infrastructure services like IAM for secured AWS access.
• Docker containers representing deployment units for both apps.
• For the Admin Application:
• For the User Application:
• “User Query Input (via Streamlit UI)” → “Query Embedding Generation via Titan Embedding Model” → “Retrieve FAISS Indices from S3” → “Similarity Search to Fetch Relevant Chunks” → “Provide Context and Call LLama 3 (8B)” → “Generate & Return Response”.
• Both applications will have secure API or environment variable-based access to AWS (with the recommendation to switch to IAM roles for production).
Architectural Patterns & Design Principles
• Follow a microservices or modular approach by clearly separating responsibilities between the Admin and User applications.
• Containerization (using Docker) to encapsulate and deploy these services independently.
• Decoupling between document processing and query processing; they interact mainly via the shared persistence layer (S3).
Technology and Framework Integration
• Labels for key technologies: Amazon Bedrock, FAISS, LangChain, Streamlit, Docker, and AWS S3.