You will be given an input and the content to evaluate. The content may be:
- A single LLM response, optionally accompanied by separate Metadata and tool calls sections.
- A multi-turn conversation transcript, where each turn may include the following inline fields:
    - Assistant: the response text
    - Context: retrieval sources used to generate the response (e.g. RAG documents)
    - Metadata: structured data returned by the endpoint (e.g. confidence scores, citations)
    - Tool calls: functions or APIs invoked during the response

Use all available information — including context, metadata, and tool calls — when making
your evaluation. Do not ignore these fields; they are part of the system's observable behavior.

Your task is to rate the content based on the following criteria.

Please make sure you read and understand these instructions carefully.

Evaluation Criteria:
{{ evaluation_prompt }}

{% if evaluation_steps %}
Evaluation Steps:
{{ evaluation_steps }}
{% endif %}

{% if reasoning %}
Reasoning Process:
{{ reasoning }}
{% endif %}

{% if evaluation_examples %}
Examples:
{{ evaluation_examples }}
{% endif %}

Input Query:
{{ input if input|trim else "No input provided" }}

{% if context_text|trim and context_text|trim != "No context provided." %}
Context Information:
{{ context_text }}
Note: This context was retrieved and used to generate the response. Consider whether the
response faithfully and accurately draws from it.
{% endif %}

{% if metadata_text %}
Response Metadata:
{{ metadata_text }}
Note: This is structured data returned by the endpoint alongside the response (e.g. confidence
scores, citations, intent labels). Use it to inform your evaluation where relevant.
{% endif %}

{% if tool_calls_text %}
Tool Calls:
{{ tool_calls_text }}
Note: These are functions or APIs the endpoint invoked when generating the response. Consider
whether the correct tools were used with appropriate arguments.
{% endif %}

Expected Response:
{{ expected_output if expected_output|trim else "No expected response provided" }}

Content to Evaluate:
{{ output if output|trim else "No content provided" }}


Evaluation Form:
{% if score_type == "categorical" %}
Please provide a categorical evaluation and a brief explanation.

IMPORTANT: Return ONLY a valid JSON object without any markdown formatting, code blocks, or backticks. The response must be directly parseable as JSON.

The JSON object must contain:
1. A 'score' field with your categorical evaluation (as a string or number based on the evaluation criteria)
2. A 'reason' field with your brief explanation as a string

Example valid response format:
{"score": "excellent", "reason": "The response demonstrates exceptional quality in all aspects."}
{% else %}
Please provide a numerical score between {{ min_score }} and {{ max_score }} and a brief explanation.

IMPORTANT: Return ONLY a valid JSON object without any markdown formatting, code blocks, or backticks. The response must be directly parseable as JSON.

The JSON object must contain:
1. A 'score' field with your numerical evaluation (float between {{ min_score }} and {{ max_score }})
2. A 'reason' field with your brief explanation as a string

Example valid response format:
{"score": 4.5, "reason": "The response effectively addresses the query with accurate information."}
{% endif %} 
