Skip to content

ASG - PDF QA Chatbot: This project is a PDF-based Question and Answer (QA) chatbot application, designed to take user queries on a given document and return relevant answers using IBM Watsonx and LangChain.

Notifications You must be signed in to change notification settings

Amey-sd/A-Student-Guide

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WatsonX PDF Q&A Streamlit App

This Streamlit app is designed to perform Q&A on the content of a PDF document using IBM WatsonX's LLM and LangChain. By uploading a PDF file, users can ask questions about the content, and the app will respond with relevant answers from the document.

Features

  • PDF Document Loading: Load and index PDF files for question-answering.
  • Embeddings & Text Splitting: Use Hugging Face embeddings for semantic search and split text using LangChain's RecursiveCharacterTextSplitter.
  • Q&A with IBM WatsonX: Integrate with IBM WatsonX's LLM to answer questions based on the PDF content.
  • Interactive Chat Interface: Uses Streamlit's chat interface to display responses and retain chat history.

Setup and Installation

Prerequisites

  • Conda (recommended) or Python >= 3.10
  • IBM WatsonX API access credentials

Step 1: Clone the Repository

git clone https://github.com/WalkingDevFlag/PDF-QA-Chatbot
cd <repository-directory>

Step 2: Create and Activate the Conda Environment

conda create --name watsonx python=3.10
conda activate watsonx

Step 3: Install Dependencies

Use the requirements.txt file to install necessary packages:

pip install -r requirements.txt

Step 4: Set Up Environment Variables

Create a .env file in the root directory with the following variables:

WATSONX_APIKEY=your_watsonx_apikey
WATSONX_URL=your_watsonx_url
WATSONX_MODEL_ID=your_model_id
WATSONX_PROJECT_ID=your_project_id

Replace each placeholder with your actual IBM WatsonX API key, URL, Model ID, Project ID, and the path to your PDF file.

Step 5: Add the pdf files in the resources directory

Make sure the pdfs you want to run on are present in the "resources" directory

Usage

  1. Start the App:

    streamlit run app.py
  2. Interact with the Q&A System:

    • The app provides a chat interface. Enter your questions related to the PDF content, and WatsonX will generate responses based on the indexed document.
  3. Historical Messages:

    • All past questions and answers are displayed in the chat interface, allowing for a seamless Q&A session.

Environment Setup with Conda

To create a Conda environment with the necessary packages, follow these commands:

conda create --name watsonx python=3.10
conda activate watsonx
pip install -r requirements.txt

File Structure

  • app.py: Main script to run the Streamlit app.
  • .env: Environment file containing IBM WatsonX credentials.
  • requirements.txt: List of Python packages required for the project.

Acknowledgments

About

ASG - PDF QA Chatbot: This project is a PDF-based Question and Answer (QA) chatbot application, designed to take user queries on a given document and return relevant answers using IBM Watsonx and LangChain.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%