rubric_llm 0.3.0 → 0.4.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: 4afa554e2e9ae10520d0cc605f55d59cdc6330c7ba65f38c4d3e933fb11519a4
4
- data.tar.gz: e371eaaf0ab368c46d930e352434664bca19315bfc45865601686b0a5525ca5a
3
+ metadata.gz: 16ccb30778e4ace0b35900e0d488ac884042acf124e139181e4e364a6a5829ed
4
+ data.tar.gz: f5c1df6b47de48bd4c976a9986836aa2d2c66c6614dc94e4b6f4f8b12c090144
5
5
  SHA512:
6
- metadata.gz: f635136ea65b903555493b377a14d5902b2be949ef7bc77b036450ac25d8ead70429039c5f47ffdc36c2216470e39409ceb50f35c609df8f4e5648b64569fa38
7
- data.tar.gz: a66697e131141d27ff0c406fdd60b6ef103c4c69cce3b85a3c5cf481cbdf55cc489983b10e94ffe7557ab0a637a8c09530e9cd0f317e16e092496862574fed1c
6
+ metadata.gz: d267c7eceba64ebf8b9f5829b960ebf45aaec98bbd8545a393f16f8dfdf0070fb98ee8038e0fe9ddb1428164bbbcb677b6e8da0afa86513865187a358aad45a7
7
+ data.tar.gz: d0fff2333050e27bb785820f128ebaee7161f15e446f728beffbe2744078d95cd0de077b4a2674b26d8136391ee9c977f5cc87a1608f48ff96d9e0ed8cd04dd8
data/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.4.0] - 2026-07-11
9
+
10
+ ### Added
11
+
12
+ - `RubricLLM.evaluate_batch` validates every sample upfront (must be a Hash with non-nil `:question` and `:answer`, string or symbol keys) and raises `ArgumentError` with the offending index before any LLM call, so sequential and concurrent modes fail identically and without API spend
13
+
14
+ ### Changed
15
+
16
+ - Add `csv` as a runtime dependency; `csv` moved from a default gem to a bundled gem in Ruby 3.4, so consumers previously hit a `LoadError` on `Report#export_csv`
17
+ - Require `ruby_llm ~> 1.16`
18
+
8
19
  ## [0.3.0] - 2026-07-11
9
20
 
10
21
  ### Changed
@@ -42,7 +42,7 @@ module RubricLLM
42
42
  end
43
43
 
44
44
  def export_csv(path)
45
- require "csv" # optional dependency — add `gem "csv"` to your Gemfile if missing
45
+ require "csv"
46
46
  metrics = all_metric_names
47
47
  CSV.open(path, "w") do |csv|
48
48
  csv << ["question", "answer", "overall", *metrics]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubricLLM
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
data/lib/rubric_llm.rb CHANGED
@@ -56,6 +56,7 @@ module RubricLLM
56
56
  # report = RubricLLM.evaluate_batch(dataset)
57
57
  # report = RubricLLM.evaluate_batch(dataset, concurrency: 4)
58
58
  def evaluate_batch(dataset, metrics: nil, config: self.config, custom_prompt: nil, concurrency: nil)
59
+ validate_dataset!(dataset)
59
60
  config = apply_custom_prompt(config, custom_prompt)
60
61
  pool_size = concurrency || config.concurrency
61
62
  start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
@@ -87,6 +88,22 @@ module RubricLLM
87
88
 
88
89
  private
89
90
 
91
+ def validate_dataset!(dataset)
92
+ dataset.each_with_index do |sample, index|
93
+ raise ArgumentError, "sample at index #{index} is not a Hash" unless sample.is_a?(Hash)
94
+
95
+ question_present = sample.key?(:question) || sample.key?("question")
96
+ answer_present = sample.key?(:answer) || sample.key?("answer")
97
+ raise ArgumentError, "sample at index #{index} is missing :question" unless question_present
98
+ raise ArgumentError, "sample at index #{index} is missing :answer" unless answer_present
99
+
100
+ question_provided = !sample[:question].nil? || !sample["question"].nil?
101
+ answer_provided = !sample[:answer].nil? || !sample["answer"].nil?
102
+ raise ArgumentError, "sample at index #{index} has nil :question" unless question_provided
103
+ raise ArgumentError, "sample at index #{index} has nil :answer" unless answer_provided
104
+ end
105
+ end
106
+
90
107
  def evaluate_sample(evaluator, sample)
91
108
  sample = normalize_sample(sample)
92
109
  evaluator.call(
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubric_llm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Paluy
@@ -9,20 +9,34 @@ bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: csv
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
12
26
  - !ruby/object:Gem::Dependency
13
27
  name: ruby_llm
14
28
  requirement: !ruby/object:Gem::Requirement
15
29
  requirements:
16
30
  - - "~>"
17
31
  - !ruby/object:Gem::Version
18
- version: '1.13'
32
+ version: '1.16'
19
33
  type: :runtime
20
34
  prerelease: false
21
35
  version_requirements: !ruby/object:Gem::Requirement
22
36
  requirements:
23
37
  - - "~>"
24
38
  - !ruby/object:Gem::Version
25
- version: '1.13'
39
+ version: '1.16'
26
40
  description: Provider-agnostic LLM evaluation with pluggable metrics, statistical
27
41
  A/B comparison, and test framework integration. Ragas for Ruby, powered by RubyLLM.
28
42
  email: