completion-kit 0.5.12 → 0.5.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c45ef9dab51631cbc2bfc606b6c98c038d967edeea8903efa634571d012e0b0
4
- data.tar.gz: 549981db86a07f2d48cafb2b2413f6e1850997087ef553418c3ec9d7d07e0a0a
3
+ metadata.gz: 119b2978f4176a40950e2874176272851530c0b00a1a5dc9387f76ffd8caba62
4
+ data.tar.gz: ca60f782bcd182e9af024d34479e78f21c85b8e8605ade8f825d00cdc448c4ea
5
5
  SHA512:
6
- metadata.gz: ddf258f7c59bc3a92113bcb95211f0314ea6cebe624d163478833f1515f0baafab0c630b9dd8983b7e2bde7ea5b641cb45b2249cd48c08a853422633e93409d9
7
- data.tar.gz: 5001137b6be3a376f665cff46480e51b6994774f7e9146b5e464053bedcd5d989e2171b4ea8d792c9312b8c03b2e46e9d6b7515d8037e1c5510bde14caf11b1f
6
+ metadata.gz: 1ce0a05b7b22f363f0386fffa2b94c60b94e767ac0a732b1309d70dbda9d951407f5abc42d02e3992f56a20bc902f9bcba938dedd405cfd02cb8577a0b8d4fe5
7
+ data.tar.gz: 0ed8728ca2853047cd6c659d696cdfbbeac681f726d3d368e183187ac179f434933a6f0d3b819e4bb5318f5d643aebbd4991a92014e7117993cee9200a6cca37
@@ -39,6 +39,7 @@
39
39
  }
40
40
 
41
41
  html {
42
+ color-scheme: dark;
42
43
  font-size: 18px;
43
44
  line-height: 1.5;
44
45
  scrollbar-gutter: stable;
@@ -1284,6 +1285,24 @@ tr:hover .ck-chip--publish {
1284
1285
  line-height: 1.75;
1285
1286
  }
1286
1287
 
1288
+ /* Scrollable code-block wrapper — caps height for big payloads. Inner
1289
+ <pre> drops its own border/radius so the wrapper owns the edge. We
1290
+ leave the scrollbar unstyled so it matches the browser/page scrollbar. */
1291
+ .ck-code-scroll-wrap {
1292
+ margin-top: 0.5rem;
1293
+ max-height: 28rem;
1294
+ overflow: auto;
1295
+ border: 1px solid var(--ck-line);
1296
+ border-radius: var(--ck-radius);
1297
+ background: var(--ck-bg-strong);
1298
+ }
1299
+ .ck-code-scroll-wrap > .ck-code {
1300
+ margin-top: 0;
1301
+ border: 0;
1302
+ border-radius: 0;
1303
+ background: transparent;
1304
+ }
1305
+
1287
1306
  .ck-note-box {
1288
1307
  background: var(--ck-surface-soft);
1289
1308
  border: 1px solid var(--ck-line);
@@ -1873,22 +1892,7 @@ tr:hover .ck-chip--publish {
1873
1892
  background: var(--ck-bg-strong);
1874
1893
  overflow: auto;
1875
1894
  max-height: 60vh;
1876
- scrollbar-width: thin;
1877
- scrollbar-color: var(--ck-line-strong) var(--ck-bg);
1878
1895
  }
1879
- .ck-csv-table-wrap::-webkit-scrollbar { width: 12px; height: 12px; background: var(--ck-bg); }
1880
- .ck-csv-table-wrap::-webkit-scrollbar-track {
1881
- background: var(--ck-bg);
1882
- border-left: 1px solid var(--ck-line);
1883
- border-top: 1px solid var(--ck-line);
1884
- }
1885
- .ck-csv-table-wrap::-webkit-scrollbar-thumb {
1886
- background: var(--ck-line-strong);
1887
- border-radius: 6px;
1888
- border: 3px solid var(--ck-bg);
1889
- }
1890
- .ck-csv-table-wrap::-webkit-scrollbar-thumb:hover { background: var(--ck-muted); }
1891
- .ck-csv-table-wrap::-webkit-scrollbar-corner { background: var(--ck-bg); }
1892
1896
 
1893
1897
  .ck-modal__body .ck-csv-table-wrap {
1894
1898
  margin-top: 0;
@@ -3197,6 +3201,7 @@ a.ck-metric-group-pill {
3197
3201
  white-space: nowrap;
3198
3202
  }
3199
3203
 
3204
+
3200
3205
  .ck-runs-table th {
3201
3206
  vertical-align: middle;
3202
3207
  white-space: nowrap;
@@ -3208,21 +3213,44 @@ a.ck-metric-group-pill {
3208
3213
  padding-bottom: 0.7rem;
3209
3214
  }
3210
3215
 
3216
+ .ck-runs-table th:first-child,
3217
+ .ck-runs-table td:first-child {
3218
+ width: 1%;
3219
+ }
3220
+
3211
3221
  .ck-runs-table th:nth-child(n+2),
3212
3222
  .ck-runs-table td:nth-child(n+2) {
3213
3223
  width: 1%;
3214
3224
  white-space: nowrap;
3215
3225
  }
3216
3226
 
3227
+ .ck-runs-table th:last-child,
3228
+ .ck-runs-table td:last-child {
3229
+ width: auto;
3230
+ }
3231
+
3217
3232
  .ck-runs-table__identity {
3218
3233
  display: flex;
3219
3234
  flex-direction: column;
3220
3235
  gap: 0.25rem;
3221
3236
  min-width: 0;
3237
+ width: 27rem;
3238
+ max-width: 100%;
3222
3239
  }
3223
3240
 
3224
3241
  .ck-runs-table .ck-run-name {
3225
3242
  line-height: 1.2;
3243
+ display: flex;
3244
+ align-items: center;
3245
+ gap: 0.5rem;
3246
+ min-width: 0;
3247
+ }
3248
+
3249
+ .ck-runs-table .ck-run-name strong {
3250
+ overflow: hidden;
3251
+ text-overflow: ellipsis;
3252
+ white-space: nowrap;
3253
+ min-width: 0;
3226
3254
  }
3227
3255
 
3228
3256
  .ck-runs-table__config {
@@ -179,6 +179,18 @@ module CompletionKit
179
179
  ["tag", "tag-#{tag.color}", ("tag-outline" if outline)].compact.join(" ")
180
180
  end
181
181
 
182
+ def ck_format_maybe_json(text)
183
+ s = text.to_s
184
+ return s if s.strip.empty?
185
+ first = s.strip[0]
186
+ return s unless first == "{" || first == "["
187
+ begin
188
+ JSON.pretty_generate(JSON.parse(s))
189
+ rescue JSON::ParserError
190
+ s
191
+ end
192
+ end
193
+
182
194
  def tag_filter_url(base_path, selected, toggling)
183
195
  remaining = selected.reject { |t| t.id == toggling.id }
184
196
  next_set = selected.include?(toggling) ? remaining : remaining + [toggling]
@@ -15,7 +15,7 @@ module CompletionKit
15
15
  return "Error: API key not configured" unless configured?
16
16
 
17
17
  model = options[:model] || "gpt-4.1-mini"
18
- max_tokens = options[:max_tokens] || 1000
18
+ max_tokens = options[:max_tokens] || 8192
19
19
  temperature = options[:temperature] || 0.7
20
20
 
21
21
  response = post_responses(model: model, prompt: prompt, max_tokens: max_tokens, temperature: temperature)
@@ -36,8 +36,14 @@ module CompletionKit
36
36
 
37
37
  if response.success?
38
38
  data = JSON.parse(response.body)
39
+ if data["status"] == "incomplete"
40
+ reason = data.dig("incomplete_details", "reason") || "unknown"
41
+ return "Error: response incomplete (#{reason}) — increase max_tokens=#{max_tokens} or pick a non-reasoning judge model"
42
+ end
39
43
  message = Array(data["output"]).find { |o| o["type"] == "message" }
40
- message&.dig("content", 0, "text").to_s.strip
44
+ content = message&.dig("content", 0, "text").to_s.strip
45
+ return "Error: model returned empty content" if content.empty?
46
+ content
41
47
  else
42
48
  "Error: #{response.status} - #{response.body}"
43
49
  end
@@ -13,7 +13,7 @@ module CompletionKit
13
13
  return "Error: API key not configured" unless configured?
14
14
 
15
15
  model = options[:model] || "openai/gpt-4o-mini"
16
- max_tokens = options[:max_tokens] || 1000
16
+ max_tokens = options[:max_tokens] || 8192
17
17
  temperature = options[:temperature] || 0.7
18
18
 
19
19
  response = post_chat(model: model, prompt: prompt, max_tokens: max_tokens, temperature: temperature)
@@ -34,7 +34,13 @@ module CompletionKit
34
34
 
35
35
  if response.success?
36
36
  data = JSON.parse(response.body)
37
- data.dig("choices", 0, "message", "content").to_s.strip
37
+ choice = data.dig("choices", 0) || {}
38
+ if choice["finish_reason"] == "length"
39
+ return "Error: response truncated by max_tokens=#{max_tokens} before visible content was emitted (reasoning model burned through the budget)"
40
+ end
41
+ content = choice.dig("message", "content").to_s.strip
42
+ return "Error: model returned empty content" if content.empty?
43
+ content
38
44
  else
39
45
  "Error: #{response.status} - #{response.body}"
40
46
  end
@@ -67,7 +67,7 @@
67
67
 
68
68
  <section>
69
69
  <p class="ck-kicker">Input</p>
70
- <pre class="ck-code ck-code--dark"><%= begin; JSON.pretty_generate(JSON.parse(@response.input_data)); rescue; @response.input_data; end %></pre>
70
+ <div class="ck-code-scroll-wrap"><pre class="ck-code"><%= ck_format_maybe_json(@response.input_data) %></pre></div>
71
71
  </section>
72
72
 
73
73
  <section class="ck-card--spaced">
@@ -77,13 +77,13 @@
77
77
  <span class="ck-chip ck-chip--soft" style="text-transform: none;"><%= @run.prompt.llm_model %></span>
78
78
  <% end %>
79
79
  </div>
80
- <pre class="ck-code"><%= @response.response_text %></pre>
80
+ <div class="ck-code-scroll-wrap"><pre class="ck-code"><%= ck_format_maybe_json(@response.response_text) %></pre></div>
81
81
  </section>
82
82
 
83
83
  <% if @response.expected_output.present? %>
84
84
  <section class="ck-card--spaced">
85
85
  <p class="ck-kicker">Expected</p>
86
- <pre class="ck-code"><%= @response.expected_output %></pre>
86
+ <div class="ck-code-scroll-wrap"><pre class="ck-code"><%= ck_format_maybe_json(@response.expected_output) %></pre></div>
87
87
  </section>
88
88
  <% end %>
89
89
 
@@ -1,3 +1,3 @@
1
1
  module CompletionKit
2
- VERSION = "0.5.12"
2
+ VERSION = "0.5.14"
3
3
  end
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.5.12
4
+ version: 0.5.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damien Bastin