GuidesAI

Overview

The AI Chat with PDF feature allows users to upload PDF files, parse the contents, and extract insights by interacting with the uploaded files as a knowledge base. This feature leverages AI-powered technology to answer queries related to the PDF content, providing a user experience similar to ChatGPT but tailored to the user's specific document.

Key Features

  • PDF Upload and Parsing: Users can upload PDF files, which are automatically parsed, split into manageable sections, and processed to generate embeddings for AI-powered querying.
  • Choose AI Model: Users can change the AI Model during chat to OpenAI, Anthropic and Gemini.
  • Interactive Chat: Users can type queries related to the uploaded PDF and receive accurate answers based on the document's content.
  • Chat History:
    • Filters: View chat histories by the past 24 hours or all time.
    • Accessibility: All organization members can view chat histories.
  • PDF Preview: Users can preview the uploaded document while interacting with it.
  • Customization: The system currently supports one chat per PDF upload but can be customized for multiple PDFs or additional workflows.

How It Works

PDF Upload and Parsing Workflow

  1. Upload:

    • A user uploads a PDF file to the Supabase file storage bucket named files mentioned in app configuration file storage.filesBucketName.
  2. Processing:

    • The PDF is parsed, and its content is split into smaller, manageable chunks using LangChain's text splitter.
    • Embeddings are created for each chunk, enabling the AI to reference and analyze the document's content efficiently.

PDF Moderation using OpenAI omni-moderation model:

By default we provide PDF moderation support with a config flag enableModeration. It will restrict PDFs which has been flagged for moderation.

Querying and Chat Workflow

  1. Query Input:
    • The user enters a query in the chat panel.
  2. Message Storage:
    • All user queries are stored in the supabase message table for future reference.
  3. Answer Generation:
    • The AI uses the embeddings created from the uploaded PDF to find similar content based on the query.
    • It calculates similarity scores to ensure accurate responses.
    • The answer is returned to the user, providing clear and concise insights from the document.

Technical Architecture

  • Embeddings: Representations of the document's content are generated to facilitate efficient querying. We use the OpenAI text-embedding-3-small model, which generates embeddings with 1536 dimensions. If you plan to switch to a different embedding model, ensure that the embedding dimensionality is updated accordingly in the embeddings table.
  • Vercel AI SDK Integration: Queries are processed using Vercel AI SDK, with the uploaded PDF serving as the knowledge base. User can choose between the supported models such as OpenAI, Anthropic and Gemini.
  • Supabase Data Tables:
    • PDF Data: Parsed content and embeddings are stored for efficient retrieval.
    • Message Table: Stores user queries for persistent chat histories.

Benefits

  • Enhanced Productivity: Quickly extract insights from complex documents without manual searching.
  • Collaboration: Share document insights with all organization members.
  • Customization: Tailor the feature for specific workflows or multi-document querying.

On this page