completion-kit 0.20.0 → 0.20.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cac78086fc976119ea178522cac6da086f68361ba85cbf77d8f70fa95e4fb4c2
|
|
4
|
+
data.tar.gz: ad85761d75484cf33d3043261cb6aba30f82c65b2d81bea2e7e297d12e14d610
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5a197c30cf0d176054a05acaeb2e0e52cff1498dd6e09f709dbb696f31a437a307903d5855a406d784fbe4a8cf4c8bd58eff206677eadc83888da511bb27ca23
|
|
7
|
+
data.tar.gz: f91ffc1f03adf3801dccbef84c74022b9b946c359af5ce914dde957f78ef0101a2888998d14047450a827fad275e608a694fb7fcf691371849392d6701aa927f
|
|
@@ -42,7 +42,7 @@ module CompletionKit
|
|
|
42
42
|
return
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
disagreement_count = Agreement.where(metric_id: @metric.id, verdict: "disagree").count
|
|
45
|
+
disagreement_count = Agreement.where(metric_id: @metric.id, verdict: "disagree", run_id: CompletionKit::Run.visible_run_ids).count
|
|
46
46
|
if disagreement_count.zero?
|
|
47
47
|
render_error("Mark at least one case as Disagree before asking the model to suggest a change.", status: :unprocessable_entity)
|
|
48
48
|
return
|
|
@@ -46,7 +46,7 @@ module CompletionKit
|
|
|
46
46
|
@improve_disagreement_count = 0
|
|
47
47
|
@guiding_examples = []
|
|
48
48
|
else
|
|
49
|
-
@improve_disagreement_count = Agreement.where(metric_id: @metric.id, verdict: "disagree").count
|
|
49
|
+
@improve_disagreement_count = Agreement.where(metric_id: @metric.id, verdict: "disagree", run_id: CompletionKit::Run.visible_run_ids).count
|
|
50
50
|
@guiding_examples = CompletionKit.config.judge_examples_from_reviews ? MetricAgreementExamples.judge_examples_for(@metric) : []
|
|
51
51
|
end
|
|
52
52
|
end
|
|
@@ -59,7 +59,7 @@ module CompletionKit
|
|
|
59
59
|
@suggestion_draft = MetricVersion.drafts.where(metric_id: @metric.id, source: "suggestion").order(created_at: :desc).first
|
|
60
60
|
@edit_draft = MetricVersion.drafts.where(metric_id: @metric.id, source: "edit").order(created_at: :desc).first
|
|
61
61
|
@published_metric_version = MetricVersion.published.where(metric_id: @metric.id, current: true).first
|
|
62
|
-
@improve_disagreement_count = @metric.check? ? 0 : Agreement.where(metric_id: @metric.id, verdict: "disagree").count
|
|
62
|
+
@improve_disagreement_count = @metric.check? ? 0 : Agreement.where(metric_id: @metric.id, verdict: "disagree", run_id: CompletionKit::Run.visible_run_ids).count
|
|
63
63
|
|
|
64
64
|
if @edit_draft
|
|
65
65
|
@metric.instruction = @edit_draft.instruction
|
|
@@ -103,7 +103,7 @@ module CompletionKit
|
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
target = params[:back_to] == "edit" ? edit_metric_path(@metric) : metric_path(@metric)
|
|
106
|
-
counts = Agreement.where(metric_id: @metric.id, verdict: %w[agree disagree]).group(:verdict).count
|
|
106
|
+
counts = Agreement.where(metric_id: @metric.id, verdict: %w[agree disagree], run_id: CompletionKit::Run.visible_run_ids).group(:verdict).count
|
|
107
107
|
if counts["disagree"].to_i.zero?
|
|
108
108
|
redirect_to target, alert: "Mark at least one case as Disagree before asking the model to suggest a change."
|
|
109
109
|
return
|
|
@@ -7,7 +7,7 @@ module CompletionKit
|
|
|
7
7
|
# can render a fixed-width sparkline.
|
|
8
8
|
def self.activity(days: 14)
|
|
9
9
|
since = (days - 1).days.ago.to_date
|
|
10
|
-
counts = Run.where("created_at >= ?", since.beginning_of_day)
|
|
10
|
+
counts = Run.display_scoped.where("created_at >= ?", since.beginning_of_day)
|
|
11
11
|
.group("DATE(created_at)")
|
|
12
12
|
.count
|
|
13
13
|
(0...days).map do |offset|
|
|
@@ -62,6 +62,7 @@ module CompletionKit
|
|
|
62
62
|
resolved = Review.joins(:response)
|
|
63
63
|
.where(metric_id: metric_id)
|
|
64
64
|
.where("completion_kit_reviews.created_at >= ?", since)
|
|
65
|
+
.where(completion_kit_responses: { run_id: Run.visible_run_ids })
|
|
65
66
|
.where.not(passed: nil)
|
|
66
67
|
total = resolved.count
|
|
67
68
|
return nil if total.zero?
|
|
@@ -72,6 +73,8 @@ module CompletionKit
|
|
|
72
73
|
def self.failing_checks(since:)
|
|
73
74
|
reviews = Review.where(passed: false)
|
|
74
75
|
.where("completion_kit_reviews.created_at >= ?", since)
|
|
76
|
+
.joins(:response)
|
|
77
|
+
.where(completion_kit_responses: { run_id: Run.visible_run_ids })
|
|
75
78
|
.includes(response: :run)
|
|
76
79
|
.order(updated_at: :desc)
|
|
77
80
|
items = reviews.map do |review|
|
|
@@ -89,7 +92,7 @@ module CompletionKit
|
|
|
89
92
|
dismissed = failure_dismissal_keys
|
|
90
93
|
items = []
|
|
91
94
|
|
|
92
|
-
Run.where(status: "failed").where("created_at >= ?", since).find_each do |run|
|
|
95
|
+
Run.display_scoped.where(status: "failed").where("created_at >= ?", since).find_each do |run|
|
|
93
96
|
next if dismissed.include?(["CompletionKit::Run", run.id])
|
|
94
97
|
items << {
|
|
95
98
|
surface: "run", record: run, run: run,
|
|
@@ -98,6 +101,7 @@ module CompletionKit
|
|
|
98
101
|
end
|
|
99
102
|
|
|
100
103
|
Response.where(status: "failed").where("created_at >= ?", since)
|
|
104
|
+
.where(run_id: Run.visible_run_ids)
|
|
101
105
|
.includes(:run).find_each do |response|
|
|
102
106
|
next if dismissed.include?(["CompletionKit::Response", response.id])
|
|
103
107
|
items << {
|
|
@@ -107,6 +111,8 @@ module CompletionKit
|
|
|
107
111
|
end
|
|
108
112
|
|
|
109
113
|
Review.where(status: "failed").where("completion_kit_reviews.created_at >= ?", since)
|
|
114
|
+
.joins(:response)
|
|
115
|
+
.where(completion_kit_responses: { run_id: Run.visible_run_ids })
|
|
110
116
|
.includes(response: :run).find_each do |review|
|
|
111
117
|
next if dismissed.include?(["CompletionKit::Review", review.id])
|
|
112
118
|
items << {
|
|
@@ -132,6 +138,7 @@ module CompletionKit
|
|
|
132
138
|
scores = Review.joins(response: :run)
|
|
133
139
|
.where(status: "succeeded")
|
|
134
140
|
.where.not(ai_score: nil)
|
|
141
|
+
.where(completion_kit_responses: { run_id: Run.visible_run_ids })
|
|
135
142
|
.group("completion_kit_runs.prompt_id")
|
|
136
143
|
.average(:ai_score)
|
|
137
144
|
return [] if scores.empty?
|
|
@@ -167,6 +174,7 @@ module CompletionKit
|
|
|
167
174
|
Review.joins(:response)
|
|
168
175
|
.where(status: "succeeded")
|
|
169
176
|
.where("completion_kit_reviews.created_at >= ?", since)
|
|
177
|
+
.where(completion_kit_responses: { run_id: Run.visible_run_ids })
|
|
170
178
|
.where.not(ai_score: nil)
|
|
171
179
|
end
|
|
172
180
|
private_class_method :scored_reviews_since
|