-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path_generic_aggregate_auto_evaluation.html.erb
More file actions
75 lines (68 loc) · 1.87 KB
/
_generic_aggregate_auto_evaluation.html.erb
File metadata and controls
75 lines (68 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<%
items = [
{
field: "Mean score",
value: aggregate.mean_score,
},
]
items += aggregate.runs.flat_map.with_index(1) do |run, index|
[
{ field: "Run #{index} score", value: run.score },
{ field: "Run #{index} reason", value: run.reason },
]
end
%>
<%= render "govuk_publishing_components/components/summary_list", {
title:,
heading_level: 2,
margin_bottom: 4,
heading_size: "l",
items: items,
} %>
<%= render "govuk_publishing_components/components/details", {
title: "LLM responses",
} do %>
<% aggregate.runs.each.with_index(1) do |run, index| %>
<%= render "govuk_publishing_components/components/heading", {
text: "Run #{index}",
font_size: "m",
heading_level: 2,
margin_bottom: 4,
} %>
<% run.llm_responses.each do |namespace, response| %>
<%= render "govuk_publishing_components/components/heading", {
text: namespace.capitalize,
font_size: "s",
heading_level: 3,
} %>
<p class="govuk-body">
<%= render("components/code_snippet", content: JSON.pretty_generate(response)) %>
</p>
<% end %>
<% end %>
<% end %>
<%= render "govuk_publishing_components/components/details", {
title: "Metrics",
} do %>
<% aggregate.runs.each.with_index(1) do |run, index| %>
<%= render "govuk_publishing_components/components/heading", {
text: "Run #{index}",
font_size: "m",
heading_level: 2,
} %>
<% run.metrics.sort.each do |namespace, metrics| %>
<%= render "govuk_publishing_components/components/summary_list", {
title: namespace.capitalize,
items: metrics.map do |metric, value|
{
field: metric,
value: value,
}
end,
borderless: true,
heading_size: "s",
margin_bottom: 6,
} %>
<% end %>
<% end %>
<% end %>