> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Create KG from CSV and JSON

<Badge icon="arrow-left" color="gray">[Back to NLP Topics](/ai-for-service/automation/natural-language/nlp-topics)</Badge>

Build your Knowledge Graph in a CSV spreadsheet or JSON file, then import it into your AI Agent. This is useful when your FAQ data already exists outside the platform or when you need to make frequent bulk updates.

**Steps:**

1. Download the sample CSV or JSON file from the AI Agent.
2. Edit the file to add questions, responses, synonyms, etc.
3. Import the file. See [Import a Knowledge Graph](/ai-for-service/automation/knowledge-ai/import-and-export-knowledge-graph).

***

## CSV File

### Download the Sample

1. Go to **Automation AI > Knowledge AI > FAQs > ⋯ (more) > Import**.
2. Back up your existing KG when prompted (choose CSV or JSON format).
3. Click **Proceed**, then click **Sample CSV** to download.

### CSV Structure

The CSV contains five section types, each preceded by a header row.

#### FAQ Section

| Column                                    | Description                                                                                                                                                                   |
| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Faq`                                     | Section header; leave blank in data rows.                                                                                                                                     |
| `Que ID`                                  | Auto-generated by the platform. Leave blank for new FAQs; do not edit for existing ones.                                                                                      |
| `Path`                                    | Node path for the FAQ. Prefix mandatory nodes with `**`; organizer nodes with `!!`.                                                                                           |
| `Primary Question`                        | The main question. Leave blank to add an alternate answer to the previous question.                                                                                           |
| `Alternate Question`                      | Optional. Add one per row for multiple alternates.                                                                                                                            |
| `Tags`                                    | Tags for the question or alternate question.                                                                                                                                  |
| `Answer`                                  | The response. Supports plain text, scripts (`SYS_SCRIPT; <js>`), channel-specific (`SYS_CHANNEL_<name> SYS_TEXT; <text>`), or dialog trigger (`SYS_INTENT; <dialog ref id>`). |
| `Extended Answer-1` / `Extended Answer-2` | Optional. Use when the response is lengthy.                                                                                                                                   |
| `ReferenceId`                             | Optional. External source reference.                                                                                                                                          |
| `Display Name`                            | Optional. Shown to users in ambiguity scenarios.                                                                                                                              |

#### Nodes Section

| Column          | Description                                      |
| --------------- | ------------------------------------------------ |
| `Node`          | Section header; leave blank in data rows.        |
| `Nodepath`      | Path to the node/tag.                            |
| `Tag`           | Required for tag settings; leave blank for node. |
| `Precondition`  | Conditions required to qualify this node/tag.    |
| `outputcontext` | Context populated by this node/tag.              |
| `Traits`        | Traits for this node/tag.                        |

#### Synonyms Section

| Column     | Description                                   |
| ---------- | --------------------------------------------- |
| `Synonyms` | Section header; leave blank in data rows.     |
| `Phrase`   | The term or phrase for which to add synonyms. |
| `Synonyms` | Comma-separated synonym values.               |

To enable Bot Synonyms in KG term identification:

* Use `confidenceConfigs` as the header.
* Set `parameter` to `useBotSynonyms` and `value` to `true` or `false`.

#### KG Params Section

| Column      | Description                                 |
| ----------- | ------------------------------------------- |
| `KG Params` | Section header; leave blank in data rows.   |
| `lang`      | App language code (e.g., `en` for English). |
| `stopwords` | Comma-separated stop words.                 |

#### Traits Section

| Column           | Description                                       |
| ---------------- | ------------------------------------------------- |
| `Traits`         | Section header; leave blank in data rows.         |
| `lang`           | App language code.                                |
| `GroupName`      | Trait group name.                                 |
| `matchStrategy`  | `Pattern` or `probability` (ML-based).            |
| `scoreThreshold` | Threshold (0-1) when `matchStrategy` is ML-based. |
| `TraitName`      | Name of the trait.                                |
| `Training data`  | Utterances for the trait.                         |

**For Taxonomy-based KG** (FAQs linked to other FAQs):

| Field           | Description                                                  |
| --------------- | ------------------------------------------------------------ |
| `faqLinkedTo`   | `Que ID` of the source FAQ this FAQ is linked to.            |
| `faqLinkedBy`   | `Que ID`s of FAQs linked to this FAQ.                        |
| `isSoftDeleted` | Identifies FAQs that are deleted but still have linked FAQs. |

## JSON File

### Download the Sample

1. Go to **Automation AI > Knowledge AI > FAQs > ⋯ (more) > Import**.
2. Back up when prompted, then click **Proceed**.
3. Click **Sample JSON** to download.

### JSON Property Reference

| Property              | Type   | Description                                                                           |
| --------------------- | ------ | ------------------------------------------------------------------------------------- |
| `FAQ`                 | Array  | Contains question, answer, terms (leaf to first-level node), and alternate questions. |
| `question`            | String | Primary question (inside FAQ array).                                                  |
| `answer`              | String | AI Agent response (inside FAQ array).                                                 |
| `terms`               | Array  | Leaf node and parent nodes up to the first-level node.                                |
| `refId`               | String | Optional external source reference.                                                   |
| `Alternate Questions` | Array  | Alternate questions and their terms (leaf to first-level node).                       |
| `Synonyms`            | Object | Arrays of terms and their synonyms.                                                   |
| `Unmappedpath`        | Array  | Nodes with no questions, and their parents up to first-level node.                    |
| `Traits`              | Object | Trait names as keys; arrays of utterances as values.                                  |

**For Taxonomy-based KG:**

| Field           | Description                                          |
| --------------- | ---------------------------------------------------- |
| `faqLinkedTo`   | Identifies the source FAQ.                           |
| `faqLinkedBy`   | Lists the FAQs linked to this FAQ.                   |
| `isSoftDeleted` | Identifies deleted FAQs that still have linked FAQs. |

***
