# Support citations

## What are *citations* of a *Knowledge base*?

{% hint style="warning" %}
Citations are currently best optimized for *Documents*, *External*, or *Custom* knowledge base types.
{% endhint %}

*Citations* are references that point to the original source of information when your conversational AI delivers a response from a knowledge base. Citations show where the information comes from, allowing users to verify an answer's accuracy and explore its sources.

In the AI's response, citations will appear inline with number indicators `[1]` and an accompanying `sources` section to correlate with each numbered citation:

<figure><img src="https://2737319166-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHCxYxhIU0Bqkjj942mGk%2Fuploads%2FyeEuLUKHnlVUDkeHFzQW%2Fimage.png?alt=media&#x26;token=026699c9-788d-477b-b292-7977f797ca73" alt=""><figcaption><p>Source citations using NLX's Touchpoint framework</p></figcaption></figure>

## Create citation modality

To appropriately render citations in your AI's response using [Touchpoint](https://docs.nlx.ai/platform/nlx-platform-guide/flows-and-building-blocks/knowledge-bases/broken-reference), first create a citation modality:

* Select *Resources > Modalities* in your workspace menu
* Select *New modality* > Provide a name (e.g., `KBCitation`)
* Select :sparkles: *Auto-generate*
* Paste sample JSON schema provided below
* Click *Set schema*
* Click *Save*

Citation modality schema:

```json
[
  {
    "content": "",
    "fileName": "",
    "pageNumber": 1,
    "score": 1
  }
]
```

## Citation setup in flow

Once your modality is created, you'll set up your *Knowledge base* with citation support in a flow:

* Select *Flows* in your workspace menu *>* Choose or create a flow
* Add a *Knowledge base* node to the Canvas > Assign the knowledge base created in your workspace to the node
* Enter `{System.utterance}` in the node's *Question* field
* Expand the node's *Settings* section > Enable *Include citation*
* From the *Match* edge of the *Knowledge base* node, add and link a *User choice* node
* On the *User choice* node, add `{Response.answer)` as a message > Assign a [custom Yes/No slot](https://docs.nlx.ai/platform/nlx-platform-guide/flows-and-building-blocks/advanced/slots-custom) to the node
* Select *Add functionality* on the *User choice* node > Choose *Modalities*
* Select the modality you created in the previous step (e.g., `KBCitation`) > Toggle ON *Enable*
* Set the modality's payload value to `{Response.sources}`
* Click *Save*

Note that while using the [Test](https://docs.nlx.ai/platform/nlx-platform-guide/ai-applications/testing) widget in your workspace, the citation modality will not render for test chats. Instead, deploy a build of your application to launch the Touchpoint configurator and experience it live.

{% hint style="success" %}
Once you've created a build and deployed your application, access the Touchpoint configurator from [deployment details](https://docs.nlx.ai/platform/nlx-platform-guide/ai-applications/types/core#deployment) to install the Touchpoint SDK to your site.
{% endhint %}
