Skip to main content

Overview

Uxie’s AI Chat lets you have intelligent conversations about your PDF documents. Powered by Google’s Gemini 2.5 Flash, it uses Retrieval-Augmented Generation (RAG) to answer questions accurately based on your document’s actual content.

Key Features

Document-Aware AI

AI answers based on your actual PDF content, not general knowledge

Context Search

Automatically finds relevant sections to answer your questions

Persistent History

All conversations are saved and accessible anytime

Quick Actions

Explain or summarize text directly from PDF selections

Getting Started

Activating AI Chat

Before you can use AI Chat, your document must be vectorized:
1

Open Chat Panel

Click the Chat tab in the right sidebar
2

Turn PDF Interactive

Click the “Turn PDF Interactive” button
3

Wait for Processing

The document is processed and vectorized (this may take a moment)
4

Start Chatting

Once complete, the chat interface appears - you’re ready to ask questions!
Vectorization converts your PDF into a searchable format that enables AI to find relevant information quickly. This is a one-time process per document.

What Vectorization Does

  • Extracts text from your PDF
  • Splits content into chunks (1000 characters with 200-character overlap)
  • Creates embeddings using AI models
  • Stores vectors in Pinecone database
  • Enables semantic search across your document
Implementation at /src/lib/vectorise.ts

Using AI Chat

Asking Questions

1

Type Your Question

Enter your question in the chat input at the bottom
2

Send

Press Enter or click the arrow button
3

AI Searches

The AI automatically searches your document for relevant information
4

Receive Answer

Get a comprehensive answer based on the retrieved content
Ask specific questions for best results. Instead of “What is this about?”, try “What are the main causes discussed in section 3?”

Example Questions

Great questions to ask:
  • “What are the key findings in this research?”
  • “Summarize the methodology section”
  • “What evidence supports the main argument?”
  • “Explain the concept of [topic] from this paper”
  • “What are the limitations mentioned?”
  • “Compare the approaches in sections 2 and 4”

Quick Actions from PDF

Explain Selected Text

1

Select Text in PDF

Highlight any text passage in your PDF
2

Click Explain

Click the lightbulb icon in the popover
3

View Explanation

The Chat panel opens automatically with an AI explanation
Perfect for understanding complex passages, technical terms, or dense paragraphs.

Summarize Selected Text

1

Select Text in PDF

Highlight the passage you want summarized
2

Click Summarize

Click the book icon in the popover
3

View Summary

Get a concise summary in the Chat panel
Ideal for long sections, detailed descriptions, or extracting main points.

Chat Interface

Message Types

Your messages:
  • Appear on the right side
  • Blue background
  • Show your questions and prompts
AI responses:
  • Appear on the left side
  • Gray background
  • Support markdown formatting (bold, lists, code, etc.)
  • May include “Reading the document…” indicator while searching

Message Controls

While AI is generating a response:
  • Click the stop button (ban icon)
  • Or press Escape
  • The AI stops immediately
  • All messages are automatically saved
  • Scroll up to view previous conversations
  • History persists across sessions
  • Reload the page to see all past messages

Chat Limitations

  • Maximum message length: 1000 characters
  • Maximum response tokens: 2000
  • Step count limit: 3 (prevents infinite tool calls)

How It Works

RAG (Retrieval-Augmented Generation)

Uxie uses advanced RAG technology:
1

Question Analysis

Your question is analyzed by the AI
2

Document Search

The getInformation tool searches vectorized content for relevant passages
3

Context Retrieval

Top matching sections are retrieved from the database
4

Answer Generation

AI generates an answer using ONLY the retrieved content

AI Model

Gemini 2.5 Flash by Google:
  • Fast response times
  • High-quality comprehension
  • Strong reasoning capabilities
  • Excellent at following instructions
Model endpoint: google("gemini-2.5-flash") at /src/app/api/chat/route.ts:91

Tool Calling

The AI has access to the getInformation tool:
{
  name: "getInformation",
  description: "Search the PDF for relevant information",
  input: { question: string },
  output: { results: DocumentChunk[] }
}
This tool is automatically called for every user question to ensure answers are grounded in the document.

Conversation Flow

System Prompt

The AI follows this directive:
“You are a helpful assistant with access to a PDF document. Your primary task is to answer questions based on the content of this PDF. ALWAYS use the ‘getInformation’ function to search the PDF for relevant information.”
Full prompt at /src/app/api/chat/route.ts:157.

Multi-Step Reasoning

For complex questions:
  1. AI may call getInformation multiple times
  2. Each call refines the search based on previous results
  3. Up to 3 tool calls allowed per conversation turn
  4. Final response synthesizes all retrieved information

Best Practices

Be specific: “What methodology was used in the experiment?” works better than “Tell me about methods.”
Ask follow-ups: Build on previous questions to dive deeper into topics.
Combine with highlights: Highlight important sections first, then ask AI to elaborate or connect ideas.
Verify critical info: For important decisions, verify AI responses by checking the source sections in your PDF.

Privacy & Data

  • Your question
  • Retrieved document chunks (not the entire PDF)
  • Previous conversation context
  • Document ID (for retrieval)
  • Embeddings: Pinecone vector database
  • Chat history: Your Uxie database
  • AI processing: Google’s Gemini API
  • Only you and collaborators on the document
  • Chats are private to each document
  • No cross-document information sharing

Technical Implementation

API Route

Endpoint: /api/chat Method: POST Request body:
{
  messages: Message[],
  docId: string
}
Response: Streaming text response Implementation at /src/app/api/chat/route.ts. Query flow:
  1. Convert question to embedding
  2. Search Pinecone for similar vectors
  3. Return top K most relevant chunks
  4. Pass chunks to AI for answer generation
Vector search implementation at /src/lib/vectorise.ts.

Component Architecture

<Chat isVectorised={doc.isVectorised}>
  {!isVectorised && <FeatureCard />}
  {isVectorised && (
    <>
      <MessageWindow />
      <ChatInput />
    </>
  )}
</Chat>
Component at /src/components/chat/index.tsx.

Troubleshooting

  • Check your internet connection
  • Ensure the PDF has extractable text (not scanned images - use OCR first)
  • Try refreshing the page
  • Check if you have sufficient credits/quota
  • The answer might not be in your document
  • Try rephrasing your question
  • Be more specific about which section to search
  • Check if the document uploaded correctly
  • Large documents take longer to search
  • Complex questions may require multiple searches
  • AI generation speed depends on server load
  • Consider asking more focused questions
  • Check if you’re viewing the correct document
  • Refresh the page to reload history
  • History is document-specific

Limitations

  • AI can only answer based on content in your PDF
  • Scanned PDFs must be OCR’d first for AI to access text
  • Very long documents may have incomplete context
  • AI may occasionally misinterpret complex technical content

Annotations

Explain and summarize highlights

Note Taking

AI writing assistance in notes

OCR

Make scanned PDFs AI-searchable

Build docs developers (and LLMs) love