Giter VIP home page Giter VIP logo

pdf-retrieval-using-rag-for-college-notes.'s Introduction

RAG using gemini model

The following is a test implementation of RAG by using a PDF for document retrieval with Gemini API. It used chromaDB as the vector database to store embeddings of the uploaded pdf. It doesn't cover the edges cases as of the initial version.

Steps to test

Create a .env file with your API_KEY of google's gemini.

  1. $pip install -r requirements.txt
  2. $python gemini.py

Query can be changed from gemini.py file.

Steps done in the code

(utils.py consists of core logic)

Step 1: Loading pdf content

It is done by using `pypdf` library that let's us extract the contents of a pdf as a single string

Step 2: Split into chunks

Since LLMs are restricted by their context length, so we'll divide the text into chunks of small size. Each paragraph is split into chunks for the sake of simplicity.

Step 3: Create embeddings

Step 4: Store embeddings in a vector db

Stored in chroma db using a certain collection_name which can be used in future to load this collection.

Step 5: Load collection

The collection_name and path of the stored db can be used to load this collection

pdf-retrieval-using-rag-for-college-notes.'s People

Contributors

nebulaanish 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.