ai_agents_test-1.0.0-alpha1/templates/ai-agents-test-result.html.twig
templates/ai-agents-test-result.html.twig
{#
/**
* @file
* Default theme implementation to present an agent test result entity.
*
* This template is used when viewing a canonical agent test result page,
*
* Available variables:
* - content: A list of content items. Use 'content' to print all content, or
* print a subset such as 'content.label'.
* - attributes: HTML attributes for the container element.
*
* @see template_preprocess_ai_agents_test_result()
*/
#}
<article{{ attributes }}>
<div class="result-left-side">
<h2>Result:</h2>
<h2 class="agent-test-{{ entity.result.value }}">{{ failure_message }}</h2>
<h3>{{ 'Goal of the Test:'|t }}</h3>
<p>{{ agent_test.description.value }}</p>
{% if error_message %}
<h3>{{ 'Error Message:'|t }}</h3>
{{ error_message }}
<h3>{{ 'Error Stack:'|t }}</h3>
{{ error_stack }}
{% else %}
<h3>{{ 'Summary of Results:'|t }}</h3>
<table>
{% for summary_result in summary_results %}
<tr>
<td>{{ summary_result.label }}</td>
<td class="agent-test-{{ summary_result.result ? 'success' : 'failure' }}">{{ summary_result.result ? 'Success' : 'Failure' }}</td>
<td>{{ summary_result.message }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
</div>
<div class="result-right-side">
<h3>{{ 'Triggering Instruction:'|t }}</h3>
<p>{{ triggering_instruction|nl2br }}</p>
<h3>{{ 'Agent Textual Output:'|t }}</h3>
<p>{{ entity.response.value }}</p>
<details class="agent-test-conversation">
<summary>{{ 'Conversation'|t }}</summary>
<section class="discussion">
{% for input in inputs %}
<div class="chat-bubble chat-{{ input.role }} first">
<strong>{{ input.role }}</strong>: {{ input.content }}
</div>
{% endfor %}
<div class="chat-bubble chat-assistant first">
<strong>assistant</strong>: {{ entity.response.value }}
</div>
</section>
</details>
<details class="agent-test-details">
<summary>{{ 'Detailed Tool Usage (in order)'|t }}</summary>
<p>{{ 'The following tools were used to generate the response.'|t }}</p>
<ol>
{% for tool in tools_used %}
<li><strong>Tool Id:</strong> {{ tool.plugin_id }}<br />
<strong>{{ 'Parameters:'|t }}</strong><br />
<ul>
{% for key, value in tool.context_values %}
<!-- Check so value is string or number -->
{% if value is iterable %}
<li><strong>{{ key }}</strong>: {{ value|json_encode|raw }}</li>
{% else %}
<li><strong>{{ key }}</strong>: {{ value }}</li>
{% endif %}
{% endfor %}
</ul>
<strong>{{ 'Result:'|t }}</strong><br />
<pre class="tool-results">{{ tool.result }}</pre>
{% endfor %}
</ol>
</details>
<details class="agent-data">
<summary>{{ 'Agent Data'|t }}</summary>
<strong>{{ 'Agent Name:'|t }}</strong> {{ agent.label }}<br />
<strong>{{ 'Version:'|t }}</strong> {{ entity.agent_version_id.value }}<br />
<strong>{{ 'Agent Instructions:'|t }}</strong><br />
{{ entity.system_prompt.value|nl2br }}
<hr />
<strong>{{ 'Tools available:'|t }}</strong><br />
<ul>
{% for key, tool in agent_configuration.tools %}
<li>{{ key }}</li>
{% endfor %}
</ul>
<hr />
</details>
<details class="agent-test-provider">
<summary>{{ 'AI Provider Data'|t }}</summary>
<strong>{{ 'Provider'|t }}</strong>: {{ entity.chat_provider.value }}<br />
<strong>{{ 'Model'|t }}</strong>: {{ entity.model.value }}<br />
<strong>{{ 'Configuration'|t }}</strong>: {{ entity.provider_configuration.value }}<br />
</details>
<details class="agent-test-data">
<summary>{{ 'Test Data'|t }}</summary>
<strong>{{ 'Test Id:'|t }}</strong> {{ agent_test.id.value }}<br />
<strong>{{ 'Test Name:'|t }}</strong> {{ agent_test.label.value }}<br />
<strong>{{ 'Test Description:'|t }}</strong> {{ agent_test.description.value }}<br />
</details>
</div>
<div style="clear:both;"></div>
<h3>{{ 'Detailed Results:'|t }}</h3>
<table class="detailed-results">
<tr>
<th>{{ 'Object'|t }}</th>
<th>{{ 'Type'|t }}</th>
<th>{{ 'Result'|t }}</th>
<th>{{ 'Expected'|t }}</th>
<th>{{ 'Actual'|t }}</th>
<th>{{ 'Details'|t }}</th>
</tr>
{% for detailed_result in detailed_results %}
<tr>
<td>{{ detailed_result.object }}</td>
<td>{{ detailed_result.type }}</td>
<td class="agent-test-{{ detailed_result.result ? 'success' : 'failure' }}">{{ detailed_result.result ? 'Success' : 'Failure' }}</td>
<td>{{ detailed_result.expected }}</td>
<td>{{ detailed_result.actual }}</td>
<td>{{ detailed_result.details }}</td>
</tr>
{% endfor %}
</table>
</article>
