completion-kit 0.28.37 → 0.28.39
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: c3f438ee1d22fb6ef2b93af5db0802335c162bd61209ef1cd7ebdad82e3956e1
|
|
4
|
+
data.tar.gz: b893015507fe05d66a3274191e559d0983943e3293d97d2f99c098ef04a08231
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 32f2758f6a521c7121df79319c870b80145b6bef889a4d0eb29a0cd1516af02db478faf3f78a70d2f8bd08dc320dba6ccd303a19b790afa2ab1a1b52044a8ed0
|
|
7
|
+
data.tar.gz: db71150f73c7294b531398dc4bcfb392c6a5afb6ba736d37bfd8c1cfd3c94509013492376afc9d0ec17ee766d998a8cf99466aacb51eb87ff0d8261f3024e6cc
|
|
@@ -3247,11 +3247,15 @@ select.ck-input {
|
|
|
3247
3247
|
flex-wrap: wrap;
|
|
3248
3248
|
align-items: flex-start;
|
|
3249
3249
|
}
|
|
3250
|
+
/* The column is sized by the button, which never wraps, so min-content
|
|
3251
|
+
resolves to the button's own width and the note wraps underneath it. A
|
|
3252
|
+
fixed cap sized the column for the note instead, which let the wider
|
|
3253
|
+
button overflow and swallow the gap between the two actions. */
|
|
3250
3254
|
.ck-banner-action {
|
|
3251
3255
|
display: flex;
|
|
3252
3256
|
flex-direction: column;
|
|
3253
|
-
gap: 0.
|
|
3254
|
-
|
|
3257
|
+
gap: 0.4rem;
|
|
3258
|
+
width: min-content;
|
|
3255
3259
|
}
|
|
3256
3260
|
.ck-banner-action__note {
|
|
3257
3261
|
margin: 0;
|
|
@@ -57,10 +57,14 @@ module CompletionKit
|
|
|
57
57
|
def fully_reviewed?
|
|
58
58
|
metric_ids = run.metric_ids
|
|
59
59
|
return true if metric_ids.empty?
|
|
60
|
-
reviewed_metric_ids = reviews.select { |review|
|
|
60
|
+
reviewed_metric_ids = reviews.select { |review| review.status == "succeeded" }.map(&:metric_id).uniq
|
|
61
61
|
(metric_ids - reviewed_metric_ids).empty?
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
+
def scoring_failed?
|
|
65
|
+
reviews.any? { |review| review.status == "failed" }
|
|
66
|
+
end
|
|
67
|
+
|
|
64
68
|
private
|
|
65
69
|
|
|
66
70
|
def requires_response_text?
|
|
@@ -5,6 +5,12 @@ module CompletionKit
|
|
|
5
5
|
|
|
6
6
|
STATUSES = %w[pending running completed failed].freeze
|
|
7
7
|
INSERT_BATCH_SIZE = 1000
|
|
8
|
+
REVIEW_RETRY_RESET = {
|
|
9
|
+
status: "pending",
|
|
10
|
+
attempts: 0,
|
|
11
|
+
error_provider: nil, error_class: nil, error_status: nil, error_message: nil,
|
|
12
|
+
ai_score: nil, passed: nil, ai_feedback: nil
|
|
13
|
+
}.freeze
|
|
8
14
|
|
|
9
15
|
belongs_to :prompt, optional: true
|
|
10
16
|
belongs_to :dataset, optional: true
|
|
@@ -492,15 +498,21 @@ module CompletionKit
|
|
|
492
498
|
def retry_failures!(only: nil)
|
|
493
499
|
scope = responses.where(status: "failed")
|
|
494
500
|
scope = scope.where(id: only) if only.present?
|
|
501
|
+
failed_response_ids = scope.pluck(:id)
|
|
502
|
+
|
|
503
|
+
# A response can generate fine and still have a review blow up, so those
|
|
504
|
+
# reviews are retryable on their own without regenerating the response.
|
|
505
|
+
unscored = Review.where(status: "failed")
|
|
506
|
+
.where.not(metric_id: nil)
|
|
507
|
+
.where(response_id: responses.where(status: "succeeded").select(:id))
|
|
508
|
+
unscored = unscored.where(response_id: only) if only.present?
|
|
509
|
+
unscored_pairs = unscored.pluck(:response_id, :metric_id)
|
|
510
|
+
|
|
511
|
+
return self if failed_response_ids.empty? && unscored_pairs.empty?
|
|
495
512
|
|
|
496
513
|
transaction do
|
|
497
|
-
failed_response_ids
|
|
498
|
-
|
|
499
|
-
status: "pending",
|
|
500
|
-
attempts: 0,
|
|
501
|
-
error_provider: nil, error_class: nil, error_status: nil, error_message: nil,
|
|
502
|
-
ai_score: nil, passed: nil, ai_feedback: nil
|
|
503
|
-
)
|
|
514
|
+
Review.where(response_id: failed_response_ids, status: "failed").update_all(REVIEW_RETRY_RESET)
|
|
515
|
+
unscored.update_all(REVIEW_RETRY_RESET)
|
|
504
516
|
scope.update_all(
|
|
505
517
|
status: "pending",
|
|
506
518
|
attempts: 0,
|
|
@@ -509,10 +521,25 @@ module CompletionKit
|
|
|
509
521
|
)
|
|
510
522
|
update!(status: "running")
|
|
511
523
|
failed_response_ids.each { |rid| GenerateRowJob.perform_later(id, rid) }
|
|
524
|
+
enqueue_review_retries(unscored_pairs)
|
|
512
525
|
end
|
|
513
526
|
self
|
|
514
527
|
end
|
|
515
528
|
|
|
529
|
+
def enqueue_review_retries(pairs)
|
|
530
|
+
return if pairs.empty?
|
|
531
|
+
|
|
532
|
+
kinds = Metric.where(id: pairs.map(&:last).uniq).pluck(:id, :metric_type).to_h
|
|
533
|
+
pairs.each do |response_id, metric_id|
|
|
534
|
+
if kinds[metric_id] == "check"
|
|
535
|
+
CheckReviewJob.perform_later(response_id, metric_id, id)
|
|
536
|
+
else
|
|
537
|
+
JudgeReviewJob.perform_later(response_id, metric_id, id)
|
|
538
|
+
end
|
|
539
|
+
end
|
|
540
|
+
RunCompletionCheckJob.perform_later(id)
|
|
541
|
+
end
|
|
542
|
+
|
|
516
543
|
def progress_snapshot
|
|
517
544
|
generated_done = responses.where(status: "succeeded").count
|
|
518
545
|
generated_failed = responses.where(status: "failed").count
|
|
@@ -54,7 +54,9 @@
|
|
|
54
54
|
<span class="ck-chip ck-chip--warning">Retrying <%= response.attempts %>/5</span>
|
|
55
55
|
<% end %>
|
|
56
56
|
<% when "succeeded" %>
|
|
57
|
-
<% if response.
|
|
57
|
+
<% if response.scoring_failed? && run.status != "running" %>
|
|
58
|
+
<span class="ck-chip ck-chip--danger">Failed</span>
|
|
59
|
+
<% elsif response.fully_reviewed? %>
|
|
58
60
|
<span class="ck-chip ck-chip--done">Done</span>
|
|
59
61
|
<% elsif run.status == "running" %>
|
|
60
62
|
<span class="ck-chip">Judging</span>
|