# Ingesting Data into the Knowledge Base

In this tutorial, you'll learn how to send data to the SnackPrompt AI Engine Knowledge Base.

### What is an Elemental?

An **elemental** is the basic unit of data in SnackPrompt. It can be:

* A **table** with columns and items
* A **document** with sections
* A **file** with structured content

When you send an elemental, the API:

1. Processes the content
2. Generates embeddings (vector representations)
3. Stores in the Knowledge Base
4. Makes the data searchable

### How to create a simple Knowledge Base

#### Step 1: Set up your Knowledge Base

The first step is to ensure your data is accessible to the AI. In Snackprompt, you can transform any element into a data source:

1. Create a **Table**, **Document**, or **Prompt**.
2. Populate it with your data.
3. Enable the **Knowledge Base** toggle in the settings menu.

For a detailed step-by-step on this process, see our guide: [Creating your first Knowledge Base](https://snack-prompt.gitbook.io/snack-prompt-docs/getting-started/create-a-simple-knowledge-base-using-our-elements).

### What Happens During Ingestion?

When you send an elemental, the API executes the following steps:

```
1. Receives the elemental_id
       ↓
2. Fetches complete data from SnackPrompt platform
       ↓
3. Processes the content (parsing)
       ↓
4. Splits into chunks (smaller pieces)
       ↓
5. Generates embeddings
       ↓
6. Stores in our Vector Database
       ↓
7. Data available for search!
```

### Stored Metadata

During ingestion, the following metadata is stored with each chunk:

| Field                | Description                                   |
| -------------------- | --------------------------------------------- |
| `tenant_id`          | Tenant ID (for isolation)                     |
| `user_id`            | User ID                                       |
| `snack_elemental_id` | Source elemental ID                           |
| `snack_column_id`    | Column ID (if applicable)                     |
| `snack_item_id`      | Specific item ID                              |
| `source`             | Source type (`elemental`, `document`, `file`) |
| `type_name`          | Elemental type (Table, Document, etc.)        |
| `category_name`      | Elemental category                            |
| `original_text`      | Original chunk content                        |
| `tag_ids`            | Associated tag IDs                            |
| `tag_names`          | Associated tag names                          |

### Tag Inheritance

Tags are inherited in cascade:

```
Document (document tags)
    └── Column (column tags)
            └── Item (item tags)
```

The final item will have the **merge** of all tags (no duplicates).

### Next Steps

Now that your data is in the Knowledge Base:

1. [Semantic Search](/bring-your-data-into-ai/get-started/semantic-search.md) - Learn how to search your data
2. [Chat with your Data](/bring-your-data-into-ai/get-started/chat-with-your-data-rag.md) - Chat with your data using AI
3. [Filter by Tags](/bring-your-data-into-ai/how-to/how-to-filter-by-tags.md) - Use tags to filter results

***

**Estimated time:** 10 minutes ✅


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.snackprompt.com/bring-your-data-into-ai/get-started/ingesting-data-into-the-knowledge-base.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
