Giter Site home page Giter Site logo

hyperionhex / rag_model Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 13 KB

This repository focuses on optimizing Retrieval Augmented Generation (RAG) models for enhanced performance in document retrieval tasks.

License: Apache License 2.0

Jupyter Notebook 100.00%

rag_model's Introduction

Business QA Retrieval Demo

This repository contains a Google Colab notebook that demonstrates setting up a retrieval-based QA system to answer questions about Business

Overview

The notebook does the following:

  1. Loads the Wikipedia Simple Text Embedding dataset from Pinecone and preprocesses it
  2. Indexes the document embeddings into a Pinecone vector database
  3. Defines an OpenAI text embedding model to embed question queries
  4. Creates a Pinecone vectorstore to interface the index and embeddings
  5. Defines a LangChain retrieval QA chain using ChatGPT, with the Pinecone vectorstore as the retriever
  6. Answers an example insurance question using the retrieval QA chain

Requirements

The notebook requires the following key libraries:

  • LangChain v0.0.162
  • OpenAI v0.27.7
  • TikToken v0.4.0
  • Pinecone Python SDK v2.2.1
  • Pinecone Datasets v0.5.0rc10

To install requirements:

!pip install -qU \
  langchain==0.0.162 \
  openai==0.27.7 \
  tiktoken==0.4.0 \
  "pinecone-client[grpc]"==2.2.1 \
  pinecone_datasets=='0.5.0rc10' 

You will also need API keys for:

  • Pinecone
  • OpenAI

Usage

To run the notebook:

  1. Clone this repo
  2. Open the notebook in Google Colab
  3. Run all cells - you will need to configure Pinecone and OpenAI keys
  4. Modify the example question and rerun as desired

The key components:

  • RetrievalQA - LangChain QA chain
  • Pinecone - Vector database
  • OpenAI Embeddings - Text embedding model

Customization

The main ways to customize this:

  • Try different embedding models
  • Change the dataset indexed into Pinecone
  • Modify the query questions
  • Experiment with other LLMs than ChatGPT

Resources

This demo uses:

rag_model's People

Contributors

hyperionhex avatar

Stargazers

 avatar

Watchers

 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.