Structured Input Placeholders
For CONVERSATION-type endpoint connections, the input template must reference at least one field from the test case’s structured input using property access syntax:user_message and customer_id, you reference them as {{ input.user_message }} and {{ input.customer_id }}.
Context Fields
Test cases can include structured context alongside the input. Access context fields with the same property access syntax:{{ context.topic }}, {{ context.system_prompt }}, or {{ context.language }}.
Complete Placeholder Reference
| Placeholder | Description |
|---|---|
{{ input.<field> }} | Access a field from the test case input (required). Example: {{ input.user_message }} |
{{ context.<field> }} | Access a field from the test case context. Example: {{ context.topic }} |
{{ session_id }} | The external session ID (if available) |
{{ galtea_session_id }} | Galtea’s internal session identifier |
{{ test_case_id }} | The current test case ID |
{{ test_id }} | The current test ID |
{{ inference_result_id }} | The inference result ID for this turn (also sent as the X-Galtea-Inference-Id header for trace collection) |
{{ language_code }} | ISO 639-1 language code from the test case (e.g. "es"). Empty string when the test case has no language set. |
{{ language_name }} | Full English name of the test case language (e.g. "Spanish"). Empty string when the test case has no language set. |
past_turns | Conversation history loop collection. Use with {% for turn in past_turns %}. See Conversation History. |
| Any metadata key | Fields extracted via Output Mapping and stored in session metadata (e.g., {{ tenant_id }}) |
Examples
Single Input Field
The simplest template sends a single user message to an OpenAI-compatible endpoint:Multiple Input Fields
When your test cases have several input fields, reference each one by name:Using Context Fields
Context fields provide test case-specific information alongside the input. A common use case is passing a system prompt or topic:Built-in Language Variables
Every test case stores its language. Use the built-in{{ language_code }} and {{ language_name }} variables to pass language information to your endpoint without defining language in the input schema:
Conversation History
Use{% for turn in past_turns %} to include previous conversation turns:
{{ turn.input }}- the previous user input{{ turn.output }}- the previous assistant response
When a loop is the last item in a JSON array, use
{% if not loop.last %},{% endif %} after each iteration to prevent a trailing comma. When there’s content after the loop (like the final user message above), this pattern is not required.Anthropic Claude Format
JSON Escaping
String values in the template context are automatically JSON-escaped before rendering. This means that test case inputs containing", \, or newline characters produce valid JSON bodies without any extra work on your part. You still need to provide the surrounding double quotes in your template for string fields (e.g., "{{ input.field_name }}"), since the escaping only applies to the content, not the JSON structure.
For example, if a test case input field contains:
Placeholder Toolbar
When editing an input template in the Galtea dashboard, a placeholder toolbar appears above the editor. It shows clickable pills grouped by category:| Category | Placeholders |
|---|---|
| Basic | {{ input.user_message }}, {{ context.value }} |
| History | past_turns loop, {{ turn.input }}, {{ turn.output }} |
| Session | {{ session_id }}, {{ galtea_session_id }} |
| Inference | {{ inference_result_id }} |
| Test | {{ test_case_id }}, {{ test_id }} |
| Language | {{ language_code }}, {{ language_name }} |
Missing Fields
When a template references a field that does not exist in the test case, Nunjucks renders the undefined placeholder as an empty string. This can produce invalid JSON. For example, if{{ input.customer_id }} is referenced but the test case input does not have a customer_id field:
Related
Templates & Mapping
Full reference for Input Templates, Output Mapping, custom headers, and retry configuration.
Endpoint Connection Overview
What endpoint connections are and how to create one.
Test Cases
Understand the structure of test case inputs and context.
Direct Inferences Tutorial
Run evaluations from the dashboard using your endpoint connection.