completion-kit 0.28.46 → 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +48 -3
- data/app/assets/javascripts/completion_kit/application.js +435 -23
- data/app/assets/stylesheets/completion_kit/application.css +44 -14
- data/app/controllers/completion_kit/api/v1/metric_versions_controller.rb +2 -0
- data/app/controllers/completion_kit/api/v1/metrics_controller.rb +1 -1
- data/app/controllers/completion_kit/api/v1/runs_controller.rb +4 -1
- data/app/controllers/completion_kit/mcp_controller.rb +4 -0
- data/app/controllers/completion_kit/metrics_controller.rb +48 -46
- data/app/controllers/completion_kit/runs_controller.rb +4 -1
- data/app/helpers/completion_kit/application_helper.rb +99 -45
- data/app/jobs/completion_kit/check_review_job.rb +27 -6
- data/app/models/completion_kit/dataset.rb +53 -4
- data/app/models/completion_kit/metric.rb +103 -28
- data/app/models/completion_kit/metric_version.rb +16 -1
- data/app/models/completion_kit/prompt.rb +8 -0
- data/app/models/completion_kit/review.rb +2 -0
- data/app/models/completion_kit/run.rb +20 -9
- data/app/services/completion_kit/api_config.rb +2 -1
- data/app/services/completion_kit/checks/contains.rb +2 -8
- data/app/services/completion_kit/checks/equals.rb +2 -7
- data/app/services/completion_kit/checks/expected_resolver.rb +17 -3
- data/app/services/completion_kit/checks/flag.rb +13 -0
- data/app/services/completion_kit/checks/json_path_equals.rb +2 -15
- data/app/services/completion_kit/checks/labels.rb +104 -0
- data/app/services/completion_kit/checks/length_bounds.rb +4 -4
- data/app/services/completion_kit/checks/list_overlap.rb +96 -0
- data/app/services/completion_kit/checks/not_contains.rb +2 -8
- data/app/services/completion_kit/checks/numeric_bounds.rb +22 -0
- data/app/services/completion_kit/checks/numeric_equals.rb +37 -0
- data/app/services/completion_kit/checks/numeric_value.rb +45 -0
- data/app/services/completion_kit/checks/regex.rb +14 -4
- data/app/services/completion_kit/checks/registry.rb +107 -4
- data/app/services/completion_kit/checks/result.rb +5 -1
- data/app/services/completion_kit/checks/target_resolver.rb +43 -8
- data/app/services/completion_kit/checks/textual.rb +19 -0
- data/app/services/completion_kit/csv_processor.rb +14 -2
- data/app/services/completion_kit/mcp_tools/metrics.rb +21 -7
- data/app/services/completion_kit/model_discovery_service.rb +2 -1
- data/app/services/completion_kit/ollama_client.rb +19 -2
- data/app/services/completion_kit/promptfoo_importer.rb +4 -4
- data/app/services/completion_kit/provider_endpoint.rb +10 -0
- data/app/services/completion_kit/run_comparison.rb +6 -0
- data/app/views/completion_kit/api_reference/_authentication.html.erb +2 -2
- data/app/views/completion_kit/api_reference/_body.html.erb +7 -30
- data/app/views/completion_kit/api_reference/_example.html.erb +1 -1
- data/app/views/completion_kit/api_reference/_resource_card.html.erb +1 -1
- data/app/views/completion_kit/datasets/_form.html.erb +0 -28
- data/app/views/completion_kit/datasets/index.html.erb +1 -1
- data/app/views/completion_kit/metric_groups/_form.html.erb +1 -20
- data/app/views/completion_kit/metric_groups/index.html.erb +1 -1
- data/app/views/completion_kit/metrics/_check_spec.html.erb +5 -11
- data/app/views/completion_kit/metrics/_form.html.erb +62 -47
- data/app/views/completion_kit/metrics/_starter_card.html.erb +1 -1
- data/app/views/completion_kit/metrics/index.html.erb +2 -2
- data/app/views/completion_kit/metrics/show.html.erb +4 -14
- data/app/views/completion_kit/prompts/_form.html.erb +1 -1
- data/app/views/completion_kit/prompts/index.html.erb +3 -3
- data/app/views/completion_kit/prompts/show.html.erb +8 -8
- data/app/views/completion_kit/provider_credentials/_models_card.html.erb +2 -2
- data/app/views/completion_kit/responses/show.html.erb +1 -1
- data/app/views/completion_kit/runs/_compare_score.html.erb +1 -1
- data/app/views/completion_kit/runs/_form.html.erb +4 -174
- data/app/views/completion_kit/runs/_response_row.html.erb +5 -5
- data/app/views/completion_kit/runs/_row.html.erb +13 -11
- data/app/views/completion_kit/runs/_run_config.html.erb +2 -2
- data/app/views/completion_kit/runs/_status_panel.html.erb +2 -2
- data/app/views/completion_kit/runs/compare.html.erb +10 -6
- data/app/views/completion_kit/runs/show.html.erb +5 -19
- data/app/views/completion_kit/shared/_branded_select.html.erb +1 -1
- data/app/views/completion_kit/tags/index.html.erb +1 -1
- data/app/views/layouts/completion_kit/application.html.erb +2 -2
- data/config/locales/en.yml +2 -0
- data/db/migrate/20260903000001_add_check_score_to_completion_kit_reviews.rb +5 -0
- data/lib/completion_kit/version.rb +1 -1
- data/lib/completion_kit.rb +14 -0
- data/lib/generators/completion_kit/templates/initializer.rb +18 -0
- metadata +9 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<% if token.present? %>
|
|
2
2
|
<% masked = ck_masked_token(token) %>
|
|
3
3
|
<div style="display: flex; align-items: center; gap: 0.4rem; margin: 0.5rem 0;">
|
|
4
|
-
<button type="button" class="ck-chip ck-token-toggle"
|
|
5
|
-
<button type="button" class="ck-icon-btn" title="Copy token" aria-label="Copy API token"
|
|
4
|
+
<button type="button" class="ck-chip ck-token-toggle" data-ck-token-toggle data-masked="<%= masked %>" data-real="<%= token %>" aria-label="Reveal API token" aria-pressed="false" style="cursor: pointer;"><%= masked %></button>
|
|
5
|
+
<button type="button" class="ck-icon-btn" title="Copy token" aria-label="Copy API token" data-ck-copy-text="<%= token %>" data-ck-copy-feedback>
|
|
6
6
|
<%= heroicon_tag "clipboard-document", variant: :outline, size: 14, "aria-hidden": "true" %>
|
|
7
7
|
</button>
|
|
8
8
|
</div>
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
<div class="ck-api-endpoint">
|
|
136
136
|
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> /api/v1/runs/:id</p>
|
|
137
137
|
<p class="ck-meta-copy">Get a run with status, progress, response count, and average score.</p>
|
|
138
|
-
<p class="ck-api-params"><strong>Also returns:</strong> <code>metric_averages</code>, a per-metric breakdown with each metric's average score (<code>pass_rate</code> for checks), the number of rows it graded, and <code>low_count</code>, how many scored below the medium quality threshold</p>
|
|
138
|
+
<p class="ck-api-params"><strong>Also returns:</strong> <code>metric_averages</code>, a per-metric breakdown with each metric's average score (<code>pass_rate</code> for checks, plus <code>avg_check_score</code> for a <code>list_overlap</code> check, the average fraction from 0 to 1), the number of rows it graded, and <code>low_count</code>, how many scored below the medium quality threshold</p>
|
|
139
139
|
<%= render "completion_kit/api_reference/example", base_url: base_url, token: token, real_token: real_token, cmd: "curl #{base_url}/api/v1/runs/1 \\\n -H \"Authorization: Bearer #{token}\"" %>
|
|
140
140
|
</div>
|
|
141
141
|
<%= render "completion_kit/api_reference/resource_list", title: "Your recent runs",
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
</div>
|
|
167
167
|
<div class="ck-api-endpoint">
|
|
168
168
|
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">GET</span> /api/v1/runs/:id/compare?with=:other_id</p>
|
|
169
|
-
<p class="ck-meta-copy">Side-by-side comparison against another run. Returns <code>{left_run_id, right_run_id, metric_ids: [...], rows: [...]}</code> with one row per input case, per-metric scores on both sides, and the delta. Rows are keyed by the left run's input cases: a case present only in the left run is returned with the right side nulled out, and a case present only in the right run is omitted.</p>
|
|
169
|
+
<p class="ck-meta-copy">Side-by-side comparison against another run. Returns <code>{left_run_id, right_run_id, metric_ids: [...], rows: [...]}</code> with one row per input case, per-metric scores on both sides, and the delta. A check reports <code>left_passed</code>, <code>right_passed</code> and <code>result_change</code>, and a <code>list_overlap</code> check also reports <code>left_check_score</code>, <code>right_check_score</code> and <code>check_score_delta</code>, so a fraction that moved shows even when the verdict did not. Rows are keyed by the left run's input cases: a case present only in the left run is returned with the right side nulled out, and a case present only in the right run is omitted.</p>
|
|
170
170
|
<%= render "completion_kit/api_reference/example", base_url: base_url, token: token, real_token: real_token, cmd: "curl \"#{base_url}/api/v1/runs/1/compare?with=2\" \\\n -H \"Authorization: Bearer #{token}\"" %>
|
|
171
171
|
</div>
|
|
172
172
|
<div class="ck-api-endpoint">
|
|
@@ -237,8 +237,12 @@
|
|
|
237
237
|
</div>
|
|
238
238
|
<div class="ck-api-endpoint">
|
|
239
239
|
<p class="ck-api-method"><span class="ck-chip ck-chip--soft">POST</span> /api/v1/metrics</p>
|
|
240
|
-
<p class="ck-meta-copy">Create a metric. Defaults to an LLM judge; pass <code>metric_type</code> <code>check</code> with a <code>check_config</code> for a deterministic
|
|
240
|
+
<p class="ck-meta-copy">Create a metric. Defaults to an LLM judge; pass <code>metric_type</code> <code>check</code> with a <code>check_config</code> for a deterministic check that runs with no model and no cost.</p>
|
|
241
241
|
<p class="ck-api-params"><strong>Required:</strong> <code>name</code> <strong>Optional:</strong> <code>metric_type</code> (llm_judge default, or check), <code>instruction</code> and <code>rubric_bands</code> (array of {stars, description}) for judges, <code>check_config</code> (<code>check_kind</code>, <code>target</code>, plus per-kind keys) for checks</p>
|
|
242
|
+
<p class="ck-api-params"><strong>Check kinds:</strong> <code>contains</code>, <code>not_contains</code>, <code>equals</code> (<code>value</code>); <code>regex</code> (<code>pattern</code>); <code>valid_json</code>; <code>json_path_equals</code> (<code>json_path</code>, <code>expected</code>); <code>length_bounds</code> and <code>numeric_bounds</code> (<code>min</code> and/or <code>max</code>); <code>list_overlap</code> (<code>value</code>, <code>score_by</code>, <code>min</code>); <code>numeric_equals</code> (<code>value</code>, <code>tolerance</code>)</p>
|
|
243
|
+
<p class="ck-api-params"><strong>Case:</strong> A check with no <code>case_sensitive</code> matches case-insensitively, <code>regex</code> and <code>list_overlap</code> included. Send <code>"case_sensitive": true</code> to match case exactly. Before 0.29.0 a <code>regex</code> check read a missing <code>case_sensitive</code> as case-sensitive.</p>
|
|
244
|
+
<p class="ck-api-params"><strong>Grading against the answer key:</strong> set <code>compare_to</code> to <code>expected</code> on <code>contains</code>, <code>not_contains</code>, <code>equals</code>, <code>json_path_equals</code>, <code>list_overlap</code> or <code>numeric_equals</code> to grade each row against its own <code>expected_output</code> rather than a constant. Drop <code>value</code> (or <code>expected</code>, on <code>json_path_equals</code>) and add <code>expected_path</code> to name the field to read out of a JSON answer key. A <code>target_path</code>, an <code>expected_path</code> and a <code>json_path</code> all walk array indices, as in <code>items.0.name</code>, and may start at the root with <code>$.</code>, as in <code>$.items.0.name</code>. A <code>target_path</code> sent with no <code>target</code> sets <code>target</code> to <code>json_path</code>, and one sent with any other <code>target</code> is refused.</p>
|
|
245
|
+
<p class="ck-api-params"><strong>Scores, not just verdicts:</strong> <code>list_overlap</code> grades a list-valued field and stores a fraction on the review as <code>check_score</code>, with <code>score_by</code> one of recall, precision, f1 or jaccard. Its <code>min</code> is the fraction that counts as a pass. <code>numeric_equals</code> takes a <code>tolerance</code> that is a plain number for a fixed amount, or a percentage string such as <code>"2%"</code> for a share of the expected value. Each run averages it per metric as <code>avg_check_score</code> inside <code>metric_averages</code>, so a partial answer has run history and can gate a regression.</p>
|
|
242
246
|
<%= render "completion_kit/api_reference/example", base_url: base_url, token: token, real_token: real_token, cmd: "curl -X POST #{base_url}/api/v1/metrics \\\n -H \"Authorization: Bearer #{token}\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"name\": \"relevance\", \"instruction\": \"Is the response relevant?\"}'" %>
|
|
243
247
|
</div>
|
|
244
248
|
<div class="ck-api-endpoint">
|
|
@@ -419,30 +423,3 @@
|
|
|
419
423
|
|
|
420
424
|
</div>
|
|
421
425
|
</div>
|
|
422
|
-
|
|
423
|
-
<script>
|
|
424
|
-
function ckToggleToken(el) {
|
|
425
|
-
var showing = el.textContent === el.dataset.masked;
|
|
426
|
-
el.textContent = showing ? el.dataset.real : el.dataset.masked;
|
|
427
|
-
el.setAttribute('aria-pressed', showing ? 'true' : 'false');
|
|
428
|
-
el.setAttribute('aria-label', showing ? 'Hide API token' : 'Reveal API token');
|
|
429
|
-
navigator.clipboard.writeText(el.dataset.real).then(function() {
|
|
430
|
-
el.classList.add('ck-api-copy--done');
|
|
431
|
-
setTimeout(function() { el.classList.remove('ck-api-copy--done'); }, 1500);
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
function ckCopyExample(btn) {
|
|
436
|
-
var pre = btn.closest('.ck-api-example').querySelector('pre');
|
|
437
|
-
var text = pre.textContent;
|
|
438
|
-
var realToken = btn.dataset.realToken;
|
|
439
|
-
var displayToken = btn.dataset.displayToken;
|
|
440
|
-
if (realToken && displayToken) {
|
|
441
|
-
text = text.split(displayToken).join(realToken);
|
|
442
|
-
}
|
|
443
|
-
navigator.clipboard.writeText(text).then(function() {
|
|
444
|
-
btn.classList.add('ck-api-copy--done');
|
|
445
|
-
setTimeout(function() { btn.classList.remove('ck-api-copy--done'); }, 1500);
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
</script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div class="ck-api-example">
|
|
2
2
|
<pre class="ck-code ck-code--dark"><%= cmd %></pre>
|
|
3
|
-
<button type="button" class="ck-api-copy" aria-label="Copy example to clipboard"
|
|
3
|
+
<button type="button" class="ck-api-copy" aria-label="Copy example to clipboard" data-ck-copy-example data-real-token="<%= real_token %>" data-display-token="<%= token %>">
|
|
4
4
|
<%= heroicon_tag "clipboard-document", variant: :outline, size: 14, "aria-hidden": "true" %>
|
|
5
5
|
</button>
|
|
6
6
|
</div>
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
</div>
|
|
20
20
|
<div class="ck-api-prompt-card__url">
|
|
21
21
|
<code class="ck-endpoint__url" id="<%= dom_id %>"><%= url %></code>
|
|
22
|
-
<button type="button" class="ck-icon-btn" title="Copy endpoint" aria-label="Copy endpoint URL"
|
|
22
|
+
<button type="button" class="ck-icon-btn" title="Copy endpoint" aria-label="Copy endpoint URL" data-ck-copy="<%= dom_id %>"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="14" height="14" aria-hidden="true"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"/><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"/></svg></button>
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
@@ -46,34 +46,6 @@
|
|
|
46
46
|
<%= form.submit(dataset.persisted? ? "Save dataset" : "Create dataset", class: ck_button_classes(:dark)) %>
|
|
47
47
|
</div>
|
|
48
48
|
</div>
|
|
49
|
-
|
|
50
|
-
<script>
|
|
51
|
-
function ckDatasetHeaderPreview() {
|
|
52
|
-
var area = document.getElementById('dataset_csv_data');
|
|
53
|
-
var box = document.getElementById('dataset-header-preview');
|
|
54
|
-
var chips = document.getElementById('dataset-header-chips');
|
|
55
|
-
if (!area || !box || !chips) return;
|
|
56
|
-
var recognized = { expected_output: 'answer key', actual_output: 'pre-made output' };
|
|
57
|
-
var firstLine = (area.value.split(/\r?\n/).find(function(l) { return l.trim() !== ''; }) || '');
|
|
58
|
-
var headers = firstLine.split(',').map(function(h) { return h.trim().replace(/^"|"$/g, ''); }).filter(Boolean);
|
|
59
|
-
if (headers.length === 0) { box.hidden = true; chips.textContent = ''; return; }
|
|
60
|
-
box.hidden = false;
|
|
61
|
-
chips.textContent = '';
|
|
62
|
-
headers.forEach(function(h) {
|
|
63
|
-
var role = recognized[h];
|
|
64
|
-
var chip = document.createElement('span');
|
|
65
|
-
chip.className = 'ck-header-chip' + (role ? ' ck-header-chip--special' : '');
|
|
66
|
-
chip.textContent = role ? h + ' · ' + role : h;
|
|
67
|
-
chips.appendChild(chip);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
document.addEventListener('turbo:load', ckDatasetHeaderPreview);
|
|
71
|
-
(function() {
|
|
72
|
-
var area = document.getElementById('dataset_csv_data');
|
|
73
|
-
if (area) area.addEventListener('input', ckDatasetHeaderPreview);
|
|
74
|
-
})();
|
|
75
|
-
ckDatasetHeaderPreview();
|
|
76
|
-
</script>
|
|
77
49
|
<% end %>
|
|
78
50
|
|
|
79
51
|
<% if dataset.persisted? %>
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
</thead>
|
|
28
28
|
<tbody>
|
|
29
29
|
<% @datasets.each do |dataset| %>
|
|
30
|
-
<tr
|
|
30
|
+
<tr data-ck-href="<%= dataset_path(dataset) %>" style="cursor: pointer;">
|
|
31
31
|
<td>
|
|
32
32
|
<%= link_to dataset_path(dataset), class: "ck-record-name" do %><strong><%= dataset.name %></strong><% end %>
|
|
33
33
|
<% if dataset.tags.any? %>
|
|
@@ -47,8 +47,7 @@
|
|
|
47
47
|
<button type="button"
|
|
48
48
|
class="tag-mark tag-mark--off ck-metric-tag-filter__chip"
|
|
49
49
|
style="--mark-color: var(--tag-<%= tag.color %>);"
|
|
50
|
-
data-filter-tag="<%= tag.name %>"
|
|
51
|
-
onclick="ckToggleMetricGroupFilter(this)"><%= tag.name %></button>
|
|
50
|
+
data-filter-tag="<%= tag.name %>"><%= tag.name %></button>
|
|
52
51
|
<% end %>
|
|
53
52
|
</div>
|
|
54
53
|
<% end %>
|
|
@@ -78,24 +77,6 @@
|
|
|
78
77
|
<%= hidden_field_tag "metric_group[metric_ids][]", "" %>
|
|
79
78
|
</div>
|
|
80
79
|
|
|
81
|
-
<script>
|
|
82
|
-
function ckToggleMetricGroupFilter(btn) {
|
|
83
|
-
btn.classList.toggle("tag-mark--off");
|
|
84
|
-
var bar = btn.closest("[data-metric-tag-filter]");
|
|
85
|
-
var grid = bar && bar.parentElement.querySelector("[data-metric-checkboxes]");
|
|
86
|
-
if (!grid) return;
|
|
87
|
-
var active = Array.prototype.map.call(
|
|
88
|
-
bar.querySelectorAll(".ck-metric-tag-filter__chip:not(.tag-mark--off)"),
|
|
89
|
-
function(b) { return b.getAttribute("data-filter-tag"); }
|
|
90
|
-
);
|
|
91
|
-
grid.querySelectorAll(".ck-checkbox-label").forEach(function(lbl) {
|
|
92
|
-
var tags = (lbl.getAttribute("data-metric-tags") || "").split(",").filter(Boolean);
|
|
93
|
-
var visible = active.length === 0 || tags.some(function(t) { return active.indexOf(t) !== -1; });
|
|
94
|
-
lbl.style.display = visible ? "" : "none";
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
</script>
|
|
98
|
-
|
|
99
80
|
<div class="ck-actions">
|
|
100
81
|
<% if metric_group.persisted? %>
|
|
101
82
|
<%= ck_delete_trigger(form_id: metric_group_delete_id, label: "Delete metric group", confirm: metric_group_delete_confirm) %>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
</thead>
|
|
32
32
|
<tbody>
|
|
33
33
|
<% @metric_groups.each do |metric_group| %>
|
|
34
|
-
<tr
|
|
34
|
+
<tr data-ck-href="<%= metric_group_path(metric_group) %>" style="cursor: pointer;">
|
|
35
35
|
<td>
|
|
36
36
|
<%= link_to metric_group_path(metric_group), class: "ck-record-name" do %><strong><%= metric_group.name %></strong><% end %>
|
|
37
37
|
<% if metric_group.tags.any? %>
|
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
<% config = local_assigns.fetch(:config) %>
|
|
2
2
|
<dl class="ck-check-spec">
|
|
3
3
|
<div class="ck-check-spec__row">
|
|
4
|
-
<dt class="ck-check-spec__term"
|
|
4
|
+
<dt class="ck-check-spec__term"><%= ck_check_field_label("check_kind") %></dt>
|
|
5
5
|
<dd class="ck-check-spec__val"><%= ck_check_kind_label(config["check_kind"]) %></dd>
|
|
6
6
|
</div>
|
|
7
7
|
<div class="ck-check-spec__row">
|
|
8
|
-
<dt class="ck-check-spec__term"
|
|
8
|
+
<dt class="ck-check-spec__term"><%= ck_check_field_label("target") %></dt>
|
|
9
9
|
<dd class="ck-check-spec__val"><%= ck_check_target_label(config["target"]) %></dd>
|
|
10
10
|
</div>
|
|
11
|
-
<% config
|
|
11
|
+
<% ck_check_spec_fields(config).each do |key, value| %>
|
|
12
12
|
<div class="ck-check-spec__row">
|
|
13
|
-
<dt class="ck-check-spec__term"><%= ck_check_field_label(key) %></dt>
|
|
14
|
-
<dd class="ck-check-spec__val">
|
|
15
|
-
<% if key == "compare_to" %>
|
|
16
|
-
<%= ck_check_field_value(key, value) %>
|
|
17
|
-
<% else %>
|
|
18
|
-
<code class="ck-check-spec__code"><%= value %></code>
|
|
19
|
-
<% end %>
|
|
20
|
-
</dd>
|
|
13
|
+
<dt class="ck-check-spec__term"><%= ck_check_field_label(key, config["check_kind"]) %></dt>
|
|
14
|
+
<dd class="ck-check-spec__val"><%= ck_check_spec_value(key, value) %></dd>
|
|
21
15
|
</div>
|
|
22
16
|
<% end %>
|
|
23
17
|
</dl>
|
|
@@ -17,10 +17,11 @@
|
|
|
17
17
|
<% pub = local_assigns[:published_metric_version] %>
|
|
18
18
|
<% draft_instr_changed = pub && pub.instruction.to_s != edit_draft.instruction.to_s %>
|
|
19
19
|
<% draft_rubric_changed = pub && pub.rubric_bands != edit_draft.rubric_bands %>
|
|
20
|
+
<% draft_subject = edit_draft.check? ? "check" : [("instruction" if draft_instr_changed), ("rubric" if draft_rubric_changed)].compact.join(" and ").presence || "version" %>
|
|
20
21
|
<div class="ck-suggestion-banner" role="status">
|
|
21
22
|
<div class="ck-suggestion-banner__body">
|
|
22
23
|
<p class="ck-kicker">Draft pending</p>
|
|
23
|
-
<p class="ck-meta-copy">The form below shows your unpublished draft. Publish to replace the live<%=
|
|
24
|
+
<p class="ck-meta-copy">The form below shows your unpublished draft. Publish to replace the live <%= draft_subject %> for future runs, or keep editing.</p>
|
|
24
25
|
</div>
|
|
25
26
|
<div class="ck-suggestion-banner__actions">
|
|
26
27
|
<%= button_to "Discard draft", dismiss_suggestion_metric_path(metric, draft_id: edit_draft.id, back_to: "edit"),
|
|
@@ -164,99 +165,113 @@
|
|
|
164
165
|
|
|
165
166
|
<% if show_check %>
|
|
166
167
|
<% check = metric.check_config || {} %>
|
|
167
|
-
|
|
168
|
+
<% kind = check["check_kind"] || CompletionKit::Checks::Registry.kinds.first %>
|
|
169
|
+
<div class="ck-field ck-field--spacious" data-ck-metric-editor="check" data-ck-check-form="<%= ck_check_form_data.to_json %>" <%= "hidden" unless metric.check? %>>
|
|
168
170
|
<p class="ck-section-title">Check</p>
|
|
169
171
|
<p class="ck-hint">A pass or fail rule with no AI and no cost. You only fill in the fields the chosen rule needs.</p>
|
|
170
172
|
|
|
171
173
|
<div class="ck-field">
|
|
172
|
-
<p class="ck-label" id="metric_check_kind_label"
|
|
174
|
+
<p class="ck-label" id="metric_check_kind_label"><%= ck_check_field_label("check_kind") %></p>
|
|
173
175
|
<%= render "completion_kit/shared/branded_select",
|
|
174
176
|
name: "metric[check_config][check_kind]",
|
|
175
|
-
options: CompletionKit::Checks::Registry.kinds.map { |
|
|
176
|
-
selected:
|
|
177
|
-
labelledby: "metric_check_kind_label"
|
|
177
|
+
options: CompletionKit::Checks::Registry.kinds.map { |option| [option, ck_check_kind_label(option)] },
|
|
178
|
+
selected: kind,
|
|
179
|
+
labelledby: "metric_check_kind_label",
|
|
180
|
+
invalid: ck_check_field_invalid?(metric, "check_kind") %>
|
|
178
181
|
</div>
|
|
179
182
|
|
|
180
183
|
<div class="ck-field">
|
|
181
|
-
<p class="ck-label" id="metric_check_target_label"
|
|
184
|
+
<p class="ck-label" id="metric_check_target_label"><%= ck_check_field_label("target") %></p>
|
|
182
185
|
<%= render "completion_kit/shared/branded_select",
|
|
183
186
|
name: "metric[check_config][target]",
|
|
184
187
|
options: CompletionKit::Checks::TargetResolver::TARGETS.map { |target| [target, ck_check_target_label(target)] },
|
|
185
188
|
selected: check["target"] || CompletionKit::Checks::TargetResolver::TARGETS.first,
|
|
186
|
-
labelledby: "metric_check_target_label"
|
|
189
|
+
labelledby: "metric_check_target_label",
|
|
190
|
+
invalid: ck_check_field_invalid?(metric, "target") %>
|
|
187
191
|
</div>
|
|
188
192
|
|
|
189
193
|
<div class="ck-field" data-ck-check-field="target_path">
|
|
190
|
-
<label class="ck-label" for="metric_check_target_path"
|
|
191
|
-
<p class="ck-hint">Where to look inside the response, like data.items.0.name.</p>
|
|
192
|
-
<input type="text" name="metric[check_config][target_path]" id="metric_check_target_path" class="ck-input" value="<%= check["target_path"] %>"
|
|
194
|
+
<label class="ck-label" for="metric_check_target_path"><%= ck_check_field_label("target_path") %></label>
|
|
195
|
+
<p class="ck-hint">Where to look inside the response, like data.items.0.name. Use a number to pick an item out of a list.</p>
|
|
196
|
+
<input type="text" name="metric[check_config][target_path]" id="metric_check_target_path" class="ck-input" value="<%= check["target_path"] %>" <%= tag.attributes(ck_check_field_aria(metric, "target_path")) %>>
|
|
193
197
|
</div>
|
|
194
198
|
|
|
195
199
|
<div class="ck-field" data-ck-check-field="compare_to">
|
|
196
|
-
<p class="ck-label"
|
|
200
|
+
<p class="ck-label"><%= ck_check_field_label("compare_to") %></p>
|
|
197
201
|
<p class="ck-hint">Check every output against one fixed value, or against each row's own expected value (its answer key).</p>
|
|
198
202
|
<label class="ck-radio">
|
|
199
|
-
<input type="radio" name="metric[check_config][compare_to]" value="constant" <%= "checked" unless check["compare_to"] == "expected" %>>
|
|
200
|
-
<span
|
|
203
|
+
<input type="radio" name="metric[check_config][compare_to]" value="constant" <%= "checked" unless check["compare_to"] == "expected" %> <%= tag.attributes(ck_check_field_aria(metric, "compare_to")) %>>
|
|
204
|
+
<span><%= ck_check_field_value("compare_to", "constant") %></span>
|
|
201
205
|
</label>
|
|
202
206
|
<label class="ck-radio">
|
|
203
|
-
<input type="radio" name="metric[check_config][compare_to]" value="expected" <%= "checked" if check["compare_to"] == "expected" %>>
|
|
204
|
-
<span
|
|
207
|
+
<input type="radio" name="metric[check_config][compare_to]" value="expected" <%= "checked" if check["compare_to"] == "expected" %> <%= tag.attributes(ck_check_field_aria(metric, "compare_to")) %>>
|
|
208
|
+
<span><%= ck_check_field_value("compare_to", "expected") %></span>
|
|
205
209
|
</label>
|
|
206
210
|
</div>
|
|
207
211
|
|
|
208
212
|
<div class="ck-field" data-ck-check-field="value">
|
|
209
|
-
<label class="ck-label" for="metric_check_value"
|
|
210
|
-
<input type="text" name="metric[check_config][value]" id="metric_check_value" class="ck-input" value="<%= check["value"] %>"
|
|
213
|
+
<label class="ck-label" for="metric_check_value"><span data-ck-check-label="value"><%= ck_check_field_label("value", kind) %></span></label>
|
|
214
|
+
<input type="text" name="metric[check_config][value]" id="metric_check_value" class="ck-input" value="<%= ck_check_input_value(check["value"]) %>" <%= tag.attributes(ck_check_field_aria(metric, "value")) %>>
|
|
211
215
|
</div>
|
|
212
216
|
|
|
213
217
|
<div class="ck-field" data-ck-check-field="pattern">
|
|
214
|
-
<label class="ck-label" for="metric_check_pattern"
|
|
218
|
+
<label class="ck-label" for="metric_check_pattern"><%= ck_check_field_label("pattern") %></label>
|
|
215
219
|
<p class="ck-hint">A regular expression to match against.</p>
|
|
216
|
-
<input type="text" name="metric[check_config][pattern]" id="metric_check_pattern" class="ck-input" value="<%= check["pattern"] %>"
|
|
220
|
+
<input type="text" name="metric[check_config][pattern]" id="metric_check_pattern" class="ck-input" value="<%= check["pattern"] %>" <%= tag.attributes(ck_check_field_aria(metric, "pattern")) %>>
|
|
217
221
|
</div>
|
|
218
222
|
|
|
219
223
|
<div class="ck-field" data-ck-check-field="json_path">
|
|
220
|
-
<label class="ck-label" for="metric_check_json_path"
|
|
224
|
+
<label class="ck-label" for="metric_check_json_path"><%= ck_check_field_label("json_path") %></label>
|
|
221
225
|
<p class="ck-hint">The path to the value inside the response, like data.status.</p>
|
|
222
|
-
<input type="text" name="metric[check_config][json_path]" id="metric_check_json_path" class="ck-input" value="<%= check["json_path"] %>"
|
|
226
|
+
<input type="text" name="metric[check_config][json_path]" id="metric_check_json_path" class="ck-input" value="<%= check["json_path"] %>" <%= tag.attributes(ck_check_field_aria(metric, "json_path")) %>>
|
|
223
227
|
</div>
|
|
224
228
|
|
|
225
229
|
<div class="ck-field" data-ck-check-field="expected">
|
|
226
|
-
<label class="ck-label" for="metric_check_expected"
|
|
227
|
-
<p class="ck-hint">The value it should equal.</p>
|
|
228
|
-
<input type="text" name="metric[check_config][expected]" id="metric_check_expected" class="ck-input" value="<%= check["expected"] %>"
|
|
230
|
+
<label class="ck-label" for="metric_check_expected"><%= ck_check_field_label("expected") %></label>
|
|
231
|
+
<p class="ck-hint">The value it should equal. A number, true or false matches that JSON value. Put it in quotes, like "200", to match it as text.</p>
|
|
232
|
+
<input type="text" name="metric[check_config][expected]" id="metric_check_expected" class="ck-input" value="<%= ck_check_expected_input_value(check["expected"]) %>" <%= tag.attributes(ck_check_field_aria(metric, "expected")) %>>
|
|
229
233
|
</div>
|
|
230
234
|
|
|
231
235
|
<div class="ck-field" data-ck-check-field="expected_path">
|
|
232
|
-
<label class="ck-label" for="metric_check_expected_path"
|
|
236
|
+
<label class="ck-label" for="metric_check_expected_path"><%= ck_check_field_label("expected_path") %></label>
|
|
233
237
|
<p class="ck-hint">Optional. If the expected value is JSON, name the field to read from it, like data.answer. Leave blank to compare against the whole value.</p>
|
|
234
|
-
<input type="text" name="metric[check_config][expected_path]" id="metric_check_expected_path" class="ck-input" value="<%= check["expected_path"] %>"
|
|
238
|
+
<input type="text" name="metric[check_config][expected_path]" id="metric_check_expected_path" class="ck-input" value="<%= check["expected_path"] %>" <%= tag.attributes(ck_check_field_aria(metric, "expected_path")) %>>
|
|
239
|
+
</div>
|
|
240
|
+
|
|
241
|
+
<div class="ck-field" data-ck-check-field="score_by">
|
|
242
|
+
<p class="ck-label" id="metric_check_score_by_label"><%= ck_check_field_label("score_by") %></p>
|
|
243
|
+
<p class="ck-hint"><%= ck_check_field_hint("score_by") %></p>
|
|
244
|
+
<%= render "completion_kit/shared/branded_select",
|
|
245
|
+
name: "metric[check_config][score_by]",
|
|
246
|
+
options: ck_check_score_by_options,
|
|
247
|
+
selected: check["score_by"] || CompletionKit::Checks::ListOverlap::DEFAULT_MEASURE,
|
|
248
|
+
labelledby: "metric_check_score_by_label",
|
|
249
|
+
invalid: ck_check_field_invalid?(metric, "score_by") %>
|
|
235
250
|
</div>
|
|
236
251
|
|
|
237
252
|
<div class="ck-field-row">
|
|
238
|
-
|
|
239
|
-
<
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
253
|
+
<% %w[min max].each do |bound| %>
|
|
254
|
+
<div class="ck-field" data-ck-check-field="<%= bound %>">
|
|
255
|
+
<label class="ck-label" for="metric_check_<%= bound %>"><span data-ck-check-label="<%= bound %>"><%= ck_check_field_label(bound, kind) %></span></label>
|
|
256
|
+
<p class="ck-hint" data-ck-check-hint="<%= bound %>"><%= ck_check_field_hint(bound, kind) %></p>
|
|
257
|
+
<input type="number" step="any" name="metric[check_config][<%= bound %>]" id="metric_check_<%= bound %>" class="ck-input" value="<%= check[bound] %>" <%= tag.attributes(ck_check_field_aria(metric, bound)) %>>
|
|
258
|
+
</div>
|
|
259
|
+
<% end %>
|
|
260
|
+
</div>
|
|
261
|
+
|
|
262
|
+
<div class="ck-field" data-ck-check-field="tolerance">
|
|
263
|
+
<label class="ck-label" for="metric_check_tolerance"><%= ck_check_field_label("tolerance") %></label>
|
|
264
|
+
<p class="ck-hint">How far a number can be out and still count as correct. Write a plain number for a fixed amount, or add a percent sign, like 2%, for a share of the expected number. Leave blank to require an exact match.</p>
|
|
265
|
+
<input type="text" inputmode="decimal" name="metric[check_config][tolerance]" id="metric_check_tolerance" class="ck-input" value="<%= check["tolerance"] %>" <%= tag.attributes(ck_check_field_aria(metric, "tolerance")) %>>
|
|
246
266
|
</div>
|
|
247
267
|
|
|
248
|
-
|
|
249
|
-
<
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
</label>
|
|
256
|
-
<label class="ck-checkbox" data-ck-check-field="trim">
|
|
257
|
-
<input type="checkbox" name="metric[check_config][trim]" value="true"<%= " checked" if check["trim"] %>>
|
|
258
|
-
<span>Trim whitespace</span>
|
|
259
|
-
</label>
|
|
268
|
+
<% CompletionKit::Checks::Registry::FLAG_KEYS.each do |flag| %>
|
|
269
|
+
<label class="ck-checkbox" data-ck-check-field="<%= flag %>">
|
|
270
|
+
<input type="hidden" name="metric[check_config][<%= flag %>]" value="false">
|
|
271
|
+
<input type="checkbox" name="metric[check_config][<%= flag %>]" value="true"<%= " checked" if CompletionKit::Checks::Flag.on?(check, flag) %>>
|
|
272
|
+
<span><%= ck_check_field_label(flag) %></span>
|
|
273
|
+
</label>
|
|
274
|
+
<% end %>
|
|
260
275
|
</div>
|
|
261
276
|
<% end %>
|
|
262
277
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<span class="ck-starter-card__cta">Preview →</span>
|
|
8
8
|
<%= button_to "dismiss", dismiss_starter_metrics_path(key: starter.key),
|
|
9
9
|
method: :post,
|
|
10
|
-
form: {
|
|
10
|
+
form: { data: { ck_stop_propagation: true } },
|
|
11
11
|
form_class: "inline-block ck-starter-card__dismiss-form",
|
|
12
12
|
class: "ck-starter-card__dismiss",
|
|
13
13
|
data: { turbo_confirm: "Hide \"#{starter.name}\" from this list?" } %>
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
</thead>
|
|
29
29
|
<tbody>
|
|
30
30
|
<% @metrics.each do |metric| %>
|
|
31
|
-
<tr
|
|
31
|
+
<tr data-ck-href="<%= metric_path(metric) %>" style="cursor: pointer;">
|
|
32
32
|
<td>
|
|
33
33
|
<%= link_to metric_path(metric), class: "ck-record-name" do %><strong><%= metric.name %></strong><% end %>
|
|
34
34
|
<span class="ck-chip ck-chip--soft ck-metric-type-chip"><%= metric.check? ? "Check" : "Judge" %></span>
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
<% if groups.any? %>
|
|
49
49
|
<div class="ck-metrics-table__groups">
|
|
50
50
|
<% groups.each do |g| %>
|
|
51
|
-
<%= link_to metric_group_path(g), class: "ck-metric-group-pill ck-metric-group-pill--active"
|
|
51
|
+
<%= link_to metric_group_path(g), class: "ck-metric-group-pill ck-metric-group-pill--active" do %>
|
|
52
52
|
<span class="ck-metric-group-pill__label"><%= g.name %></span>
|
|
53
53
|
<% end %>
|
|
54
54
|
<% end %>
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
<% if v.draft? && vs.present? %>
|
|
92
92
|
<span class="ck-version-score"><span class="ck-version-score__label">Match</span> <%= vs["after"] %>/<%= vs["tested"] %></span>
|
|
93
93
|
<% end %>
|
|
94
|
-
<button type="button" class="ck-cell-link ck-cell-link--delta" title="What changed from <%= pred.version_label %>"
|
|
94
|
+
<button type="button" class="ck-cell-link ck-cell-link--delta" title="What changed from <%= pred.version_label %>" data-ck-dialog-open="ck-mvdiff-<%= v.id %>">Δ</button>
|
|
95
95
|
</div>
|
|
96
96
|
<% end %>
|
|
97
97
|
</div>
|
|
@@ -126,14 +126,14 @@
|
|
|
126
126
|
<% pred = predecessor_of[v] %>
|
|
127
127
|
<% next unless v.change_summary_against(pred) %>
|
|
128
128
|
<% vs = v.validation_summary %>
|
|
129
|
-
<dialog id="ck-mvdiff-<%= v.id %>" class="ck-modal" aria-labelledby="ck-mvdiff-title-<%= v.id %>"
|
|
130
|
-
<article class="ck-modal__panel" tabindex="-1"
|
|
129
|
+
<dialog id="ck-mvdiff-<%= v.id %>" class="ck-modal" aria-labelledby="ck-mvdiff-title-<%= v.id %>" data-ck-dialog<%= " data-ck-dialog-autoopen" if params[:show_change].to_i == v.id %>>
|
|
130
|
+
<article class="ck-modal__panel" tabindex="-1">
|
|
131
131
|
<header class="ck-modal__header">
|
|
132
132
|
<div class="ck-modal__heading">
|
|
133
133
|
<h2 class="ck-modal__title" id="ck-mvdiff-title-<%= v.id %>"><%= pred.version_label %> → <%= v.version_label %></h2>
|
|
134
134
|
<span class="ck-modal__meta">What changed in <%= v.version_label %><% if v.current? %> (live)<% elsif v.draft? %> (draft)<% end %></span>
|
|
135
135
|
</div>
|
|
136
|
-
<button type="button" class="ck-modal__close" aria-label="Close"
|
|
136
|
+
<button type="button" class="ck-modal__close" aria-label="Close" data-ck-dialog-close>×</button>
|
|
137
137
|
</header>
|
|
138
138
|
<div class="ck-modal__body">
|
|
139
139
|
<% if v.draft? && vs.present? %>
|
|
@@ -223,13 +223,3 @@
|
|
|
223
223
|
<% end %>
|
|
224
224
|
</section>
|
|
225
225
|
<% end %>
|
|
226
|
-
|
|
227
|
-
<% if params[:show_change].present? %>
|
|
228
|
-
<script>
|
|
229
|
-
(function () {
|
|
230
|
-
var dialog = document.getElementById("ck-mvdiff-<%= params[:show_change].to_i %>");
|
|
231
|
-
if (dialog && typeof dialog.showModal === "function") dialog.showModal();
|
|
232
|
-
})();
|
|
233
|
-
</script>
|
|
234
|
-
<% end %>
|
|
235
|
-
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
<div class="ck-select-with-action">
|
|
50
50
|
<%= form.select :llm_model, ck_grouped_models(available, prompt.llm_model, rejected: prompt.errors[:llm_model].any?), { include_blank: "Select a model" }, { class: "ck-input", id: "prompt_llm_model", **ck_field_aria(form, :llm_model) } %>
|
|
51
51
|
<% ck_refreshing = CompletionKit::ProviderCredential.discovery_in_progress? %>
|
|
52
|
-
<button type="button" class="ck-icon-btn<%= ' ck-icon-btn--spinning' if ck_refreshing %>" title="Refresh models" <%= 'disabled' if ck_refreshing %>
|
|
52
|
+
<button type="button" class="ck-icon-btn<%= ' ck-icon-btn--spinning' if ck_refreshing %>" title="Refresh models" <%= 'disabled' if ck_refreshing %> data-ck-refresh-models><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="16" height="16"><path fill-rule="evenodd" d="M13.836 2.477a.75.75 0 0 1 .75.75v3.182a.75.75 0 0 1-.75.75h-3.182a.75.75 0 0 1 0-1.5h1.37l-.84-.841a4.5 4.5 0 0 0-7.08.681.75.75 0 0 1-1.264-.808 6 6 0 0 1 9.44-.908l.84.84V3.227a.75.75 0 0 1 .75-.75Zm-.911 7.5A.75.75 0 0 1 13.199 11a6 6 0 0 1-9.44.908l-.84-.84v1.68a.75.75 0 0 1-1.5 0V9.567a.75.75 0 0 1 .75-.75h3.182a.75.75 0 0 1 0 1.5h-1.37l.84.841a4.5 4.5 0 0 0 7.08-.681.75.75 0 0 1 1.024-.274Z" clip-rule="evenodd"/></svg></button>
|
|
53
53
|
</div>
|
|
54
54
|
<% else %>
|
|
55
55
|
<p class="ck-meta-copy">No models available. <%= link_to "Add a provider", provider_credentials_path, class: "ck-link" %> or click refresh after configuring a provider.</p>
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
</thead>
|
|
29
29
|
<tbody>
|
|
30
30
|
<% @prompts.each do |prompt| %>
|
|
31
|
-
<tr
|
|
31
|
+
<tr data-ck-href="<%= prompt_path(prompt) %>" style="cursor: pointer;">
|
|
32
32
|
<td>
|
|
33
33
|
<%= link_to prompt_path(prompt), class: "ck-record-name" do %><strong><%= prompt.name %></strong><% end %>
|
|
34
34
|
<% if prompt.description.present? %>
|
|
35
35
|
<p class="ck-prompts-table__desc"><%= truncate(prompt.description, length: 120) %></p>
|
|
36
36
|
<% end %>
|
|
37
|
-
<div class="ck-endpoint ck-endpoint--compact"
|
|
37
|
+
<div class="ck-endpoint ck-endpoint--compact" data-ck-row-ignore>
|
|
38
38
|
<code class="ck-endpoint__url" id="prompt_endpoint_<%= prompt.id %>"><%= api_v1_prompt_path(prompt.slug) %></code>
|
|
39
|
-
<button type="button" class="ck-icon-btn" title="Copy API path"
|
|
39
|
+
<button type="button" class="ck-icon-btn" title="Copy API path" data-ck-copy="prompt_endpoint_<%= prompt.id %>"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="13" height="13" aria-hidden="true"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"/><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"/></svg></button>
|
|
40
40
|
</div>
|
|
41
41
|
<% if prompt.tags.any? %>
|
|
42
42
|
<div class="tag-marks-row">
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<% end %>
|
|
17
17
|
<div class="ck-endpoint">
|
|
18
18
|
<code class="ck-endpoint__url" id="prompt_endpoint"><%= request.base_url %><%= api_v1_prompt_path(@prompt.slug) %></code>
|
|
19
|
-
<button type="button" class="ck-icon-btn" title="Copy endpoint" aria-label="Copy endpoint"
|
|
19
|
+
<button type="button" class="ck-icon-btn" title="Copy endpoint" aria-label="Copy endpoint" data-ck-copy="prompt_endpoint"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" width="14" height="14" aria-hidden="true"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"/><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"/></svg></button>
|
|
20
20
|
</div>
|
|
21
21
|
<p class="ck-meta-copy" id="prompt_serves">
|
|
22
22
|
<% if @serve_summary[:total].positive? %>
|
|
@@ -83,10 +83,10 @@
|
|
|
83
83
|
<% best_score = scoped_runs.map(&:avg_score).compact.max %>
|
|
84
84
|
<% best_pass_rate = scoped_runs.map(&:check_pass_rate).compact.max %>
|
|
85
85
|
<% pred = predecessor_of[v] %>
|
|
86
|
-
<tr class="<%= "ck-results-table__row--active" if v.id == @prompt.id %>"
|
|
86
|
+
<tr class="<%= "ck-results-table__row--active" if v.id == @prompt.id %>" data-ck-href="<%= prompt_path(v) %>" style="cursor: pointer;">
|
|
87
87
|
<td>
|
|
88
88
|
<div class="ck-version-cell">
|
|
89
|
-
<div class="ck-version-cell__label"
|
|
89
|
+
<div class="ck-version-cell__label" data-ck-row-ignore>
|
|
90
90
|
<%= link_to prompt_path(v), class: "ck-record-name" do %><strong>v<%= v.version_number %></strong><% end %>
|
|
91
91
|
<% if v.current? %>
|
|
92
92
|
<span class="ck-chip">Published</span>
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
<% end %>
|
|
96
96
|
</div>
|
|
97
97
|
<% if version_changed.call(v, pred) %>
|
|
98
|
-
<button type="button" class="ck-cell-link ck-cell-link--delta" title="What changed from v<%= pred.version_number %>" aria-label="What changed from v<%= pred.version_number %>"
|
|
98
|
+
<button type="button" class="ck-cell-link ck-cell-link--delta" title="What changed from v<%= pred.version_number %>" aria-label="What changed from v<%= pred.version_number %>" data-ck-dialog-open="ck-vdiff-<%= v.id %>"><span aria-hidden="true">Δ</span></button>
|
|
99
99
|
<% end %>
|
|
100
100
|
</div>
|
|
101
101
|
</td>
|
|
@@ -121,14 +121,14 @@
|
|
|
121
121
|
<% versions.each do |v| %>
|
|
122
122
|
<% pred = predecessor_of[v] %>
|
|
123
123
|
<% next unless version_changed.call(v, pred) %>
|
|
124
|
-
<dialog id="ck-vdiff-<%= v.id %>" class="ck-modal" aria-labelledby="ck-vdiff-title-<%= v.id %>"
|
|
125
|
-
<article class="ck-modal__panel" tabindex="-1" autofocus
|
|
124
|
+
<dialog id="ck-vdiff-<%= v.id %>" class="ck-modal" aria-labelledby="ck-vdiff-title-<%= v.id %>" data-ck-dialog>
|
|
125
|
+
<article class="ck-modal__panel" tabindex="-1" autofocus>
|
|
126
126
|
<header class="ck-modal__header">
|
|
127
127
|
<div class="ck-modal__heading">
|
|
128
128
|
<h2 class="ck-modal__title" id="ck-vdiff-title-<%= v.id %>">v<%= pred.version_number %> <span aria-hidden="true">→</span> v<%= v.version_number %></h2>
|
|
129
129
|
<span class="ck-modal__meta">What changed in <%= v.version_label %><% if v.current? %> (published)<% end %></span>
|
|
130
130
|
</div>
|
|
131
|
-
<button type="button" class="ck-modal__close" aria-label="Close"
|
|
131
|
+
<button type="button" class="ck-modal__close" aria-label="Close" data-ck-dialog-close>×</button>
|
|
132
132
|
</header>
|
|
133
133
|
<div class="ck-modal__body">
|
|
134
134
|
<% if pred.llm_model != v.llm_model %>
|
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
</thead>
|
|
189
189
|
<tbody>
|
|
190
190
|
<% suggestions.each do |s| %>
|
|
191
|
-
<tr
|
|
191
|
+
<tr data-ck-href="<%= suggestion_path(s, from: "prompt") %>" style="cursor: pointer;">
|
|
192
192
|
<td><%= link_to suggestion_path(s, from: "prompt"), class: "ck-record-name" do %><strong><%= s.run.name %></strong><% end %></td>
|
|
193
193
|
<td><span class="ck-chip ck-chip--soft"><%= s.prompt.version_label %></span></td>
|
|
194
194
|
<td class="ck-meta-copy"><%= truncate(ck_strip_markdown(s.reasoning), length: 100) %></td>
|