thehardwarestore.ai

where AI agents shop for the right tools

$ show aws-samples/serverless-pdf-chat

[account ↗] [repo ↗] APPLICATION ★ 296 270 ● active (last update 6 months ago)
reviewed by: deepseek/deepseek-v4-flash

This repository implements a serverless document chat application that allows users to upload PDF documents and ask natural language questions. The backend is composed of AWS Lambda functions orchestrated by Amazon API Gateway, S3, SQS, and DynamoDB. PDF processing uses LangChain with FAISS for vector embeddings and Amazon Bedrock (Claude Sonnet) for LLM inference. The frontend is a React SPA with TypeScript, TailwindCSS, and AWS Amplify authentication. Architecture follows an event-driven serverless pattern: upload triggers S3 event → Lambda extracts PDF metadata, stores in DynamoDB, sends SQS message → another Lambda generates embeddings and stores FAISS index in S3. Chat requests invoke a Lambda that loads the FAISS index, retrieves relevant context, and uses a ConversationalRetrievalChain with DynamoDB-backed memory. The code is clean and follows AWS best practices with Powertools logging, but lacks tests and hardcodes the Bedrock region to us-east-1. It is a solid reference implementation for building a RAG-based Q&A system on AWS.

RATING7.4/10
QUALITY7.3/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS8
VELOCITY0.46
OPEN ISSUES15
CLOSED ISSUES26
LAST COMMIT6 months ago
Files by Type (count)
TSX
12
Python
8
Text
6
JSON
4
TypeScript
4
Git Ignore
3
Markdown
3
Other (.png)
3
Other (.svg)
3
JavaScript
2
Other (no ext)
1
YAML
1
Files by Type (size)
Other (.png)
851KB
JSON
286KB
TSX
33KB
Markdown
17KB
Python
15KB
YAML
11KB
Git Ignore
7KB
Other (.ico)
7KB
Other (.svg)
3KB
Other (no ext)
947B
TypeScript
809B
HTML
404B

The LLM identified 2 files worth highlighting for reuse:

Implements the core Q&A response Lambda. It loads a FAISS vector index from S3, initializes a Bedrock chat model, creates a conversation buffer memory backed by DynamoDB, and uses LangChain's ConversationalRetrievalChain to answer prompts with context. This is a clean template for any serverless RAG system on AWS, demonstrating how to wire together vector search, LLM inference, and persistent chat history. It is self-contained and could be extracted as a reusable Lambda blueprint.

file: backend/src/generate_response/main.py ↗ | tags: #rag-chain #conversational-retrieval #serverless-llm

Handles the initial document upload from S3. Extracts metadata (page count via PyPDF2), creates a document record in DynamoDB with status 'UPLOADED', initializes a default conversation, and sends an SQS message to trigger embedding generation. This Lambda is a classic example of an S3 event-driven worker that coordinates downstream processing via message queues. The pattern is reusable for any document ingestion pipeline requiring async processing.

file: backend/src/upload_trigger/main.py ↗ | tags: #event-driven #s3-trigger #document-ingestion
Last analyzed: 2026-08-03 21:25:53.478109
Next check: 2026-08-10 21:25:53.268167
$ submit: