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

ParameterDescription
fieldNameThe identity field to look up (e.g., email, user_id)
fieldValueThe value of the identity field

Query Parameters

ParameterTypeDescription
templateIdsstring[]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

ParameterDescription
segmentIdThe segment identifier

Query Parameters

ParameterTypeDescription
templateIdsstring[]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

ParameterDescription
experienceIdThe experience identifier

Query Parameters

ParameterTypeDescription
templateIdsstring[]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.