completion-kit 0.28.3 → 0.28.5
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 +23 -6
- data/app/controllers/completion_kit/runs_controller.rb +1 -1
- data/app/jobs/completion_kit/model_discovery_job.rb +1 -1
- data/app/services/completion_kit/model_discovery_service.rb +16 -6
- data/app/views/completion_kit/runs/_compare_score.html.erb +12 -0
- data/app/views/completion_kit/runs/compare.html.erb +15 -36
- data/lib/completion_kit/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4206f8709997fb6c2e5055bcf2f201eda59d4de2c7c3ef15fc7f98dac4f92a21
|
|
4
|
+
data.tar.gz: 83e6756cc1f5ed0606d01f7e269e7157146a9efe539c7550f4dd33ace35914b0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8edabb8604bbee9c38c9cf070add0732592c8392f686f8f224c8ca82cd7aef1d3a581011f41da48eb7cbd3cd0bd26a0331002483843183cf62e4167ea408689c
|
|
7
|
+
data.tar.gz: 2afb4955b727b0bca04939e4d2ce2a6fd61b25e66e3bbe843b39e48ca0a81be30fd845369b30c39b7c17d71d7029d947eb3221d78ca9f0f1faeba9e8eab0a179
|
|
@@ -3206,12 +3206,10 @@ select.ck-input {
|
|
|
3206
3206
|
|
|
3207
3207
|
.ck-run-compare-table th { white-space: nowrap; }
|
|
3208
3208
|
.ck-run-compare-table th:nth-child(1) { width: 7rem; }
|
|
3209
|
-
.ck-run-compare-table th:nth-child(2) { width:
|
|
3210
|
-
.ck-run-compare-table th:nth-child(3) { width:
|
|
3211
|
-
.ck-run-compare-table th:nth-child(4) { width:
|
|
3212
|
-
.ck-run-compare-table th:nth-child(5) { width:
|
|
3213
|
-
.ck-run-compare-table th:nth-child(6) { width: 7rem; }
|
|
3214
|
-
.ck-run-compare-table th:nth-child(7) { width: 7rem; }
|
|
3209
|
+
.ck-run-compare-table th:nth-child(2) { width: 15rem; }
|
|
3210
|
+
.ck-run-compare-table th:nth-child(3) { width: 12rem; }
|
|
3211
|
+
.ck-run-compare-table th:nth-child(4) { width: 8rem; }
|
|
3212
|
+
.ck-run-compare-table th:nth-child(5) { width: auto; }
|
|
3215
3213
|
|
|
3216
3214
|
.ck-run-compare-table th.ck-num,
|
|
3217
3215
|
.ck-run-compare-table td.ck-num { text-align: right; }
|
|
@@ -3221,7 +3219,26 @@ select.ck-input {
|
|
|
3221
3219
|
white-space: nowrap;
|
|
3222
3220
|
overflow: hidden;
|
|
3223
3221
|
text-overflow: ellipsis;
|
|
3222
|
+
color: var(--ck-text);
|
|
3223
|
+
font-weight: 500;
|
|
3224
|
+
}
|
|
3225
|
+
|
|
3226
|
+
.ck-cmp-score__pair { display: inline-flex; align-items: center; gap: 0.45rem; }
|
|
3227
|
+
.ck-cmp-score__arrow { color: var(--ck-dim); font-size: 0.78rem; }
|
|
3228
|
+
.ck-cmp-score__link { display: inline-flex; text-decoration: none; border-radius: 7px; transition: box-shadow 0.12s ease; }
|
|
3229
|
+
.ck-cmp-score__link:hover { box-shadow: 0 0 0 1px var(--ck-accent); }
|
|
3230
|
+
.ck-cmp-score__none { color: var(--ck-dim); }
|
|
3231
|
+
|
|
3232
|
+
.ck-cmp-delta .ck-delta { display: inline-flex; align-items: baseline; gap: 0.2rem; }
|
|
3233
|
+
.ck-delta__arrow { font-size: 0.72rem; }
|
|
3234
|
+
|
|
3235
|
+
.ck-cmp-ver__one, .ck-cmp-ver__pair {
|
|
3236
|
+
font-family: var(--ck-mono);
|
|
3237
|
+
font-size: 0.78rem;
|
|
3238
|
+
color: var(--ck-dim);
|
|
3224
3239
|
}
|
|
3240
|
+
.ck-cmp-ver__pair { color: var(--ck-muted); }
|
|
3241
|
+
.ck-cmp-ver__arrow { color: var(--ck-dim); margin: 0 0.3rem; }
|
|
3225
3242
|
|
|
3226
3243
|
.ck-compare-case { white-space: nowrap; }
|
|
3227
3244
|
.ck-compare-case__num {
|
|
@@ -16,7 +16,7 @@ module CompletionKit
|
|
|
16
16
|
@responses_total = @run.responses.count
|
|
17
17
|
@responses_per_page = RESPONSES_PER_PAGE
|
|
18
18
|
@responses_total_pages = [(@responses_total.to_f / RESPONSES_PER_PAGE).ceil, 1].max
|
|
19
|
-
@responses_page = params[:page].to_i.clamp(1, @responses_total_pages)
|
|
19
|
+
@responses_page = params[:page].to_s.to_i.clamp(1, @responses_total_pages)
|
|
20
20
|
@responses_offset = (@responses_page - 1) * RESPONSES_PER_PAGE
|
|
21
21
|
@responses = ordered_responses_relation(@run, params[:sort])
|
|
22
22
|
.includes(:reviews)
|
|
@@ -18,7 +18,7 @@ module CompletionKit
|
|
|
18
18
|
discard_on ActiveJob::DeserializationError
|
|
19
19
|
|
|
20
20
|
rescue_from(StandardError) do |error|
|
|
21
|
-
|
|
21
|
+
unless error.is_a?(CompletionKit::ModelDiscoveryService::DiscoveryError)
|
|
22
22
|
Rails.error.report(error, handled: true, context: { job: self.class.name, provider_credential_id: arguments.first })
|
|
23
23
|
end
|
|
24
24
|
credential = ProviderCredential.find_by(id: arguments.first)
|
|
@@ -63,9 +63,19 @@ module CompletionKit
|
|
|
63
63
|
return nil if body.blank?
|
|
64
64
|
data = JSON.parse(body)
|
|
65
65
|
err = data["error"]
|
|
66
|
-
(err.is_a?(Hash) && err["message"]) || data["message"] || (err.is_a?(String) && err) || nil
|
|
66
|
+
message = (err.is_a?(Hash) && err["message"]) || data["message"] || (err.is_a?(String) && err) || nil
|
|
67
|
+
redact_secrets(message)
|
|
67
68
|
rescue JSON::ParserError
|
|
68
|
-
body.to_s.truncate(200)
|
|
69
|
+
redact_secrets(body.to_s.truncate(200))
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def redact_secrets(text)
|
|
73
|
+
return text if text.blank?
|
|
74
|
+
redacted = text.to_s
|
|
75
|
+
redacted = redacted.gsub(@api_key, "[REDACTED]") if @api_key.present?
|
|
76
|
+
redacted = redacted.gsub(/\bsk-[A-Za-z0-9_-]{6,}/, "[REDACTED]")
|
|
77
|
+
redacted = redacted.gsub(/\bBearer\s+\S+/i, "Bearer [REDACTED]")
|
|
78
|
+
redacted.gsub(/(API key provided:\s*)\S+/i, '\1[REDACTED]')
|
|
69
79
|
end
|
|
70
80
|
|
|
71
81
|
def fetch_openai_models
|
|
@@ -336,11 +346,11 @@ module CompletionKit
|
|
|
336
346
|
end
|
|
337
347
|
else
|
|
338
348
|
model.supports_generation = false
|
|
339
|
-
model.generation_error = "#{response.status} - #{response.body.truncate(500)}"
|
|
349
|
+
model.generation_error = redact_secrets("#{response.status} - #{response.body.truncate(500)}")
|
|
340
350
|
end
|
|
341
351
|
rescue StandardError => e
|
|
342
352
|
model.supports_generation = false
|
|
343
|
-
model.generation_error = e.message
|
|
353
|
+
model.generation_error = redact_secrets(e.message)
|
|
344
354
|
end
|
|
345
355
|
|
|
346
356
|
def probe_judging(model)
|
|
@@ -364,11 +374,11 @@ module CompletionKit
|
|
|
364
374
|
end
|
|
365
375
|
else
|
|
366
376
|
model.supports_judging = false
|
|
367
|
-
model.judging_error = "#{response.status} - #{response.body.truncate(500)}"
|
|
377
|
+
model.judging_error = redact_secrets("#{response.status} - #{response.body.truncate(500)}")
|
|
368
378
|
end
|
|
369
379
|
rescue StandardError => e
|
|
370
380
|
model.supports_judging = false
|
|
371
|
-
model.judging_error = e.message
|
|
381
|
+
model.judging_error = redact_secrets(e.message)
|
|
372
382
|
end
|
|
373
383
|
|
|
374
384
|
OPENAI_REASONING_PROBE_BUDGET = 65_536
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<% has_value = kind == "check" ? !passed.nil? : score.present? %>
|
|
2
|
+
<% if has_value && response %>
|
|
3
|
+
<%= link_to run_response_path(run, response), class: "ck-cmp-score__link", title: "#{side}: open this response (#{run.name})" do %>
|
|
4
|
+
<% if kind == "check" %>
|
|
5
|
+
<%= ck_check_badge(passed) %>
|
|
6
|
+
<% else %>
|
|
7
|
+
<span class="<%= ck_badge_classes(ck_score_kind(score.to_f)) %>"><%= score %></span>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% end %>
|
|
10
|
+
<% else %>
|
|
11
|
+
<span class="ck-cmp-score__none">—</span>
|
|
12
|
+
<% end %>
|
|
@@ -25,11 +25,9 @@
|
|
|
25
25
|
<tr>
|
|
26
26
|
<th scope="col">Case</th>
|
|
27
27
|
<th scope="col">Metric</th>
|
|
28
|
-
<th scope="col">A
|
|
29
|
-
<th scope="col">B score</th>
|
|
28
|
+
<th scope="col">A → B</th>
|
|
30
29
|
<th scope="col" class="ck-num">Δ</th>
|
|
31
|
-
<th scope="col">
|
|
32
|
-
<th scope="col">B version</th>
|
|
30
|
+
<th scope="col">Version</th>
|
|
33
31
|
</tr>
|
|
34
32
|
</thead>
|
|
35
33
|
<% @comparison[:rows].each do |row| %>
|
|
@@ -55,44 +53,25 @@
|
|
|
55
53
|
</td>
|
|
56
54
|
<% end %>
|
|
57
55
|
<td class="ck-compare-metric" data-label="Metric" title="<%= pm[:metric_name] %>"><%= pm[:metric_name] %></td>
|
|
58
|
-
<td data-label="A
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
<% end %>
|
|
65
|
-
<% elsif pm[:left_score] %>
|
|
66
|
-
<span class="<%= ck_badge_classes(ck_score_kind(pm[:left_score].to_f)) %>"><%= pm[:left_score] %></span>
|
|
67
|
-
<% else %>
|
|
68
|
-
<span class="ck-meta-copy">—</span>
|
|
69
|
-
<% end %>
|
|
70
|
-
</td>
|
|
71
|
-
<td data-label="B score">
|
|
72
|
-
<% if pm[:kind] == "check" %>
|
|
73
|
-
<% if pm[:right_passed].nil? %>
|
|
74
|
-
<span class="ck-meta-copy">—</span>
|
|
75
|
-
<% else %>
|
|
76
|
-
<%= ck_check_badge(pm[:right_passed]) %>
|
|
77
|
-
<% end %>
|
|
78
|
-
<% elsif pm[:right_score] %>
|
|
79
|
-
<span class="<%= ck_badge_classes(ck_score_kind(pm[:right_score].to_f)) %>"><%= pm[:right_score] %></span>
|
|
80
|
-
<% else %>
|
|
81
|
-
<span class="ck-meta-copy">—</span>
|
|
82
|
-
<% end %>
|
|
56
|
+
<td class="ck-cmp-score" data-label="A → B">
|
|
57
|
+
<span class="ck-cmp-score__pair">
|
|
58
|
+
<%= render "compare_score", kind: pm[:kind], passed: pm[:left_passed], score: pm[:left_score], response: row[:left_response], run: @run, side: "A" %>
|
|
59
|
+
<span class="ck-cmp-score__arrow" aria-hidden="true">→</span>
|
|
60
|
+
<%= render "compare_score", kind: pm[:kind], passed: pm[:right_passed], score: pm[:right_score], response: row[:right_response], run: @other_run, side: "B" %>
|
|
61
|
+
</span>
|
|
83
62
|
</td>
|
|
84
|
-
<td class="ck-num" data-label="Δ">
|
|
63
|
+
<td class="ck-num ck-cmp-delta" data-label="Δ">
|
|
85
64
|
<% if pm[:kind] == "check" %>
|
|
86
|
-
<%= ck_result_change_badge(pm[:result_change]) || content_tag(:span, "—", class: "ck-
|
|
65
|
+
<%= ck_result_change_badge(pm[:result_change]) || content_tag(:span, "—", class: "ck-cmp-score__none") %>
|
|
87
66
|
<% elsif pm[:delta] %>
|
|
88
|
-
<%
|
|
89
|
-
|
|
67
|
+
<% d = pm[:delta] %>
|
|
68
|
+
<% dcls = d > 0 ? "ck-delta--positive" : d < 0 ? "ck-delta--negative" : "ck-delta--zero" %>
|
|
69
|
+
<span class="ck-delta <%= dcls %>"><span class="ck-delta__arrow" aria-hidden="true"><%= d > 0 ? "▲" : d < 0 ? "▼" : "=" %></span><%= d > 0 ? "+#{d}" : d.to_s %></span>
|
|
90
70
|
<% else %>
|
|
91
|
-
<span class="ck-
|
|
71
|
+
<span class="ck-cmp-score__none">—</span>
|
|
92
72
|
<% end %>
|
|
93
73
|
</td>
|
|
94
|
-
<td data-label="
|
|
95
|
-
<td data-label="B version"><% if pm[:right_version_label] %><span class="ck-source-chip ck-source-chip--current"><%= pm[:right_version_label] %></span><% end %></td>
|
|
74
|
+
<td class="ck-cmp-ver" data-label="Version"><% lv = pm[:left_version_label]; rv = pm[:right_version_label] %><% if lv && rv && lv != rv %><span class="ck-cmp-ver__pair"><%= lv %><span class="ck-cmp-ver__arrow" aria-hidden="true">→</span><%= rv %></span><% elsif lv || rv %><span class="ck-cmp-ver__one"><%= lv || rv %></span><% end %></td>
|
|
96
75
|
</tr>
|
|
97
76
|
<% end %>
|
|
98
77
|
</tbody>
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: completion-kit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.28.
|
|
4
|
+
version: 0.28.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Damien Bastin
|
|
@@ -407,6 +407,7 @@ files:
|
|
|
407
407
|
- app/views/completion_kit/provider_credentials/statuses.turbo_stream.erb
|
|
408
408
|
- app/views/completion_kit/responses/show.html.erb
|
|
409
409
|
- app/views/completion_kit/runs/_actions.html.erb
|
|
410
|
+
- app/views/completion_kit/runs/_compare_score.html.erb
|
|
410
411
|
- app/views/completion_kit/runs/_form.html.erb
|
|
411
412
|
- app/views/completion_kit/runs/_response_row.html.erb
|
|
412
413
|
- app/views/completion_kit/runs/_row.html.erb
|