brunopistone / genai-qa-rag

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GenAI Q&A RAG

This respository implements a scalable RAG solution for a GenAI Q&A use case.

Architecture

User Interaction

Architecture

Document Indexing

Architecture

Repository Content

  1. app: Streamlit app for testing the GenAI application in you preferred IDE
  2. backend: Lambda function used as backend for the GenAI application
  3. data_workflow: Lambda functions used in the StepFunction workflow for indexing PDF and txt documents
  4. fargate: Fargate content for deploying the frontend app using Fargate
  5. notebooks: Jupyter notebooks for testing the SageMaker Endpoints, and indexing workflows
  6. setuo: CFN template for deploying the AWS resources

Prerequisites

  1. Have an existing Amazon S3 Bucket

  2. Put the lambda_layers zip files in an Amazon S3 bucket:

    1. Option 1:
      1. Download the two layers from Releases
      2. Rename each file as lambda_layer.zip
    2. Option 2:
      1. Build two .zip files starting from the requirements.txt
        1. langchain
        2. pdf-parser-layer
      2. Rename each file as lambda_layer.zip
    3. Put each file name in your existing Amazon S3 Bucket
      1. gen-ai-qa/layers/langchain/lambda_layer.zip
      2. gen-ai-qa/layers/pdf-parser-layer/lambda_layer.zip

Deployment

  1. Deploy cfn-template.yml
    1. Check the Lambda Layer Paths are reflecting your path
    2. Provide the name of you Amazon S3 Bucket defined in the Prerequsites1
  2. Navigate the AWS Console under Cloudformation
    1. Take the name of the resources created
      1. Amazon S3 Bucket name
      2. Amazon OpenSearch Domain Endpoint and add https:// as prefix
  3. Edit backend/config.yaml
    1. Add Amazon OpenSearch Domain Endpoint and add https:// as prefix under es_credentials -> endpoint
  4. Upload backend/config.yaml in the created Amazon S3 Bucket by the CloudFormation template under gen-ai-qa/configs/configs.yaml

Optional: Deploy Fargate Application

  1. Edit configs.yaml
    1. aws: AWS Credentials for invoking the Lambda backend
    2. s3: Amazon S3 Bucket name created by the Cloudformation template
  2. Deploy fargate
    1. ./fargate/deploy_stack.sh

About


Languages

Language:Jupyter Notebook 58.9%Language:Python 40.6%Language:Shell 0.3%Language:Dockerfile 0.2%