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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c5b5a45e20e1884194db7473fa6bc44e75b33b919d1790dfa240f2e3902bd48
4
- data.tar.gz: c6eeabc0e477591231895f42868514d50363b34834967d0088593e360ccaf04b
3
+ metadata.gz: 84d83f7eb0d478096935bae36f7f274a99aeccf105f4ba7a02243dde5aa0e236
4
+ data.tar.gz: 78ae0b7e08b138cebdc97a09b6d97d0972169bc323bcbc5060c76cf06c754156
5
5
  SHA512:
6
- metadata.gz: b604a731fd81ba9c6aadd87f00e5a0b7665685df4651a3fca27e2995375cfcac7a48ef8860ba573abd3af612fd4cdee1224ec804a0fbd57a7bdbee50bd996684
7
- data.tar.gz: 566e496833459b9f16e8c19251e4847d71c917e14bdb408fee2f5d08252aa542a554a4578fbcc9dfbc62e53e89c288745eda4a1cbadd78310b86d10c70b96b85
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
- update!(status: "completed")
109
- broadcast_ui
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(
@@ -1,3 +1,3 @@
1
1
  module CompletionKit
2
- VERSION = "0.28.23"
2
+ VERSION = "0.28.24"
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.23
4
+ version: 0.28.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damien Bastin