Giter Site home page Giter Site logo

retrieval-augmented-generation-rag's Introduction

This respootary is an implemntation for an offline Retrieval-Augmented Generation (RAG) model

This model based on differnt technologies, softwares and platforms; Mainly: 1-Ollama: https://ollama.com/ 2- Langchain, 3- Mistral: 4- FAISS: 5- Streamline:

Main Model Description:

This model utilizes the Ollama software tool to run large language models (LLMs) locally on a computer, enabling offline language processing tasks. Ollama provides access to a diverse set of pre-trained LLM models. Langchain complements Ollama by acting as a framework. It allows developers to integrate these locally-run LLMs into applications. This makes the LLMs easier to use and build upon. Langchain goes a step further by enabling the development of RAG systems. These systems use various tools to process information, allowing for more refined and informative responses from the language model.

Using the RAG:

1- Insall Ollama "https://ollama.com/download" 2- Cloning:
3- Running: 4- The server will open the application as shown on the picture. You can use your pdf documents, or you can use the two documents provided on the example folder. The Example folder contains two pdf documents genertaed by ChatGPT include information about the dams.

langchain

Main Functions explanination:

The image illustrates the overall steps of the model. It begins with uploading multiple PDF files, followed by processing them before engaging in conversation, as outlined below:

  1. Call the get_pdf_text(pdf_docs) function to read and concatenate text from each page of the uploaded PDF documents.

    • Main method for parsing: PyPDF2 library.
    • Output: raw_text
  2. Call the get_text_chunks(raw_text) function to split the extracted text into manageable chunks.

    • Main method: langchain library.
    • CharacterTextSplitter Parameters: chunk size: 1000 characters, overlap: 200 characters.
    • Output: text_chunks
  3. Call the get_vectorstore(text_chunks) function to generate embeddings for the text chunks and store them in a vector database.

    • Main method:
    • Convert the embeddings vectorspace to txt file (embeddings.txt)
  4. Call the get_conversation_chain(vectorstore) function to create a conversational chain with the generated vectorstore.

    • This operation relies on the langchain library for creating conversational chains.

retrieval-augmented-generation-rag's People

Contributors

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