> For the complete documentation index, see [llms.txt](https://manuals.dialox.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manuals.dialox.ai/studio/flows/nodes/iterate-llm-knowledgebase.md).

# Iterate: LLM Knowledge base

To provide the user a way to ask questions that can be answered by an LLM using a predefined knowledgebase

The **Iterate: LLM Knowledge base** node is used in the same way the [default Iterate](https://manuals.dialox.ai/studio/flows/nodes/iterate-iterate.md) or [Iterate: LLM](https://manuals.dialox.ai/studio/flows/nodes/iterate-llm.md) node is used. This means it is most often used as a form of main menu in your Smart App: "What can I do for you today?".

Large language models (LLMs) are great at understanding user questions and provide sensible answers based on the information stored in the common knowledge of the language model. The [**Iterate: LLM**](https://manuals.dialox.ai/studio/flows/nodes/iterate-llm.md) node solely relies on a predefined but limited prompt instruction to answer the user. This node, however, will also use a Knowledge base on top of this prompt instruction. This [knowledge base](https://manuals.dialox.ai/studio/ai/knowledge-bases.md) can be configured in the [AI section](https://manuals.dialox.ai/studio/ai.md).

## What is a Large Language Model?

A Large Language Model is a type of artificial intelligence (AI) model designed to understand and generate human-like text based on the input it receives (prompts). These models are trained on massive datasets of text from books, articles, websites, and other written content, enabling them to process and generate coherent language.

This node uses the ChatGPT models from OpenAI together with the Assistants API, hosted on the Microsoft Azure platform to answer the users of your Smart app.

## What is a knowledge base?

A **knowledge base** is a centralized repository for information, designed to store, organise, and manage knowledge in a way that makes it easily accessible and usable for a specific purpose. Knowledge bases are commonly used by organisations, apps, and systems to provide self-service support, streamline workflows, and enhance decision-making.

## How to use?

As explained in the introduction, the **Iterate: LLM Knowledge base** node works the same way as the **Iterate: LLM** node, adding the ability to use a predefined knowledge base as its knowledge. Also, the **Iterate: LLM Knowledge base** works as a menu. It either responds due to one of the [labelled links](https://manuals.dialox.ai/studio/flows/links.md#labelled-links) or [dialog triggers](https://manuals.dialox.ai/studio/flows/links.md#dialog-triggers-that-are-triggered-by-a-user-intent) being triggered, by answering one of its [FAQs](#faqs-and-routes), by following one of its [Routes](#faqs-and-routes), or otherwise responds from the LLM.

<figure><img src="https://3356808761-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEBQHGJABNTj5ISSOTRxM%2Fuploads%2Fm9VLp3PKZXXZ68xPOpgz%2Fllm-kb-blurred.png?alt=media&amp;token=a2167cdb-a949-462a-bfb4-1cc811f6cfbd" alt=""><figcaption><p>Example of how to use the node in your Flow</p></figcaption></figure>

In the above example, the **Iterate: LLM Knowledge base** will match the intents associated with the two labelled links "Talk to a human" and "Done". When the user doesn't appear to be asking for one of these intents, it will use the LLM to generate an answer.

The LLM can use a specific instruction from you (as the Smart App designer) to guide the generation of the answer. This instruction is given in the form of a "Prompt". The prompt can be configured in the AI section of the platform. Besides instructions, the prompt will also contain content that the LLM can use on top of its own dataset to generate answers, like information regarding your address, opening hours, parking instructions, etc. See the [Prompts](https://manuals.dialox.ai/studio/ai/prompts.md) page for more information on this topic.

## FAQs and Routes

Just like the [**Iterate: Iterate**](https://manuals.dialox.ai/studio/flows/nodes/iterate-iterate.md) node, the **Iterate: LLM Knowledge base** node supports FAQs and Routes. They keep your Flow canvas clean: instead of drawing a link for every simple question or redirect, you configure them in the side panel of the node.

* **FAQs** - Select one or more FAQs that are maintained in the [FAQs](https://manuals.dialox.ai/studio/content/faqs.md) page in the Content section. When the user's message matches the intent of an FAQ, the Smart App gives the answer of that FAQ (and adds its tag, if one is set) without using the LLM or the knowledge base. After that, the node asks the user again.
* **Routes** - Add a Route by selecting an intent and a destination Flow, and optionally one or more tags. When the user's message matches the intent, the tags are added to the conversation and the Smart App continues in the destination Flow.

The LLM and the knowledge base are only used when none of the FAQs, Routes, labelled links or dialog triggers match the user's message.

{% hint style="info" %}
The intents used in FAQs and Routes must exist in your Smart App. Don't use the same intent for both an FAQ and a Route.
{% endhint %}

## Node properties

| Property          | Description                                                                                                                                         | Explanation |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| Question          | The initial question                                                                                                                                |             |
| Repeat (1)        | The text to use when re-prompting the user after a turn                                                                                             | optional    |
| Repeat (2)        | The next text to use when re-prompting the user after a turn. The system will keep on iterating this step the third and all other turns             |             |
| Prompt            | The [prompt](https://manuals.dialox.ai/studio/ai/prompts.md) which contains the instructions and content the LLM can use when generating a response |             |
| AI Knowledge base | The [knowledge base](https://manuals.dialox.ai/studio/ai/knowledge-bases.md) for the LLM to use to generate answers to the user                     |             |
| FAQs              | The [FAQs](https://manuals.dialox.ai/studio/content/faqs.md) this node answers directly, without using the LLM                                      | optional    |
| Routes            | Intents that redirect the user to a different Flow, optionally adding tags to the conversation                                                      | optional    |

## Limitations

The knowledge base limitations are described in the [knowledge base page in the AI section](https://manuals.dialox.ai/studio/ai/knowledge-bases.md).

## Resources

* [LLM Knowledge base](https://manuals.dialox.ai/store/skills/llm-knowledge-base.md)
* [Iterate: Iterate](https://manuals.dialox.ai/studio/flows/nodes/iterate-iterate.md)
* [Iterate: LLM](https://manuals.dialox.ai/studio/flows/nodes/iterate-llm.md)
* [Links](https://manuals.dialox.ai/studio/flows/links.md)
* [Knowledge bases](https://manuals.dialox.ai/studio/ai/knowledge-bases.md)
* [FAQs](https://manuals.dialox.ai/studio/content/faqs.md)
