completion-kit 0.28.13 → 0.28.15

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: 8fd0c0ae71e91259bf81180d4bdd030347ba217319a0797fcdc232935c69059c
4
- data.tar.gz: b197933938b035b437003a79edae4c6e24dd1b3b6358cd68aefe09dd532e0272
3
+ metadata.gz: 5a20d91f5d5238d9e197866ec1e44c7eee4668ebfdf3e119f849a9d0066056cd
4
+ data.tar.gz: 4e4ddf23dddcd3913756dc3df7fa6eb0ee896f902c81d20dabf8ec361cdbcf6b
5
5
  SHA512:
6
- metadata.gz: b2cba5a66eaa853170c2fe6a49d06e6580ce6c2f486f4ab4de300e755003de1901768630636da3193bab620285241a6627b2aada9e37f5bcf3e6f68b3ebc558f
7
- data.tar.gz: 82e6d15883cda2a972f1068cf0127102becff52a6f7ff73de65cd62bd0a3d34147cbd8ecff4a836b8077092005d40ee4e24dd1d7077a7aee3c0ff97c9c799dd4
6
+ metadata.gz: 5cf6c757cc4574866668f854220740428245c05f99174d8551bfdfdd58110ed1d8714f8bde0c9c65b27e2ceb3cffe0d2e43478fcc5039cc27e7c5e4628244856
7
+ data.tar.gz: 97c2689b0dffdc7ac2a55a3ee7d8354cebae320aa5a7fa23816572a44e3a1414d006c20214e8e3887040731db3d38eb3b45380189bea775defdb31cc88c5f7ef
@@ -3874,7 +3874,8 @@ select.ck-input {
3874
3874
 
3875
3875
  .ck-prompts-table th:nth-child(1), .ck-prompts-table td:nth-child(1) { width: auto; }
3876
3876
  .ck-prompts-table th:nth-child(2), .ck-prompts-table td:nth-child(2) { width: 6rem; white-space: nowrap; }
3877
- .ck-prompts-table th:nth-child(3), .ck-prompts-table td:nth-child(3) { width: 12rem; white-space: nowrap; }
3877
+ .ck-prompts-table th:nth-child(3), .ck-prompts-table td:nth-child(3) { width: 15.5rem; white-space: nowrap; overflow: hidden; }
3878
+ .ck-prompts-table td:nth-child(3) .ck-chip { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
3878
3879
  .ck-prompts-table th:nth-child(4), .ck-prompts-table td:nth-child(4) { width: 7.5rem; white-space: nowrap; }
3879
3880
  .ck-prompts-table th:nth-child(5), .ck-prompts-table td:nth-child(5) { width: 7.5rem; white-space: nowrap; }
3880
3881
  .ck-prompts-table th:nth-child(6), .ck-prompts-table td:nth-child(6) { width: 3rem; }
@@ -9,7 +9,7 @@ module CompletionKit
9
9
 
10
10
  def show
11
11
  @runs = Run.where(prompt_id: @prompt.family_versions.select(:id))
12
- .includes(:prompt, :dataset, responses: :reviews)
12
+ .includes(:prompt, :dataset, :tags, responses: :reviews)
13
13
  .order(created_at: :desc)
14
14
  .display_scoped
15
15
  end
@@ -117,7 +117,12 @@ module CompletionKit
117
117
  end
118
118
 
119
119
  def reviews_for_summary
120
- @reviews_for_summary ||= Review.where(response_id: responses.select(:id)).to_a
120
+ @reviews_for_summary ||=
121
+ if responses.loaded? && responses.all? { |response| response.association(:reviews).loaded? }
122
+ responses.flat_map(&:reviews)
123
+ else
124
+ Review.where(response_id: responses.select(:id)).to_a
125
+ end
121
126
  end
122
127
 
123
128
  def avg_score
@@ -35,7 +35,7 @@
35
35
  <section class="ck-card--spaced">
36
36
  <div class="ck-prompt-preview__header">
37
37
  <p class="ck-kicker">Prompt</p>
38
- <% judged_run = @runs.select { |r| r.prompt_id == @prompt.id && r.status == "completed" }.find { |r| r.responses.joins(:reviews).exists? } %>
38
+ <% judged_run = @runs.select { |r| r.prompt_id == @prompt.id && r.status == "completed" }.find { |r| r.responses.any? { |resp| resp.reviews.any? } } %>
39
39
  <% if judged_run %>
40
40
  <%= button_to suggest_run_path(judged_run), method: :post, class: ck_button_classes(:light, variant: :outline) + " ck-button--sm", form_class: "inline-block" do %>
41
41
  <%= heroicon_tag "sparkles", variant: :outline, class: "ck-magic-icon", "aria-hidden": "true" %>
@@ -48,7 +48,8 @@
48
48
  <pre class="ck-code ck-code--dark ck-code--prompt"><%= @prompt.template %></pre>
49
49
  </section>
50
50
 
51
- <% versions = @prompt.family_versions.includes(runs: { responses: :reviews }).to_a %>
51
+ <% versions = @prompt.family_versions.to_a %>
52
+ <% runs_by_version = @runs.group_by(&:prompt_id) %>
52
53
  <% predecessor_of = versions.index_with { |v| versions.detect { |o| o.version_number < v.version_number } } %>
53
54
  <% version_changed = ->(v, pred) { pred && (pred.template != v.template || pred.llm_model != v.llm_model) } %>
54
55
  <% if versions.size > 1 %>
@@ -65,7 +66,7 @@
65
66
  </thead>
66
67
  <tbody>
67
68
  <% versions.each do |v| %>
68
- <% scoped_runs = v.runs.display_scoped %>
69
+ <% scoped_runs = runs_by_version[v.id] || [] %>
69
70
  <% best_score = scoped_runs.map(&:avg_score).compact.max %>
70
71
  <% best_pass_rate = scoped_runs.map(&:check_pass_rate).compact.max %>
71
72
  <% pred = predecessor_of[v] %>
@@ -1,3 +1,3 @@
1
1
  module CompletionKit
2
- VERSION = "0.28.13"
2
+ VERSION = "0.28.15"
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.28.13
4
+ version: 0.28.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damien Bastin