> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fife.bot/llms.txt
> Use this file to discover all available pages before exploring further.

# Documents

> Upload PDF, DOCX, and TXT files to your chatbot's knowledge base.

Upload files directly from your computer. FIFE.BOT parses, chunks, and indexes them automatically.

## Supported Formats

| Format   | Library | Notes                                                                 |
| -------- | ------- | --------------------------------------------------------------------- |
| **PDF**  | unpdf   | Extracts text from all pages. Scanned PDFs (image-only) may not work. |
| **DOCX** | mammoth | Extracts text with basic formatting. Images are ignored.              |
| **TXT**  | native  | Plain text, processed as-is.                                          |

## Uploading Documents

<Steps>
  <Step title="Open Knowledge Base tab">
    Go to your chatbot → **Knowledge Base** tab.
  </Step>

  <Step title="Click Add Source → Document">
    A drag & drop dialog opens.
  </Step>

  <Step title="Upload">
    Drag files onto the dialog or click to browse your filesystem. You can upload **multiple files at once**.
  </Step>

  <Step title="Processing">
    Each file goes through:

    1. Text extraction (PDF → text, DOCX → text)
    2. Chunking (split into semantically meaningful pieces)
    3. Embedding (converted to vectors via text-embedding-3-large)
    4. Indexing (stored in pgvector + full-text search index)
  </Step>
</Steps>

## File Size Limit

**Maximum: 50 MB per file.** For best results, use well-structured documents with headings — the chunking algorithm uses headings to create better-scoped chunks.

## Document Status

After upload, each document shows a status:

| Status         | Meaning                                                           |
| -------------- | ----------------------------------------------------------------- |
| **Processing** | File is being parsed and embedded                                 |
| **Ready**      | Document is indexed and searchable                                |
| **Error**      | Processing failed — error message shown inline under the filename |

<Tip>
  If a document fails to process, check that it's not a scanned PDF (image-only) or a password-protected file.
</Tip>

## Document Metadata

Each document displays:

* Filename and file type icon
* File size
* Number of chunks created
* Upload date
* Status indicator

## Updating Documents

To update a document's content, **delete the old version and re-upload**. There is no in-place edit for uploaded files.

## Routing Instructions

Like all source types, documents support optional routing instructions — extra context for the AI about how to use content from this specific file.

**Example:**

> "This is the Q3 2025 financial report. When citing numbers from this document, always specify that they are from Q3 2025."
