Legal AI Assistant

Legal AI Assistant

OpenAIStreamlitPineconeSQLite

An AI Legal Assistant for Law Students and Professionals.

A RAG-based AI Legal Assistant designed to provide tailored legal information from a private knowledge base. It features an adaptive user interface, a sophisticated retrieval-scoring-rewriting loop for accuracy, dynamic question suggestions, and a self-improving FAQ system.

Legal Assistant Legal Assistant

Key Features

  • Interactive Chat Interface: A user-friendly chat application built with Streamlit.

  • Adaptive AI Persona: The assistant adjusts its communication style and response depth for Legal Professionals, Law Students, and the General Public.

  • Document Management Dashboard: An interface to upload PDF documents, which are then processed, chunked, and stored in a vector knowledge base.

  • Agentic RAG: The system uses a LangGraph-powered agent that:

    • Retrieves relevant document chunks from a Pinecone vector store.
    • Scores the relevance of the retrieved context against the user's query.
    • Rewrites the query and re-retrieves if the initial results are not relevant enough.
  • Dynamic "Related Questions": After each response, the assistant suggests similar questions from a vector database, displayed in the sidebar to guide user exploration.

  • Conversation-Driven Content Generation: When a user ends a chat, a unified background process is triggered to:

    • Generate FAQs: Analyzes the conversation to create and store detailed Q&A pairs in a local SQLite database.
    • Generate Suggested Questions: Creates new, concise questions and adds them to Pinecone to improve future suggestions.
  • FAQ Page: A dedicated page to browse all generated FAQs, categorized for easy access.

  • Dual Database System:

    • Pinecone: For the primary knowledge base and for storing suggested questions.
    • SQLite: For persisting structured FAQs.