# Knowledge templates

**You'll need:** an administrative role. **Administration → Knowledge Templates.**

import { TileKnowledgeTemplate } from "../../../src/tiles/TileKnowledgeTemplate";

A knowledge template defines what a record in a knowledge base looks like: the fields,
their types, which are required. A `Product` template might have a name, a description, a
price, a category and an image; a `Location` template an address, hours and a phone
number.

<figure className="gai-mock">
	<TileKnowledgeTemplate
		title="Configure Knowledge Template"
		fields={[
			{ name: "Audience Name", type: "text" },
			{ name: "Common Job Titles", type: "list" },
			{ name: "Annual Revenue", type: "currency" },
			{ name: "Digital Behavior", type: "check" },
		]}
	/>
	<figcaption>
		Each field carries a type, which is what lets the AI answer exactly rather than
		approximately: a currency field can be compared, while a paragraph mentioning a
		price cannot.
	</figcaption>
</figure>

## Why templates matter

A knowledge base without a template is a body of text, and the AI answers approximately
from it. A knowledge base with a template is a table, and the AI answers exactly.

The difference shows in questions that have one right answer:

- *"What does the AeroDesk 2 cost?"* A price field answers this reliably; a paragraph
  mentioning the price answers it sometimes.
- *"Which locations are open on Sunday?"* An hours field can be filtered; prose cannot.

Templates also make bulk import possible, since a spreadsheet's columns are mapped onto
the template's fields.

## Design a template

Include only the fields you will maintain. Every field has to be filled in for every
record, and empty fields are worse than absent ones: the AI reads them as "no value"
rather than "unknown".

Three rules to follow:

1. **One record per real-world thing.** One product, one location, one policy.
2. **Fields for what gets asked about.** If nobody asks it, it belongs in the description.
3. **Consistent names across templates.** If `Product` calls it `category`, `Service`
   should too.

## Analysis schemas for media

The same idea applies to uploaded files. An **analysis schema**
(**Administration → Media Analysis**) defines what the AI should extract from an
image, so a product library and an event library get analyzed for different things.

See [tags and descriptions](/guide/media/tags-and-descriptions).

## Change a template later

Adding a field is safe: existing records have it empty until someone fills it in.
Removing or renaming a field affects every record and anything that references it, so
get the names right early.

Changes are recorded in **Administration → History**.
