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

# Knowledge base (RAG)

> Let assistants answer from your documents with retrieval-augmented generation

A knowledge base makes your documents searchable **during a live call**. When the caller asks something covered by your material — prices, policies, opening hours, product details — the assistant retrieves the relevant passages and answers from them instead of guessing.

## Self-learning FAQ (Beta)

Open a knowledge base and select **FAQ (Beta)**. **Entries** contains approved question-and-answer pairs; saving a manual entry indexes it immediately alongside documents and websites. **Inbox** contains factual questions for which an assistant completed a knowledge search but found no relevant result.

Agent-generated answers are never published automatically. Review the proposed answer, correct it if needed, and choose **Approve & publish**. You can also dismiss a gap or save an unfinished draft. Each gap links back to its customer-owned History record without exposing infrastructure or model/provider details through the Public API.

Configure each assistant under **Settings → General → Knowledge gap handling (Beta)**: Off, collect questions only, create an internal draft for review, or share an explicitly tentative answer. Even tentative answers require human approval before becoming knowledge.

The workspace must have Beta Features enabled and the assistant must have a knowledge base attached. Conversation-derived drafts follow workspace retention; approved FAQ knowledge persists until deleted.

## How it works

1. **Upload** documents to a knowledge base: PDF, Word (DOCX), HTML, or plain text.
2. The platform **extracts the text, splits it into overlapping chunks** (\~500 tokens), and computes vector embeddings.
3. Each document moves through a status chain: `processing → ready` (or `error` with a message). Updating a document re-indexes it automatically.
4. Attach the knowledge base to an assistant. During calls, the assistant gets a `search_knowledgebase` tool and uses it whenever the question calls for it.
5. Retrieval is semantic (vector similarity), so callers don't need to use your document's exact wording.

<Note>
  While the assistant searches, it can speak a short filler phrase ("Let me look that up for you…") so the caller never hears dead air. Each search is recorded as a call event, visible in the call detail view.
</Note>

## Creating a knowledge base

<Steps>
  <Step title="Create">
    Go to **Knowledge bases → New**, give it a name and a short description. The description is shown to the assistant — write it like a hint: *"Prices, opening hours, and cancellation policy of Example GmbH."*
  </Step>

  <Step title="Upload documents">
    Drag in PDFs, DOCX, HTML, or text files. Wait for each to reach **ready**.
  </Step>

  <Step title="Test the search">
    Use the built-in **test search** to run sample questions against the index and check which chunks come back — before any caller does.
  </Step>

  <Step title="Attach to an assistant">
    In the assistant editor, select the knowledge base. Done — no prompt changes required.
  </Step>
</Steps>

## Writing documents that retrieve well

* Prefer **self-contained sections**: a heading plus the facts under it. Chunks are retrieved individually, so each section should make sense on its own.
* Put **numbers and conditions in the text**, not only in tables spread across pages.
* Avoid duplicate, contradictory documents — retrieval will surface both.
* Keep one topic per document where possible (pricing.pdf, faq.pdf, policy.pdf).

## Crawling a website

Instead of uploading files one by one, you can point a knowledge base at a **website** and let the crawler pull the pages in for you. Each crawled page becomes a knowledge document and is indexed exactly like an upload.

<Steps>
  <Step title="Add a crawl source">
    In the knowledge base, add a **crawl source** with a **root URL** (e.g. `https://example.com/docs`). Optionally restrict it to path prefixes (**include paths**, e.g. `/docs`), skip unwanted sections with **exclude paths** (e.g. `/admin`), and set a **max pages** limit (1–500, default 50).
  </Step>

  <Step title="Run it">
    Trigger a crawl. The crawler reads `robots.txt`, then discovers pages via `sitemap.xml` (falling back to following same-host links from the root page), extracts the main text of each page, and indexes it.
  </Step>

  <Step title="Keep it fresh (optional)">
    Enable **auto-sync** and a **sync interval** (hours). The platform re-crawls the site on schedule. Pages whose content hasn't changed are skipped automatically — no re-embedding, no extra cost.
  </Step>
</Steps>

<Note>
  Website crawling and auto-sync are **plan features** (enabled on your plan) and are billed as **usage credits per crawled page** (only new or changed pages count). A re-crawl of an unchanged site is effectively free. If your balance runs out mid-crawl, the run stops gracefully — pages fetched so far are kept and the source shows the status `error` with the message *insufficient credits*.
</Note>

### Crawler limits

* **Static HTML only** — no JavaScript rendering. Single-page apps that render content client-side (no server-side HTML) will yield little or no text.
* **Same host only.** Links to other domains are not followed.
* **Text pages only** — non-HTML responses and pages larger than 2 MB are skipped. Linked files (PDFs etc.) are not downloaded during a crawl; add those as document URLs instead.
* **Politeness**: at most 2 requests in parallel with a short delay, and `robots.txt` `Disallow` rules are respected.

## Limits and plans

The number of knowledge bases per account is a plan limit (`max_knowledgebases`). Website crawling charges credits per crawled page (see the note above).

Each knowledge base also has fixed resource caps:

| Resource                            | Limit                                        |
| ----------------------------------- | -------------------------------------------- |
| Files                               | 25 per knowledge base (max 20 MB each)       |
| URLs (single pages + crawled pages) | 500                                          |
| Text snippets                       | 50                                           |
| CSV / TSV                           | 1,000 rows and 50 columns                    |
| Crawl exclude paths                 | 200 per source, 500 total per knowledge base |
