Giter Site home page Giter Site logo

ksmin23 / rag-with-amazon-bedrock-and-opensearch Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 690 KB

Question Answering application with Amazon Bedrock and Amazon OpenSearch Service.

Python 51.06% Shell 0.45% Batchfile 0.66% Dockerfile 1.54% Jupyter Notebook 46.30%
aws-bedrock aws-opensearch claude2 llms titan-embeddings

rag-with-amazon-bedrock-and-opensearch's Introduction

QA with LLM and RAG (Retrieval Augumented Generation) powered by Amazon Bedrock and OpenSearch Service

This project is a Question Answering application with Large Language Models (LLMs) and Amazon OpenSearch Service. An application using the RAG(Retrieval Augmented Generation) approach retrieves information most relevant to the user’s request from the enterprise knowledge base or content, bundles it as context along with the user’s request as a prompt, and then sends it to the LLM to get a GenAI response.

LLMs have limitations around the maximum word count for the input prompt, therefore choosing the right passages among thousands or millions of documents in the enterprise, has a direct impact on the LLM’s accuracy.

In this project, Amazon OpenSearch Service is used for knowledge base.

The overall architecture is like this:

rag_with_bedrock_and_opensearch_arch

Prerequisites

Before using a foundational model in Bedrock your account needs to be granted access first.

Follow the steps here to add models: Amazon Bedrock - Add model access

Some models require some additional information and take some time before you are granted access. Once the model shows "Access granted" on the Model Access page, you should be able to call the invoke_model() function without the error.

Overall Workflow

  1. Deploy the cdk stacks (For more information, see here).
    • An Amazon OpenSearch cluster for storing embeddings.
    • Opensearch cluster's access credentials (username and password) stored in AWS Secrets Mananger as a name such as OpenSearchMasterUserSecret1-xxxxxxxxxxxx.
  2. Open SageMaker Studio and then open a new terminal.
  3. Run the following commands on the terminal to clone the code repository for this project:
    git clone https://github.com/ksmin23/rag-with-amazon-bedrock-and-opensearch.git
    
  4. Open data_ingestion_to_opensearch notebook and Run it. (For more information, see here)
  5. Run Streamlit application. (For more information, see here)

References

rag-with-amazon-bedrock-and-opensearch's People

Contributors

ksmin23 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.