Skip to content

Project demonstrates an agentic Retrieval-Augmented Generation (RAG) application built using CrewAI and Streamlit.

Notifications You must be signed in to change notification settings

sushant1827/Agentic-RAG-DeepSeek

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Agentic RAG Application with CrewAI and Streamlit

This project demonstrates an agentic Retrieval-Augmented Generation (RAG) application built using CrewAI and Streamlit. It allows users to upload a PDF document and then ask questions about its content, leveraging the power of Large Language Models (LLMs) and intelligent agents.

Project Preview

image

Features

  • PDF Document Upload: Users can upload PDF files directly through the Streamlit interface.
  • PDF Indexing: The application indexes the uploaded PDF, making its content searchable.
  • Agentic RAG: Employs a CrewAI-powered crew of agents to handle information retrieval and response generation.
  • Web Search Fallback: If information is not found in the PDF, the system intelligently falls back to web search using the Serper API.
  • Conversational Interface: Provides a user-friendly chat interface for interacting with the system.
  • Clear Chat History: Users can easily clear the chat history and start fresh.
  • Real-time Response: The application displays the LLM's response in a streaming fashion, providing a more engaging user experience.
  • Local LLM Support: Uses Ollama to run a local LLM (deepseek-r1:14b)

How It Works

The application uses a crew of two agents:

  1. Retriever Agent:
    • Responsible for retrieving relevant information based on the user's query.
    • Prioritizes searching the uploaded PDF.
    • Falls back to web search if the PDF doesn't contain the answer.
    • Uses PDFSearchTool and SerperDevTool.
  2. Response Agent:
    • Synthesizes the retrieved information into a clear and concise response.
    • Handles cases where no relevant information is found.

These agents work together sequentially to provide accurate and helpful answers to user queries.

Technologies Used

  • CrewAI: A framework for orchestrating multi-agent systems.
  • Streamlit: A Python library for creating interactive web applications.
  • Ollama: For running the local LLM.
  • Deepseek-r1:14b: The specific LLM used in this project.
  • Serper API: For web search capabilities.
  • PDFSearchTool: A custom tool for searching PDF documents.
  • Python: The primary programming language.
  • dotenv: For managing environment variables.

Prerequisites

  • Python 3.8+
  • Ollama: You need to have Ollama installed and running locally.
  • Serper API Key: You'll need a Serper API key for web search functionality.
  • Required Python Packages:
    pip install streamlit crewai crewai-tools python-dotenv

Installation and Setup

  1. Clone the Repository:
    git clone <your-repository-url>
    cd <your-repository-directory>
  2. Install Dependencies:
    pip install -r requirements.txt
    (You can create a requirements.txt file with the following content:
    streamlit
    crewai
    crewai-tools
    python-dotenv
    
    )
  3. Set Environment Variables:
    • Create a .env file in the project's root directory.
    • Add your Serper API key:
      SERPER_API_KEY=your_serper_api_key_here
      
  4. Run Ollama:
    • Make sure you have Ollama installed and running.
    • Pull the deepseek-r1:14b model:
    ollama pull deepseek-r1:14b
  5. Run the Streamlit App:
    streamlit run rag_app.py

Usage

  1. Upload a PDF: In the sidebar, use the file uploader to select and upload a PDF document.
  2. Wait for Indexing: The application will index the PDF. This may take a few moments.
  3. Ask Questions: In the chat interface, type your questions about the PDF content.
  4. View Responses: The system will provide answers based on the PDF content or, if necessary, from the web.
  5. Clear Chat: Use the "Clear Chat" button in the sidebar to reset the conversation.

About

Project demonstrates an agentic Retrieval-Augmented Generation (RAG) application built using CrewAI and Streamlit.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages