# Knowledge Base

### Uploading Documents

You can set certain parameters for the indexing process. These parameters can be found in `Build -> Agent Configuration -> Call Control -> Knowledge Base`

To upload a file:

* Go to Knowledge Base page
* Click + Add
* Choose format: file, raw text, or URL

#### File upload

Currently supported file formats:&#x20;

* .xlsx (please read [#table-retrieval-node](#table-retrieval-node "mention")for additional requirements)
* .docx
* .pdf
* .txt
* .epub
* .html

#### URL upload

You can paste in a URL and the agent will retrieve information from it automatically. The URL must be publicly available.&#x20;

**Crawling websites costs credits!** Processing websites is a complex task and as such, it costs credits depending on the length and amount of crawled websites.&#x20;

**Crawl depth**: This is a parameter that controls the bahavior of the agnet when retrieving the provided website. If crawl depth is set to more than 0, the agent will follow links up to crawl depth.  If you wish to retrieve only the specified website, leave the depth set to the default value of 0.&#x20;

#### Text upload

This is the simplest form of a knowledge base document, you can simply paste text that you want the acgent to be able to access.&#x20;

### Knowledge Base node

Once you have uploaded knowledge base documents, you can add them to knowledge base nodes. This applies to all document types, including XLSX files. Select one or more documents in the node dropdown and the agent will be able to use them to answer the user while in that node. If you upload many documents and wish for all of them to be available, simply select the `Use all knowledge bases in this agent` option.&#x20;

### Global knowledge base

If you wish, you can make certain knowledge base documents available to the agent in the entire pathway. To add this, go to `Build -> Agent Configuration -> Conversational Flow -> Global Prompt` and select documents in the `Select Knowledge Bases` dropdown. Same as the KB node, you can select the `Use all knowledge bases in this agent` option.&#x20;

Keep in mind that this will increase the agent's response latency, because KB lookups take additional time. It is recommended to use knowledge base nodes to localize KB lookups and use global KB only when absolutely necessary.&#x20;

### Table Retrieval node

In some cases, you may wish for your agent to be able to query structured data. You can use the table retrieval node for this. In this node, you can select one `XLSX` document from your uploaded files. The agent will be able to query that document using SQL. For best results, we highly recommend reading and following the list below.&#x20;

**Requirements and recommendations:**

* You must upload the data as a `.xlsx` file
* Do not upload large files with hundreds of thousands of rows. If you have a need for large file support, contact us. If your uploaded file is too big, the call will fail and you will see an error in Live Logs.&#x20;
* The file name should be descriptive (good: `customers.xlsx`, bad: `excel_sheet2.xlsx`)
* The file should contain a single sheet. Any sheets except the first one will be ignored.&#x20;
* The first row is treated as a header. All columns must have names in the first row, and column names should be descriptive.&#x20;
* Adhere to consistent data types in columns. Types are inferred automatically and cells not conforming to the inferred column type are (silently) replaced with NULL.&#x20;
* Structure the data consistently and logically. The agent may get confused if your table contains inconsistent or confusing data.&#x20;

**Monitoring:**

The agent has access to your table via a tool. If you're having issues with the agent retrieving incorrect information or being unable to retrieve, please check the Live Logs (`Insights -> Call Logs -> green Live Logs button`). Enable trace logs at the top, and search for `call.tool.invocation` logs. They will contain the agent's queries and results, so you can see why it answered the way it did.    &#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dataqueue.gitbook.io/voicehub-docs/agent-design-and-usage/upload-knowledge-base.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
