completion-kit 0.28.23 → 0.28.24
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/models/completion_kit/metric.rb +1 -0
- data/app/models/completion_kit/run.rb +17 -2
- data/lib/completion_kit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 84d83f7eb0d478096935bae36f7f274a99aeccf105f4ba7a02243dde5aa0e236
|
|
4
|
+
data.tar.gz: 78ae0b7e08b138cebdc97a09b6d97d0972169bc323bcbc5060c76cf06c754156
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 980fbda1a34e14c268ec20c5d4401448cd695503af3edef039c77a78033bb984be7f3d92336847cad328545d5342ae6a4d6982f5b777bd48b86196d0a2aac0f7
|
|
7
|
+
data.tar.gz: 93857d377169c454de5c46bc865e7022febe6b728af513d66a856e3985144e3f6e3b4ed7829306d13c36e0b445e3c0ba44fb476ba5588e98e771737c3e02e4f1
|
|
@@ -25,6 +25,7 @@ module CompletionKit
|
|
|
25
25
|
validates :name, presence: true
|
|
26
26
|
validates :key, tenant_scoped_uniqueness: { allow_nil: true }
|
|
27
27
|
validates :metric_type, inclusion: { in: METRIC_TYPES }
|
|
28
|
+
validates :instruction, presence: { message: "can't be blank. An LLM judge needs a rubric to score against." }, if: :llm_judge?
|
|
28
29
|
validate :validate_check_config, if: :check?
|
|
29
30
|
validate :metric_type_immutable_once_in_use, on: :update
|
|
30
31
|
|
|
@@ -105,8 +105,12 @@ module CompletionKit
|
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
def mark_completed!
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
if all_responses_failed?
|
|
109
|
+
fail_with_summary!(all_failed_summary)
|
|
110
|
+
else
|
|
111
|
+
update!(status: "completed")
|
|
112
|
+
broadcast_ui
|
|
113
|
+
end
|
|
110
114
|
end
|
|
111
115
|
|
|
112
116
|
def gradable_metric_ids
|
|
@@ -565,6 +569,17 @@ module CompletionKit
|
|
|
565
569
|
false
|
|
566
570
|
end
|
|
567
571
|
|
|
572
|
+
def all_responses_failed?
|
|
573
|
+
responses.exists? && !responses.where.not(status: "failed").exists?
|
|
574
|
+
end
|
|
575
|
+
|
|
576
|
+
def all_failed_summary
|
|
577
|
+
total = responses.count
|
|
578
|
+
reason = responses.where(status: "failed").where.not(error_message: [nil, ""]).order(:row_index).limit(1).pick(:error_message)
|
|
579
|
+
head = "Every response failed to generate (#{total} of #{total})."
|
|
580
|
+
reason.present? ? "#{head} First error: #{reason}" : "#{head} Check the model and provider configuration."
|
|
581
|
+
end
|
|
582
|
+
|
|
568
583
|
def render_engine_partial(partial, locals)
|
|
569
584
|
CompletionKit::Engine.warm_routes!
|
|
570
585
|
CompletionKit::ApplicationController.render(
|