# AI-Generated Segment

Segmentation is a foundational task in marketing and campaign delivery, yet it is frequently burdened by manual, tedious processes. This inefficiency leads to delays in segment creation, increased operational costs, and a higher risk of error in targeting. Lemnisk introduces AI-generated Segmentation, a powerful feature designed to transform this critical process.&#x20;

This AI-driven approach significantly reduces manual effort, preserves the valuable context of past segment configurations, and translates complex business logic into validated, executable queries instantly. Adopt prompt-based segmentation to accelerate your time-to-market and ensure maximum accuracy in all your marketing campaigns.

### Steps To Create Segments Using Prompts

1. Navigate to **Campaigns** > **Segments.**
2. Click **+Add Segment** and choose the type of segment you want to create.
3. **Select the Segment type:** To create an AI-generated Segment, choose the segment type as **AI-Generated Segment.** &#x20;

   <figure><img src="https://1782533751-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FazJDZwzHkmWIbkYOetQH%2Fuploads%2FqlSxFUAM1GC7GOmRt1PN%2Fimage.png?alt=media&#x26;token=1976f434-404b-47df-bb30-bf6824f9003b" alt=""><figcaption></figcaption></figure>
4. Enter your prompt and click **Generate.** The segment will be populated and shown below.&#x20;

   <figure><img src="https://1782533751-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FazJDZwzHkmWIbkYOetQH%2Fuploads%2FYWngRNc2zIkzFmi1wxM1%2Fimage.png?alt=media&#x26;token=ce309dc2-e67b-48ff-b654-71fc93c8833e" alt=""><figcaption></figcaption></figure>
5. If you are not satisfied with the generated segment, you can enhance your prompt and click **Generate** again. This will generate a new segment based on your new prompt.&#x20;

   <figure><img src="https://1782533751-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FazJDZwzHkmWIbkYOetQH%2Fuploads%2Fl49xnTUHwWjDwgutG1lV%2Fimage.png?alt=media&#x26;token=ba40f262-bdaf-42b8-8f57-a13ee21e71fd" alt=""><figcaption></figcaption></figure>

### Guidelines For Writing Prompts

#### 1. Mandatory Structural & Data Rules

These rules dictate the syntax and data references required for a functional prompt.

| **Rule Category** | **Requirement**                                                             | **DO (Approved) Structure**                                                                | **DON'T (Rejected) Structure**                                                 |
| ----------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
| Start/Verb        | All prompts must begin with a strong, active verb (e.g., Segment, Create).  | Segment users...                                                                           | Users whose age...                                                             |
| Simple Attribute  | Segment by a single user property.                                          | Segment users whose age is 32.                                                             | Segment users who are 32 years old.                                            |
| Simple Event      | Segment by a single action within a timeframe.                              | Segment users who have performed an insurance purchase in the last 10 days.                | Segment users who in last 10 days purchased an insurance.                      |
| Combined Query    | Segment by an attribute AND/OR an event.                                    | Segment users whose age is 32 AND who have done an insurance purchase in the last 10 days. | Segment users who in the last 10 days purchased insurance and their age is 32. |
| Canonical Fields  | Use the exact, case-sensitive Attribute or Event name from the data schema. | Segment users whose Customer\_Tier is Platinum.                                            | Segment users whose tier is Platinum.                                          |

#### 2. Key Content Best Practices

These rules dictate the content and semantics to improve prompt clarity and reduce ambiguity.

| **Best Practice Area**         | **Requirement**                                                                                                                                                                                    | **DO (Explicit) Example**                                                                                                                                                                       | **DON'T (Vague) Example**                                                                                                                                             |
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Specifying Context             | Use clear, measurable criteria (exact asset, URL, App ID) instead of subjective terms.                                                                                                             | Segment users who engaged with the website "mywebsite.com"                                                                                                                                      | Customers who engaged with my website                                                                                                                                 |
| Handling Exclusion (Attribute) | Use explicit negative structure with `is not` for attributes.                                                                                                                                      | Segment users whose Subscription Status is not Trial                                                                                                                                            | Customers who are not on a free trial                                                                                                                                 |
| Handling Exclusion (Event)     | Use the mandatory `have not [event]` structure for excluding actions.                                                                                                                              | Segment users who have not updated the app in the last 15 days                                                                                                                                  | Customers who need to update the app                                                                                                                                  |
| Avoiding Complexity            | Stick to simple, relative time periods (e.g., *last month*, *last year*). Avoid complex date filters.                                                                                              | Segment users with cases that closed this past month.                                                                                                                                           | Segment users with cases closed > October 31st.                                                                                                                       |
| Avoiding One-Word Prompts      | Always provide context (action or attribute) to connect keywords.                                                                                                                                  | Segment users whose profession is fishing and have made a purchase in the last year.                                                                                                            | Segment fishermen who have made a purchase in the last year.                                                                                                          |
| Combined Query Order           | Maintain the established order: Attributes First, Events Second.                                                                                                                                   | Segment users whose Customer\_Tier is Platinum AND who have done a purchase.                                                                                                                    | Segment users who have done a purchase AND whose Customer\_Tier is Platinum.                                                                                          |
| Grouping Rules                 | <p>Use comma to define how different conditions relate — whether they apply together or separately.<br>A misplaced comma can change which filters are grouped, just like parentheses in logic.</p> | Segment users who performed the event page Viewed and did not perform the event productPurchased. User age should be greater than 15 and age should be less than 25, OR the gender equals male. | Segment users who performed the event "page Viewed" and did not perform the event "productPurchased. The age group should be between 15-25 or the gender equals male. |

### Sample Prompts

| Title               | Sample Prompt                                                                        |
| ------------------- | ------------------------------------------------------------------------------------ |
| 30 Day Active Users | Users who performed Page\_Viewed or Screen\_Viewed at least once in the Last 30 days |
| Drop-off Onsite     | Create a segment of users as soon as they close on-site notifications                |
| Active on Email     | Users who Opened an Email within the Last 30 days                                    |
| Engaged on Email    | Users who Clicked on Emails at least 3 times in the Last 30 days                     |
| Active on SMS       | Users who Clicked an SMS within the Last 30 days                                     |
| Engaged on SMS      | Users who Clicked on SMS at least 3 times in the Last 30 days                        |
| Active on RCS       | Users who Opened an RCS within the Last 30 days                                      |
| Engaged on RCS      | Users who Clicked on RCS messages at least 3 times in the Last 30 days               |
| Active on WhatsApp  | Users who opened a WhatsApp message within the Last 30 days                          |
| Engaged on WhatsApp | Users who clicked on WhatsApp messages at least 3 times in the Last 30 days          |

{% embed url="<https://www.youtube.com/watch?v=hIYPojNqlWo>" %}
