---
title: "AI Prompt Rendering"
description: "Generate context-rich prompts for entities, segments, and experiences to use with LLM chat models."
url: "https://www.contentstack.com/docs/lytics/ai-prompt-rendering"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-11-05"
---

# AI Prompt Rendering

Generate context-rich prompts for entities, segments, and experiences to use with LLM chat models.

## Overview

Lytics can render context-rich prompts for your entities (customer profiles), segments (audiences), and experiences (campaigns). These prompts are designed to be fed into LLM chat models for tasks like customer analysis, content personalization, or campaign optimization.

Each prompt is generated by applying one or more templates to the underlying data, producing a formatted text output suitable for LLM consumption.

## API Reference

### Entity Prompt

```
GET /v2/ai/prompt/entity/{fieldName}/{fieldValue}
```

Renders a prompt for a specific customer profile, identified by a field name and value.

#### Path Parameters

Parameter

Description

fieldName

The identity field to look up (e.g., email, user\_id)

fieldValue

The value of the identity field

#### Query Parameters

Parameter

Type

Description

templateIds

string\[\]

Optional additional template IDs to chain after the default entity template

#### Response

Returns a plain text prompt containing the rendered entity context, including profile attributes, segment memberships, and behavioral data.

### Segment Prompt

```
GET /v2/ai/prompt/segment/{segmentId}
```

Renders a prompt for a specific audience segment.

#### Path Parameters

Parameter

Description

segmentId

The segment identifier

#### Query Parameters

Parameter

Type

Description

templateIds

string\[\]

Optional additional template IDs to chain

#### Response

Returns a plain text prompt containing the segment definition, membership criteria, and summary statistics.

### Experience Prompt

```
GET /v2/ai/prompt/experience/{experienceId}
```

Renders a prompt for a specific experience (campaign or personalization).

#### Path Parameters

Parameter

Description

experienceId

The experience identifier

#### Query Parameters

Parameter

Type

Description

templateIds

string\[\]

Optional additional template IDs to chain

#### Response

Returns a plain text prompt containing the experience configuration, targeting criteria, and performance context.

## Use Cases

*   **Customer Analysis**: Generate prompts for individual profiles and feed them to an LLM for insights about customer behavior and preferences.
*   **Content Personalization**: Use segment prompts to generate tailored content recommendations.
*   **Campaign Optimization**: Provide experience prompts to an LLM for suggestions on improving campaign performance.
*   **Template Chaining**: Use custom templateIds to append domain-specific context to the default prompts.