Skip to content

Latest commit

 

History

History
72 lines (44 loc) · 2.97 KB

README.md

File metadata and controls

72 lines (44 loc) · 2.97 KB

Document QnA using Langchain 📚🔍

Live Link - https://prabhjotschugh-genai-doc-qna.onrender.com/

Document QnA using Langchain is a robust solution designed to enable question answering on textual documents, employing advanced natural language processing techniques. This project integrates OpenAI's embedding model for semantic understanding, FAISS library for efficient similarity searches, and Langchain's pre-trained question answering models.

Features

  • Embedding Generation: OpenAI's embedding model is utilized to generate numerical representations of words and phrases from textual data. These embeddings capture the semantic meaning of the text, facilitating accurate understanding of context.

  • Search Index Creation: The solution organizes the generated embeddings into a search index using the FAISS library. This index structure enables rapid and efficient similarity searches, enhancing the retrieval of relevant information from the document.

  • Question Answering Model: Langchain's pre-trained question answering models are seamlessly integrated into the solution. These models are adept at comprehending questions and extracting precise answers from the provided textual context.

  • Query Execution: Users can input their questions into the system, which then executes queries against the search index using the loaded question answering model. This process matches the query with relevant embeddings in the index to retrieve context-aware answers promptly.

Repository Structure

  • app-openai.py: Contains the implementation of the question answering system using OpenAI's models.
  • app.py: Implements the question answering system using open-source models.
  • index.html: HTML template for the frontend interface.
  • styles.css: CSS styles for the frontend interface.

Usage

To run the application:

  1. Clone the repository:

    git clone https://github.com/prabhjotschugh/Doc-QnA-using-Langchain
    cd document-qna-using-langchain
  2. Install the required Python packages:

    pip install -r req.txt
  3. Set your OpenAI API key (if using OpenAI's model):

    export OPENAI_API_KEY="your-openai-api-key"
  4. Set your HuggingFace API key (if using open-source models):

    export HUGGINGFACEHUB_API_TOKEN="your-huggingface-api-key"

Running the Flask App

  1. Start the Flask app:

    python app.py
  2. Open your web browser and navigate to http://127.0.0.1:5000/ to access the application.

Outputs

1

2

Demo

Document.QnA.using.Langchain.mp4
Gen.AI.Document.QnA.-.Demo.mp4