completion-kit 0.28.16 → 0.28.17
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/app/assets/stylesheets/completion_kit/application.css +37 -5
- data/app/helpers/completion_kit/application_helper.rb +10 -0
- data/app/views/completion_kit/prompts/show.html.erb +5 -3
- data/app/views/completion_kit/suggestions/_scoreboard.html.erb +7 -11
- data/app/views/completion_kit/suggestions/_state.html.erb +26 -24
- data/lib/completion_kit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a06bbc49a6b929962197f8ff7fe9cd5e1fa4561fe2a7074e4028ac867472cf61
|
|
4
|
+
data.tar.gz: 6615270452a2c991cce7ef84aa5267e22f014e3039dd59cd7ebeb1f0ba8cb90c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9be6cc2b9f3522f622c9b6d503e391b3007d70e156ea12f862e4cd8fd91a20a3a9c01691a8910a48bdaedd2d9dea86766051ea8bf8172aac7f0882f5368e257c
|
|
7
|
+
data.tar.gz: b87f4a046822e9b52b2edd823f443894d5f106cc81f1e6470fb5f7d4d4764a497ac23f3795201e63819971d3890c235eb3a297e9b689d2781479cdfc005f89b1
|
|
@@ -4039,11 +4039,12 @@ select.ck-input {
|
|
|
4039
4039
|
.ck-source-chip--past {
|
|
4040
4040
|
color: var(--ck-dim);
|
|
4041
4041
|
}
|
|
4042
|
-
.ck-suggestions-table th:nth-child(1), .ck-suggestions-table td:nth-child(1) { width:
|
|
4043
|
-
.ck-suggestions-table th:nth-child(2), .ck-suggestions-table td:nth-child(2) { width:
|
|
4044
|
-
.ck-suggestions-table th:nth-child(3), .ck-suggestions-table td:nth-child(3) { width:
|
|
4045
|
-
.ck-suggestions-table th:nth-child(4), .ck-suggestions-table td:nth-child(4) { width:
|
|
4046
|
-
.ck-suggestions-table th:nth-child(5), .ck-suggestions-table td:nth-child(5) { width:
|
|
4042
|
+
.ck-suggestions-table th:nth-child(1), .ck-suggestions-table td:nth-child(1) { width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
4043
|
+
.ck-suggestions-table th:nth-child(2), .ck-suggestions-table td:nth-child(2) { width: 5rem; white-space: nowrap; }
|
|
4044
|
+
.ck-suggestions-table th:nth-child(3), .ck-suggestions-table td:nth-child(3) { width: auto; }
|
|
4045
|
+
.ck-suggestions-table th:nth-child(4), .ck-suggestions-table td:nth-child(4) { width: 6rem; white-space: nowrap; }
|
|
4046
|
+
.ck-suggestions-table th:nth-child(5), .ck-suggestions-table td:nth-child(5) { width: 8rem; white-space: nowrap; }
|
|
4047
|
+
.ck-suggestions-table th:nth-child(6), .ck-suggestions-table td:nth-child(6) { width: 3rem; }
|
|
4047
4048
|
|
|
4048
4049
|
.ck-metrics-table__groups {
|
|
4049
4050
|
display: flex;
|
|
@@ -4560,6 +4561,37 @@ table.ck-runs-table {
|
|
|
4560
4561
|
font-size: 0.85rem;
|
|
4561
4562
|
}
|
|
4562
4563
|
|
|
4564
|
+
.ck-suggest-untested {
|
|
4565
|
+
margin-bottom: 16px;
|
|
4566
|
+
padding-bottom: 14px;
|
|
4567
|
+
border-bottom: 1px solid var(--ck-line);
|
|
4568
|
+
}
|
|
4569
|
+
|
|
4570
|
+
.ck-suggest-untested__headline {
|
|
4571
|
+
margin: 0 0 6px;
|
|
4572
|
+
font-size: 0.95rem;
|
|
4573
|
+
color: var(--ck-text);
|
|
4574
|
+
}
|
|
4575
|
+
|
|
4576
|
+
.ck-suggest-untested__copy {
|
|
4577
|
+
margin: 0;
|
|
4578
|
+
font-size: 0.85rem;
|
|
4579
|
+
line-height: 1.6;
|
|
4580
|
+
color: var(--ck-muted);
|
|
4581
|
+
max-width: 66ch;
|
|
4582
|
+
}
|
|
4583
|
+
|
|
4584
|
+
.ck-suggest-decision {
|
|
4585
|
+
margin-top: 1.5rem;
|
|
4586
|
+
}
|
|
4587
|
+
|
|
4588
|
+
.ck-suggest-decision__note {
|
|
4589
|
+
margin: 0 0 0.9rem;
|
|
4590
|
+
font-size: 0.8rem;
|
|
4591
|
+
color: var(--ck-muted);
|
|
4592
|
+
max-width: 66ch;
|
|
4593
|
+
}
|
|
4594
|
+
|
|
4563
4595
|
.ck-suggest-reasoning .ck-kicker {
|
|
4564
4596
|
margin-bottom: 0.5rem;
|
|
4565
4597
|
}
|
|
@@ -9,6 +9,16 @@ module CompletionKit
|
|
|
9
9
|
simple_format(inline)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
def ck_strip_markdown(text)
|
|
13
|
+
text.to_s
|
|
14
|
+
.gsub(/\*\*(.+?)\*\*/, '\1')
|
|
15
|
+
.gsub(/`([^`]+)`/, '\1')
|
|
16
|
+
.gsub(/[#>]+/, " ")
|
|
17
|
+
.gsub(/(?:^|\s)[-*•]\s+/, " ")
|
|
18
|
+
.gsub(/\s+/, " ")
|
|
19
|
+
.strip
|
|
20
|
+
end
|
|
21
|
+
|
|
12
22
|
def ck_runs_display_footer(runs)
|
|
13
23
|
partial = CompletionKit.config.runs_display_footer_partial
|
|
14
24
|
return unless partial
|
|
@@ -153,14 +153,15 @@
|
|
|
153
153
|
|
|
154
154
|
<%= ck_runs_display_footer(@runs) %>
|
|
155
155
|
|
|
156
|
-
<% suggestions = CompletionKit::Suggestion.where(prompt_id: @prompt.family_versions.select(:id)).order(created_at: :desc) %>
|
|
156
|
+
<% suggestions = CompletionKit::Suggestion.where(prompt_id: @prompt.family_versions.select(:id)).includes(:run, :prompt).order(created_at: :desc) %>
|
|
157
157
|
<% if suggestions.any? %>
|
|
158
158
|
<section class="ck-card--spaced">
|
|
159
|
-
<p class="ck-kicker">
|
|
159
|
+
<p class="ck-kicker">Suggested improvements</p>
|
|
160
160
|
<table class="ck-results-table ck-suggestions-table" style="margin-top: 0.5rem;">
|
|
161
161
|
<thead>
|
|
162
162
|
<tr>
|
|
163
163
|
<th>Run</th>
|
|
164
|
+
<th>Version</th>
|
|
164
165
|
<th>Reasoning</th>
|
|
165
166
|
<th>Applied</th>
|
|
166
167
|
<th>When</th>
|
|
@@ -171,7 +172,8 @@
|
|
|
171
172
|
<% suggestions.each do |s| %>
|
|
172
173
|
<tr onclick="window.location='<%= suggestion_path(s, from: "prompt") %>'" style="cursor: pointer;">
|
|
173
174
|
<td><%= link_to suggestion_path(s, from: "prompt"), class: "ck-record-name" do %><strong><%= s.run.name %></strong><% end %></td>
|
|
174
|
-
<td class="ck-meta-copy"><%=
|
|
175
|
+
<td class="ck-meta-copy"><%= s.prompt.version_label %></td>
|
|
176
|
+
<td class="ck-meta-copy"><%= truncate(ck_strip_markdown(s.reasoning), length: 100) %></td>
|
|
175
177
|
<td><%= s.applied_at? ? content_tag(:span, "Applied", class: "ck-chip", style: "background: var(--ck-success-soft); color: var(--ck-success);") : "—".html_safe %></td>
|
|
176
178
|
<td class="ck-meta-copy"><time data-relative-time datetime="<%= s.created_at.utc.iso8601 %>"><%= time_ago_in_words(s.created_at) %> ago</time></td>
|
|
177
179
|
<td class="ck-results-table__arrow" aria-hidden="true">→</td>
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
<% s = summary %>
|
|
2
2
|
<div class="ck-scoreboard">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
</ul>
|
|
10
|
-
<% else %>
|
|
11
|
-
<p class="ck-scoreboard__headline">Couldn't re-score this rewrite against the run's responses.</p>
|
|
12
|
-
<% end %>
|
|
3
|
+
<p class="ck-scoreboard__headline">We re-ran this wording on <strong><%= s["tested"] %></strong> of the run's responses. It scored <strong><%= s["after_avg"] %></strong> now, <span class="ck-scoreboard__was"><%= s["before_avg"] %> before</span></p>
|
|
4
|
+
<ul class="ck-scoreboard__tally">
|
|
5
|
+
<li class="ck-scoreboard__stat ck-scoreboard__stat--fix">Better on <strong><%= s["improved"] %></strong></li>
|
|
6
|
+
<li class="ck-scoreboard__stat ck-scoreboard__stat--keep">Same on <strong><%= s["unchanged"] %></strong></li>
|
|
7
|
+
<li class="ck-scoreboard__stat ck-scoreboard__stat--break">Worse on <strong><%= s["regressed"] %></strong></li>
|
|
8
|
+
</ul>
|
|
13
9
|
<% if s["capped"] %>
|
|
14
|
-
<p class="ck-scoreboard__note">
|
|
10
|
+
<p class="ck-scoreboard__note">Based on this run's 30 most recent responses.</p>
|
|
15
11
|
<% end %>
|
|
16
12
|
</div>
|
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
<%= button_to "Try again", suggest_run_path(run), method: :post, class: ck_button_classes(:light, variant: :outline), form_class: "inline-block" %>
|
|
12
12
|
</div>
|
|
13
13
|
<% else %>
|
|
14
|
-
<% if suggestion.
|
|
14
|
+
<% if suggestion.validated? %>
|
|
15
15
|
<%= render "completion_kit/suggestions/scoreboard", summary: suggestion.validation_summary %>
|
|
16
|
+
<% else %>
|
|
17
|
+
<div class="ck-suggest-untested">
|
|
18
|
+
<p class="ck-suggest-untested__headline">We couldn't test this rewrite</p>
|
|
19
|
+
<p class="ck-suggest-untested__copy">Testing a rewrite means re-running it on this run's responses and scoring the results. That didn't return a score this time, usually because the run has no AI-judge scores to compare against. So there's no evidence yet that it beats your current prompt.</p>
|
|
20
|
+
</div>
|
|
16
21
|
<% end %>
|
|
17
22
|
|
|
18
|
-
<div class="ck-suggest-reasoning">
|
|
19
|
-
<p class="ck-kicker">Reasons for suggested changes</p>
|
|
20
|
-
<div class="ck-suggest-reasoning__body"><%= ck_markdown(suggestion.reasoning) %></div>
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
23
|
<div class="ck-suggest-diff">
|
|
24
24
|
<div class="ck-suggest-diff__pane">
|
|
25
25
|
<div class="ck-suggest-diff__header">
|
|
@@ -36,28 +36,30 @@
|
|
|
36
36
|
</div>
|
|
37
37
|
</div>
|
|
38
38
|
|
|
39
|
-
<div class="ck-suggest-
|
|
40
|
-
<p class="ck-kicker">
|
|
41
|
-
<
|
|
39
|
+
<div class="ck-suggest-reasoning">
|
|
40
|
+
<p class="ck-kicker">Reasons for suggested changes</p>
|
|
41
|
+
<div class="ck-suggest-reasoning__body"><%= ck_markdown(suggestion.reasoning) %></div>
|
|
42
42
|
</div>
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
<% if !suggestion.validated? %>
|
|
46
|
-
<p class="ck-suggest-caveat">Couldn't be re-scored against this run's responses, so applying it is unvalidated.</p>
|
|
47
|
-
<% elsif suggestion.net_negative? %>
|
|
48
|
-
<% vs = suggestion.validation_summary %>
|
|
49
|
-
<p class="ck-suggest-caveat">Scored <%= vs["after_avg"] %> on the held-out responses, below your original's <%= vs["before_avg"] %>.</p>
|
|
50
|
-
<% end %>
|
|
51
|
-
<% end %>
|
|
52
|
-
<div class="ck-actions">
|
|
44
|
+
<div class="ck-suggest-decision">
|
|
53
45
|
<% if suggestion.applied_at? %>
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<% elsif suggestion.net_negative? %>
|
|
58
|
-
<%= button_to "Apply anyway", apply_suggestion_path(suggestion), method: :post, class: ck_button_classes(:light, variant: :outline), form: { class: "inline-block", data: { turbo_confirm: "This rewrite scored lower than the original on the held-out responses. Apply it anyway?" } } %>
|
|
46
|
+
<div class="ck-actions">
|
|
47
|
+
<span class="ck-chip" style="background: var(--ck-success-soft); color: var(--ck-success);">Applied</span>
|
|
48
|
+
</div>
|
|
59
49
|
<% else %>
|
|
60
|
-
|
|
50
|
+
<% if suggestion.validated? && suggestion.net_negative? %>
|
|
51
|
+
<p class="ck-suggest-caveat">This wording scored lower than your current prompt on the responses we tested. Applying it will most likely make results worse.</p>
|
|
52
|
+
<% end %>
|
|
53
|
+
<p class="ck-suggest-decision__note">Applying publishes this wording as a new version of your prompt. Your current version stays exactly as it is.</p>
|
|
54
|
+
<div class="ck-actions">
|
|
55
|
+
<% if !suggestion.validated? %>
|
|
56
|
+
<%= button_to "Apply anyway", apply_suggestion_path(suggestion), method: :post, class: ck_button_classes(:light, variant: :outline), form: { class: "inline-block", data: { turbo_confirm: "We couldn't test this rewrite, so there's no evidence it beats your current prompt. Apply it anyway?" } } %>
|
|
57
|
+
<% elsif suggestion.net_negative? %>
|
|
58
|
+
<%= button_to "Apply anyway", apply_suggestion_path(suggestion), method: :post, class: ck_button_classes(:light, variant: :outline), form: { class: "inline-block", data: { turbo_confirm: "This rewrite scored lower than your current prompt on the responses we tested. Apply it anyway?" } } %>
|
|
59
|
+
<% else %>
|
|
60
|
+
<%= button_to "Apply suggestion", apply_suggestion_path(suggestion), method: :post, class: ck_button_classes(:dark), form_class: "inline-block" %>
|
|
61
|
+
<% end %>
|
|
62
|
+
</div>
|
|
61
63
|
<% end %>
|
|
62
64
|
</div>
|
|
63
65
|
<% end %>
|