> 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

Use AI to scrape your data and generate an answer. All of this, in a ready-to-go template bot.

## 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="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FQ2W7Ekf9YGuLyEBraYqg%2FScreenshot%202023-10-17%20at%2010.57.32.png?alt=media&amp;token=6ea64ba8-844c-45a4-89cf-1e5d2216bba6" 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.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FeFNOJO9YLmlL7elyoyr2%2FScreenshot%202024-04-03%20at%2017.35.32.png?alt=media&amp;token=8c919d7c-da79-4f00-8f72-9322af2868aa" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
