Skip to main content

Prompt Data Model

This page explains the structure of prompts in LangWatch and how they’re organized.

Overview

Prompts in LangWatch contain all the information needed to generate AI responses, including the prompt text, model configuration, and optimization settings.

Complete Prompt Structure

When you retrieve a prompt, you get all the configuration in a single response:

Field Descriptions

Core Fields

string
required
Unique identifier for the prompt
string
required
Human-readable identifier for the prompt (primary way to reference prompts)
string
required
The project that owns the prompt
string | null
The organization that owns the prompt
integer
required
Current version number
string
required
Unique identifier for this version
timestamp
required
When this version was created
timestamp
required
When the prompt was last updated
string
required
The user who created this version
timestamp | null
Soft delete timestamp (null if not deleted)

Scope and Access

string
default:"PROJECT"
required
  • PROJECT - Prompts are only accessible within the project
  • ORGANIZATION - Prompts are shared across all projects in the organization

Model Configuration

string
required
The LLM model to use (e.g., “openai/gpt-4o-mini”). Model names follow the litellm structure (“provider/model”)
float
required
Fine-tune creativity vs. consistency (0.0 = deterministic, 2.0 = very creative)
integer
required
Control response length and costs

Content Fields

string
required
The main prompt text (system message)
array
Array of chat messages with roles and content (alternative to prompt field)

Runtime Parameters

object
default:"{}"
Arbitrary JSON object versioned alongside the prompt. Use it to store application settings that should change together with the prompt (thresholds, iteration counts, structured output schemas, feature switches). Changing parameters creates a new prompt version. See Runtime Parameters.

Variable System

Variable Formatting

Prompts use {{ variable_name }} syntax for dynamic content:

Supported Variable Types

  • Strings: {{user_name}}
  • Numbers: {{count}}
  • Booleans: {{is_premium}}
  • Lists: {{items}}
  • Objects: {{user_data}} (will be converted to string)

Optimization Features

Studio Only: These advanced optimization features require the optimization studio interface for proper experimentation, performance measurement, and A/B testing. They cannot be configured via the API.

Input/Output Definitions

array
Array of input variable definitions with identifiers and types
array
Array of output variable definitions with identifiers and types

Type System

  • "str" - String values
  • "float" - Floating point numbers
  • "bool" - Boolean values
  • "image" - Image data
  • "list[str]" - List of strings
  • "list[float]" - List of floats
  • "list[int]" - List of integers
  • "list[bool]" - List of booleans
  • "dict" - Dictionary/object
  • "str" - String responses
  • "float" - Numeric responses
  • "bool" - Boolean responses
  • "json_schema" - Structured JSON responses

Advanced Features

object
Configuration for advanced prompting strategiesThe prompting strategy to use.
  • "few_shot" - Few-shot learning with examples
  • "in_context" - In-context learning approach
  • "chain_of_thought" - Chain-of-thought reasoning
object
Few-shot examples with columns and rows structure

Demonstrations Structure