completion-kit 0.22.1 → 0.23.0

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: 8756e61d60ec8f7176a03cf493a805a768eec6c28ac8a08c2afd648e2b790d5a
4
- data.tar.gz: 40269425f714c61fdd104723d38919ff88cf582d6b60429e14bbb295b08ab0a8
3
+ metadata.gz: a3952f21a923b362bd293e0cf32cc358b2e635e07124d9b4696e9c8a153b344e
4
+ data.tar.gz: 2c669f474bbb38dc79b5320b8323e9ac3e2ab9ff89664d9b149b204ebad71c14
5
5
  SHA512:
6
- metadata.gz: 45bd2bb7846161863bf23cf048cad679a2193c53f62c166c879b8f9d8c76b4210a8354d7544c63c272ea2b27e754faab9fe00be1212362ac921d07c64df2d79c
7
- data.tar.gz: e176db382a2102f23e215186842849eb5f4e515fa15ad9e6a041f2f0b22bed188f89ca0811fc1a00d51cc00cb447f33661e5f5bae5e3b218c461fa76f0e454e9
6
+ metadata.gz: 5c22d5b53cb2146ffd2c8bb9daee2d99410dd40ffe03d7547a89fe9ba73277094c666d9a657e0be69407dc5a2fcb6f66b2b8d7fae0d23568ee172c0d1affaa65
7
+ data.tar.gz: 95dc7384b03ecc1895ae908a0ced7b631d7fa124b22ae291bf02a1052547a63e18ebb6186db5449058eebee3ec9ef26ed20d163ce55891bf6dc98c1cfbb0b040
@@ -217,8 +217,7 @@ var CK_CHECK_FIELDS = {
217
217
  regex: ["pattern", "case_sensitive", "multiline"],
218
218
  valid_json: [],
219
219
  json_path_equals: ["json_path", "expected"],
220
- length_bounds: ["min", "max"],
221
- no_refusal: []
220
+ length_bounds: ["min", "max"]
222
221
  };
223
222
 
224
223
  var CK_VALUE_KINDS = ["contains", "not_contains", "equals"];
@@ -176,8 +176,7 @@ module CompletionKit
176
176
  "regex" => "Matches a pattern",
177
177
  "valid_json" => "Is valid JSON",
178
178
  "json_path_equals" => "A JSON field equals a value",
179
- "length_bounds" => "Length is within a range",
180
- "no_refusal" => "Is not a refusal"
179
+ "length_bounds" => "Length is within a range"
181
180
  }.freeze
182
181
 
183
182
  CHECK_COMPARE_TO_LABELS = {
@@ -8,8 +8,7 @@ module CompletionKit
8
8
  "regex" => Regex,
9
9
  "valid_json" => ValidJson,
10
10
  "json_path_equals" => JsonPathEquals,
11
- "length_bounds" => LengthBounds,
12
- "no_refusal" => NoRefusal
11
+ "length_bounds" => LengthBounds
13
12
  }.freeze
14
13
 
15
14
  REQUIRED_KEYS = {
@@ -19,8 +18,7 @@ module CompletionKit
19
18
  "regex" => %w[pattern],
20
19
  "valid_json" => [],
21
20
  "json_path_equals" => %w[json_path expected],
22
- "length_bounds" => [],
23
- "no_refusal" => []
21
+ "length_bounds" => []
24
22
  }.freeze
25
23
 
26
24
  VALUE_COMPARISON_KINDS = %w[contains not_contains equals].freeze
@@ -25,7 +25,7 @@ module CompletionKit
25
25
 
26
26
  CHECK_CONFIG_HINT = "For a deterministic check set metric_type:\"check\" and check_config. Per-kind required keys: " \
27
27
  "value (contains/not_contains/equals), pattern (regex), json_path+expected (json_path_equals), " \
28
- "min and/or max (length_bounds); valid_json and no_refusal take no extra keys. target_path is required when target is json_path. " \
28
+ "min and/or max (length_bounds); valid_json takes no extra keys. target_path is required when target is json_path. " \
29
29
  "For contains, not_contains, and equals, set compare_to:\"expected\" to grade against each row's own expected_output (ground truth) instead of a constant value (drop value); add expected_path to dig into the expected value when it is JSON."
30
30
 
31
31
  TOOLS = {
@@ -81,14 +81,6 @@ module CompletionKit
81
81
  metric_type: "check",
82
82
  check_config: { "check_kind" => "valid_json", "target" => "response_text" }
83
83
  ),
84
- Starter.new(
85
- key: "no_refusal",
86
- name: "No refusal",
87
- description: "Did the model answer instead of refusing?",
88
- catches: "\"I'm sorry, I can't help with that\" and other refusal boilerplate when a real answer was expected. Deterministic, no judge call.",
89
- metric_type: "check",
90
- check_config: { "check_kind" => "no_refusal", "target" => "response_text" }
91
- ),
92
84
  Starter.new(
93
85
  key: "contains_token",
94
86
  name: "Contains required token",
@@ -1,3 +1,3 @@
1
1
  module CompletionKit
2
- VERSION = "0.22.1"
2
+ VERSION = "0.23.0"
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.22.1
4
+ version: 0.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damien Bastin
@@ -305,7 +305,6 @@ files:
305
305
  - app/services/completion_kit/checks/expected_resolver.rb
306
306
  - app/services/completion_kit/checks/json_path_equals.rb
307
307
  - app/services/completion_kit/checks/length_bounds.rb
308
- - app/services/completion_kit/checks/no_refusal.rb
309
308
  - app/services/completion_kit/checks/not_contains.rb
310
309
  - app/services/completion_kit/checks/regex.rb
311
310
  - app/services/completion_kit/checks/registry.rb
@@ -1,23 +0,0 @@
1
- module CompletionKit
2
- module Checks
3
- class NoRefusal
4
- PATTERNS = [
5
- /\bi'?m sorry\b/i,
6
- /\bi can'?t (?:help|assist|comply|do that|provide)/i,
7
- /\bi (?:cannot|can'?t) (?:help|assist|fulfill|comply|provide)/i,
8
- /\bi'?m (?:unable|not able) to\b/i,
9
- /\bi (?:won'?t|will not) (?:be able|help|assist)\b/i,
10
- /\bas an ai\b/i
11
- ].freeze
12
-
13
- def call(target, _config)
14
- text = target.to_s
15
- if PATTERNS.any? { |pattern| pattern.match?(text) }
16
- Result.new(passed: false, detail: "refusal detected")
17
- else
18
- Result.new(passed: true, detail: "no refusal detected")
19
- end
20
- end
21
- end
22
- end
23
- end