JunoLeong/RAG-DocExtractRAG

DocExtractRAG is a Retrieval-Augmented Generation (RAG) system that combines the power of large language models (LLMs) with document retrieval to provide insightful responses based on academic or other types of documents. The system utilizes the Zephyr-7B-beta model for text generation; BAAI/bge-large-en for document embeddings.

Python

0

7 commits

updated Dec 22, 2024

See the code

README

DocExtractRAG

Overview 🌟

DocExtractRAG is a Retrieval-Augmented Generation (RAG) system that combines the power of large language models (LLMs) with document retrieval to provide insightful responses based on academic or other types of documents. The DocExtractRAG utilizes the Zephyr-7B-beta model for text generation, BAAI/bge-large-en for document embeddings, and Chroma for efficient document retrieval.

Users can interact with the DocExtractRAG via a Gradio web interface, where they input a question, and the DocExtractRAG retrieves relevant information from the stored documents and generates a concise, structured answer.

System Components 🧩

ComponentsDetails
Model Usedzephyr-7B-beta-GGUF
Embeddings ModelBAAI/bge-large-en
Vector StoreChroma
AcceleratorCTransformers
FrameworkLangChain
InterfaceGradio

System Setup 🛠️

To get started with DocExtractRAG, follow these steps:

  1. Clone the repository and install the required libraries:

    pip install -r requirements.txt
    
  2. Download the Zephyr-7B-beta model using the Hugging Face CLI:

    huggingface-cli download TheBloke/zephyr-7B-beta-GGUF zephyr-7b-beta.Q4_K_M.gguf --local-dir .\models\zephyr-7B-beta-GGUF --local-dir-use-symlinks False 
    
  3. For optimal performance on GPUs, install ctransformers with CUDA acceleration:

    pip install ctransformers[cuda]
    
  4. Initialize the vector store by running the vector_store.py script:

    python vector_store.py
    

Tip: If you want to process a different PDF document, update the file name in line 28 of vector_store.py:
loader = PyPDFLoader("file_name")

  1. Launch the application:

    python app.py
    
  2. Running the DocExtractRAG in your local host. http://127.0.0.1:7860

Note:

  • Check for breaking changes and deprecations for Langchain libraires (Optional): langchain-cli migrate --diff app.py

About the Interface 🌈

The Gradio interface enables intuitive interaction with DocExtractRAG.

  • gradio.Blocks 🧱: This low-level API allows full control over data flows and layout. To build a more complex and customizable application interface, Blocks is used instead of gradio.interface.

Here is the user interface of DocExtractRAG:

User Interface DocExtractRAG

Reference 📚


Feel free to reach out with suggestions or improvements for the project! If you like or are using this project, please consider giving it a star⭐. Thanks! (●'◡'●)

chromadb
document-extraction
huggingface
rag
zephyr

JunoLeong/RAG-DocExtractRAG

DocExtractRAG is a Retrieval-Augmented Generation (RAG) system that combines the power of large language models (LLMs) with document retrieval to provide insightful responses based on academic or other types of documents. The system utilizes the Zephyr-7B-beta model for text generation; BAAI/bge-large-en for document embeddings.

Python

0

7 commits

updated Dec 22, 2024

See the code

README

DocExtractRAG

Overview 🌟

DocExtractRAG is a Retrieval-Augmented Generation (RAG) system that combines the power of large language models (LLMs) with document retrieval to provide insightful responses based on academic or other types of documents. The DocExtractRAG utilizes the Zephyr-7B-beta model for text generation, BAAI/bge-large-en for document embeddings, and Chroma for efficient document retrieval.

Users can interact with the DocExtractRAG via a Gradio web interface, where they input a question, and the DocExtractRAG retrieves relevant information from the stored documents and generates a concise, structured answer.

System Components 🧩

ComponentsDetails
Model Usedzephyr-7B-beta-GGUF
Embeddings ModelBAAI/bge-large-en
Vector StoreChroma
AcceleratorCTransformers
FrameworkLangChain
InterfaceGradio

System Setup 🛠️

To get started with DocExtractRAG, follow these steps:

  1. Clone the repository and install the required libraries:

    pip install -r requirements.txt
    
  2. Download the Zephyr-7B-beta model using the Hugging Face CLI:

    huggingface-cli download TheBloke/zephyr-7B-beta-GGUF zephyr-7b-beta.Q4_K_M.gguf --local-dir .\models\zephyr-7B-beta-GGUF --local-dir-use-symlinks False 
    
  3. For optimal performance on GPUs, install ctransformers with CUDA acceleration:

    pip install ctransformers[cuda]
    
  4. Initialize the vector store by running the vector_store.py script:

    python vector_store.py
    

Tip: If you want to process a different PDF document, update the file name in line 28 of vector_store.py:
loader = PyPDFLoader("file_name")

  1. Launch the application:

    python app.py
    
  2. Running the DocExtractRAG in your local host. http://127.0.0.1:7860

Note:

  • Check for breaking changes and deprecations for Langchain libraires (Optional): langchain-cli migrate --diff app.py

About the Interface 🌈

The Gradio interface enables intuitive interaction with DocExtractRAG.

  • gradio.Blocks 🧱: This low-level API allows full control over data flows and layout. To build a more complex and customizable application interface, Blocks is used instead of gradio.interface.

Here is the user interface of DocExtractRAG:

User Interface DocExtractRAG

Reference 📚


Feel free to reach out with suggestions or improvements for the project! If you like or are using this project, please consider giving it a star⭐. Thanks! (●'◡'●)

chromadb
document-extraction
huggingface
rag
zephyr