# Composite entities

A composite entity is a combination of two or more different, yet related [entities](/nlp/natural-language-processing-nlp/detect-information-with-entities.md#entity-types). This type of entity allows you to combine two separate entities into a single one.

<figure><img src="/files/UjsK0KGoYLsMmwfUENyX" alt=""><figcaption><p>Composite entities tab.</p></figcaption></figure>

<details>

<summary>Example of composite entity</summary>

When a user tells the bot *Two fries please*, the bot will understand this as the predefined composite entity `@order`*,* which consists of two separate entities:&#x20;

* `@sys.number` **:** *2*, a [system entity](/nlp/natural-language-processing-nlp/detect-information-with-entities/system-entities.md).
* and `@foodItem`: *fries*, a [match entity](/nlp/natural-language-processing-nlp/detect-information-with-entities/match-entities.md).&#x20;

</details>

### Add a composite entities

To add a composite entity to your bot:

1. From your [**Entities**](/navigation/natural-language-processing-nlp/synonym-entities.md) tab, make sure that you have different entities that your composite would be made of. For this example, we created a `@car_brand` match entity and will use `@sys.number`.&#x20;
2. Click on **Composite entitie**s.
3. Click on **Add composite entity**.
4. Fill in the **Entity name**.
5. Under **Entity values**, add the entities that will make the composite one.

<figure><img src="/files/LloHXoQg76Ba2Erk8L1n" alt="" width="375"><figcaption><p>Add a composite entity.</p></figcaption></figure>

6. Click on **Create entity**.

### Route your conversation based on composite entity values

To route your flow based on composite entities:

1. Create a [**Collect input**](/buildabot/flow-logic/dialog-state/user-input-bot-dialog.md) block where you composite entity will be detected. In this example, we detect `@car_info`.

<figure><img src="/files/cHF4cg1zyYk7kIFwvdUO" alt="" width="375"><figcaption><p>Detect a composite entity inside your flow.</p></figcaption></figure>

2. Let's say you now want to route the flow based on the year of the car. For instance:&#x20;
   * When the year is equal to or more than 2016, the car is a green car
   * When the year is less than 2016, the car is not a green car.
3. Create a [**Condition**](/buildabot/flow-logic/dialog-state/plugins.md) block that checks the `@car_brand.sys.number` variable.

<figure><img src="/files/kuBdwTwcMZOYZ3nVBB1u" alt="" width="375"><figcaption><p>Route the flow based on part of a composite entity.</p></figcaption></figure>

4. Click **Save**.


---

# 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.chatlayer.ai/nlp/natural-language-processing-nlp/detect-information-with-entities/composite-entities.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.
