> For the complete documentation index, see [llms.txt](https://docs.chatlayer.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chatlayer.ai/start-quickly/bot-templates/knowledge-base-ai-template.md).

# Knowledge base AI template

## Template overview

This template uses our latest [Knowledge base AI](/navigation/knowledge-base-ai.md) feature to generate answers based on your own documentation.

{% hint style="warning" %}
You can use the Knowledge base AI for free if you ask it under 50 questions per month. If you would like to use more than that, please [contact us](https://forms.office.com/pages/responsepage.aspx?id=ropROyGJe0qEl2GddWziDpBKj7if3UFHrttkAY_OzkZURUM1Wk4yRFZHM1pJRlJXWjFBWDg1VE0wSS4u).
{% endhint %}

## How to customize this template

To customize this template:

1. [Add your content ](https://docs.chatlayer.ai/bot-answers/knowledge-base-ai/set-up-your-faq-flow-using-a-generative-knowledge-base-ai#add-content)under the **Knowledge Base AI** tab.
2. Test your bot by asking anything.
3. You're good to go! Every time you'll ask a question, the bot will trigger the **Not Understood** block which will then scrape your knowledge base to generate an answer.

<figure><img src="/files/8pPjLCalfJgLzyUH6Myk" alt=""><figcaption><p>Example of use of the knowledge base AI feature.</p></figcaption></figure>

## Block: Source router

The Source router is a Condition block that checks if the source of the answer was a document or a URL. If the source was a URL, the response will be given together with a link to the source. If the source was a document, the response wouldn't give a link with it.&#x20;

<figure><img src="/files/rgg1bH2qazqDMAYCyyZ1" alt=""><figcaption><p>The Source router blocks checks the source of the generated answer before displaying it.</p></figcaption></figure>

## Learn more

Learn all about how the Knowledge Base AI feature works under this documentation page:

{% content-ref url="/pages/v6Cuhc3NAXayTCwVjBeA" %}
[Knowledge base AI](/navigation/knowledge-base-ai.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.chatlayer.ai/start-quickly/bot-templates/knowledge-base-ai-template.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
