Module: RubyLLM::Tribunal::Dataset
- Defined in:
- lib/ruby_llm/tribunal/dataset.rb
Overview
Loads evaluation datasets from JSON or YAML files.
Class Method Summary collapse
-
.load(path) ⇒ Array<TestCase>
Loads a dataset from a file path.
-
.load_with_assertions(path) ⇒ Array<Array(TestCase, Array)>
Loads a dataset and extracts assertions per test case.
Class Method Details
.load(path) ⇒ Array<TestCase>
Loads a dataset from a file path.
34 35 36 37 38 |
# File 'lib/ruby_llm/tribunal/dataset.rb', line 34 def load(path) content = File.read(path) data = parse(path, content) data.map { |item| to_test_case(item) } end |
.load_with_assertions(path) ⇒ Array<Array(TestCase, Array)>
Loads a dataset and extracts assertions per test case.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/ruby_llm/tribunal/dataset.rb', line 44 def load_with_assertions(path) content = File.read(path) data = parse(path, content) data.map do |item| test_case = to_test_case(item) assertions = extract_assertions(item) [test_case, assertions] end end |