# Knowledge Base

> Upload documents and let your voice agent search them for answers during a call

URL: https://docs.lemuai.com/knowledge-base/overview

A knowledge base is a set of documents you upload to your organization that a voice agent can search while a call is in progress. Upload a PDF, Word document, or text file once, and any conversation step you attach it to can pull relevant passages from it to answer a caller's question.

Behind the scenes, Lemu splits each document into chunks, generates an embedding for every chunk, and stores them so they can be searched by meaning rather than exact keywords — the agent can find the right passage even if the caller phrases their question differently from the document's wording.

## Uploading documents

Documents live under **Agent Setup → Files** in the sidebar (`https://app.lemuai.com/files`).

The **Upload** tab accepts:

- **File types:** PDF, DOCX, DOC, TXT
- **Max size:** 5 MB per file

Drag a file onto the upload area or use **Choose File**. Once the file finishes uploading, processing starts automatically — the **All** tab lists every document with its filename, size, chunk count, and processing status, polling for updates every few seconds while a document is still processing.

| Status | Meaning |
|---|---|
| `pending` | Uploaded, waiting to be processed |
| `processing` | Being converted, chunked, and embedded |
| `completed` | Ready to be selected and searched |
| `failed` | Processing hit an error (see the document's error detail) |

Only documents with status `completed` can be attached to a conversation step — a document that's still `processing` or `failed` won't show up as selectable.

**Note:** Processing embeds each chunk with an OpenAI-compatible embedding model (`text-embedding-3-small` by default). Configure an embeddings provider under **Model Configurations &gt; Embedding** before uploading — without it, processing fails.

You can delete a document from the **All** tab at any time; this also removes its chunks from search results.

## Using a knowledge base in a voice agent

Knowledge base documents are attached per conversation step, not globally to the whole agent. Open the **Start Call** node or an **Agent Node** in the workflow builder, and scroll to the **Documents** section below **Tools** — it lists every completed document as a checkbox so you can select which ones this step can reference.
```
Agent Node
├── Prompt
├── Tools           (HTTP API tools, etc.)
└── Documents        ← knowledge base documents for this step
    ☑ refund-policy.pdf
    ☐ product-catalog.docx
```

If a step has no documents selected, the agent has no knowledge base access on that step. If it has one or more, Lemu registers a `retrieve_from_knowledge_base` function with the LLM for the duration of that step, scoped only to the documents you checked.

### What happens during a call

  - : Caller asks a question
  - : retrieve_from_knowledge_base tool
  - : Vector similarity search (org + selected docs)
  - : Chunks returned with filename + score
  - : LLM answers using the retrieved text

The LLM itself decides when to call the tool — based on your node prompt and the conversation so far — and what search query to send. It isn't a fixed keyword match: write your prompt so the model understands when a caller's question should be looked up (for example, "if the caller asks about pricing, policies, or anything that might be in the uploaded documents, use the knowledge base tool before answering").

A few things worth knowing about the search itself:

- Each call returns a small number of the most relevant chunks (three, by default) — not the whole document.
- Results aren't filtered by a similarity cutoff before reaching the LLM; the model sees the best matches available and judges relevance itself.
- The search is always scoped to your organization and to the documents selected on that node — a document isn't visible to a step unless it's checked on that step.

Knowledge base documents can be attached to voice agent nodes (Start Call and Agent Node). Journeys don't search documents directly; to use your documents in a journey, call a voice agent from it.
