How aws-samples/aws-genai-conversational-rag-reference works
Project type and purpose
• This is a monorepo for “Galileo,” an end-to-end reference implementation of a conversational RAG (Retrieval-Augmented Generation) application.
• It provides a full-stack solution: AWS CDK infrastructure, serverless back-end (REST & WebSocket APIs, corpus ingestion pipeline, inference engine Lambdas), a React-based front-end, plus a CLI and SDK for programmatic access.
File structure
• Top level:
• packages/ – reusable libraries:
– galileo-cdk (IaC constructs)
– galileo-sdk (TypeScript/JS SDK)
– galileo-cli (CLI tool)
• demo/ – self-contained reference deployment:
– infra/ (CDK entrypoint, stacks for presentation, AI, corpus, networking, identity, CICD)
– api/ (Smithy-generated REST API client & infra)
– ws-api/ (Smithy-generated WebSocket API client & infra)
– corpus/ (document ingestion, embedding, vector-store indexer Lambdas)
– website/ (React SPA)
– sample-dataset/
– overrides/
• Infrastructure code uses AWS CDK in TypeScript, with logical layers: application, networking, identity, data, monitoring, tooling, CICD.
• Corpus pipeline: event-driven Lambdas (inventory, task, vectorstore worker).
• Inference engine: REST and WS Lambdas orchestrating calls to LLMs (Bedrock, SageMaker, HuggingFace).
• Presentation: API Gateway (REST & WS) fronting Lambda handlers; React front-end calling these endpoints.
• Generated code: Smithy models → clients/infrastructure/stacks for both REST & WS APIs.
Core README insights
• Three-tier reference application: ingestion pipeline, vector store, inference engine + aligned LLM, UI with session persistence and auth.
• Use case: virtual legal research assistant.
Main components & their interactions (to be
a. Clients:
– Browser (React SPA)
– CLI tool
– SDK library
b. API Layer:
– REST API Gateway → Lambda handlers (chat management, LLM inventory)
– WebSocket API Gateway → Lambda handlers for streaming LLM responses
c. Business Logic:
– Corpus ingestion pipeline (inventory, embedding, indexing Lambdas)
– Inference engine Lambdas (wrapper around LLM calls & result formatting)
d. Data Layer:
– Vector store (e.g. PGVector on RDS)
– Document store (S3 or similar)
– Metadata DB (e.g. DynamoDB or RDS)
e. External Services:
– AWS Cognito (authN)
– AWS S3, RDS, DynamoDB (for data storage)
– AWS Bedrock / SageMaker / HuggingFace (LLM endpoints)
– CloudWatch (logging, tracing, metrics)
– CI/CD Pipeline (CodePipeline/CodeBuild)
Architectural patterns & principles
• Serverless microservices (Lambda + API Gateway)
• Event-driven ingestion pipeline
• Infrastructure as code (CDK constructs packaged in galileo-cdk)
• Client-library separation (SDK abstracts API + WS)
• Three-tier separation: Presentation → Logic → Data