Input Template
The Input Template is a Jinja2 template string that defines how Galtea formats the request body before sending it to your endpoint.Available Placeholders
| Placeholder | Description |
|---|---|
{{ input.<field> }} | The test case input (required) |
{{ context.<field> }} | The test case context |
{{ session_id }} | The external session ID (if available) |
{{ test_case_id }} | The test case ID |
{{ test_id }} | The test ID |
{{ galtea_session_id }} | The Galtea session ID |
{{ inference_result_id }} | The inference result ID for this turn (also sent automatically as the X-Galtea-Inference-Id HTTP header — useful for trace collection) |
| Any metadata key | Any field stored in session metadata (e.g., {{ sessionId }}, {{ tenant }}, {{ conversation_token }}) |
Conversation History
Use{% for turn in past_turns %}...{% endfor %} to loop through previous conversation turns. Each turn exposes:
{{ turn.input }}— Previous user input{{ turn.output }}— Previous assistant response
Examples
OpenAI-compatible format: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 in the OpenAI example above), trailing commas are valid and this pattern is not required.Output Mapping
A JSON object defining how to extract values from the API response using JSONPath expressions.Special Keys
| Key | Behavior |
|---|---|
output | Required. The AI’s response content. |
session_id | Stored as the external session identifier, accessible via custom_id. |
retrieval_context | Stored as retrieval context for RAG evaluations. |
traces | Extracts an array of trace objects and stores them linked to the inference result. Each object should contain at least a name field and can include any of the Trace properties: type, description, inputData, outputData, error, latencyMs, metadata, startTime, endTime. |
| Any other key | Stored in session metadata and available as {{ key }} in templates. |
JSONPath Syntax Reference
| Expression | Description |
|---|---|
$ | Root object |
. | Child operator |
[] | Array index or child operator |
[*] | Wildcard (all elements) |
[0] | First array element |
[-1] | Last array element |
Example
State Management
If your API returns values that need to be sent in subsequent requests (e.g.,session_id, tenant_id), Galtea can automatically manage this state:
- Extract — Use Output Mapping to pull values from the API response using JSONPath expressions
- Store — Extracted values are saved in the session and become available as template variables
- Reuse — Reference any stored value in the Input Template or URL using
{{ variable_name }}syntax
session_id and tenant_id from responses:
Custom Headers
Custom headers are sent with every request to your endpoint. Header values support placeholder substitution for injecting authentication credentials, so you can place tokens in any header — not just the standardAuthorization or X-API-Key headers.
Available Placeholders
| Placeholder | Resolves to | Available when auth type is |
|---|---|---|
{{ auth_token }} | The authentication token | BEARER or API_KEY |
{{ api_key }} | The authentication token | BEARER or API_KEY (alias for {{ auth_token }}) |
{{ bearer_token }} | The authentication token | BEARER or API_KEY (alias for {{ auth_token }}) |
{{ username }} | The Basic auth username | BASIC |
{{ password }} | The Basic auth password | BASIC |
{{ placeholder }} and { placeholder } syntax.
Example
W3C Trace Context Propagation
When W3C trace context propagation is enabled, Galtea adds atraceparent header to every request following the W3C Trace Context specification. This allows your endpoint to correlate requests with Galtea’s traces without any code changes. You can add a traceparent key in your custom headers as a placeholder — Galtea will replace its value with the correct trace context at request time.
Retry Configuration
Configure automatic retry behavior for failed requests. When enabled, Galtea will automatically retry requests that fail with specific HTTP status codes.Whether automatic retry is enabled. Default:
falseMaximum number of retry attempts. Default:
3Initial delay in milliseconds before the first retry. Default:
2000 (2 seconds)Strategy for increasing delay between retry attempts:
exponential- Delay doubles with each attempt (recommended)linear- Delay increases linearlyfixed- Constant delay between attempts
exponentialMaximum delay cap in milliseconds. Default:
30000 (30 seconds)HTTP status codes that should trigger a retry. Default:
[429, 500, 502, 503, 504]Related
Endpoint Connection Overview
What endpoint connections are and how to create one.
Direct Inferences Tutorial
Run evaluations from the dashboard using your endpoint connection.