Class: OmniAgent::Eval::Case
- Inherits:
-
Object
- Object
- OmniAgent::Eval::Case
- Defined in:
- lib/omni_agent/eval/case.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #configured_assertions ⇒ Object
- #configured_context ⇒ Object
- #configured_input ⇒ Object
- #configured_run_alias ⇒ Object
- #expect_output(to_include: nil, to_match: nil, &block) ⇒ Object
- #expect_tool_call(tool_name, with: nil) ⇒ Object
-
#initialize(name, input: nil, context: {}, run_alias: nil, row: nil, &block) ⇒ Case
constructor
A new instance of Case.
- #input(text, with: {}) ⇒ Object
- #judge(criteria, threshold: 0.7, provider: nil, model: nil) ⇒ Object
- #run_alias(name) ⇒ Object
Constructor Details
#initialize(name, input: nil, context: {}, run_alias: nil, row: nil, &block) ⇒ Case
Returns a new instance of Case.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/omni_agent/eval/case.rb', line 6 def initialize(name, input: nil, context: {}, run_alias: nil, row: nil, &block) @name = name @input = input @context = context || {} @run_alias = run_alias @assertions = [] if block row.nil? ? instance_eval(&block) : instance_exec(row, &block) end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/omni_agent/eval/case.rb', line 4 def name @name end |
Instance Method Details
#configured_assertions ⇒ Object
51 52 53 |
# File 'lib/omni_agent/eval/case.rb', line 51 def configured_assertions @assertions end |
#configured_context ⇒ Object
43 44 45 |
# File 'lib/omni_agent/eval/case.rb', line 43 def configured_context @context end |
#configured_input ⇒ Object
39 40 41 |
# File 'lib/omni_agent/eval/case.rb', line 39 def configured_input @input end |
#configured_run_alias ⇒ Object
47 48 49 |
# File 'lib/omni_agent/eval/case.rb', line 47 def configured_run_alias @run_alias end |
#expect_output(to_include: nil, to_match: nil, &block) ⇒ Object
31 32 33 |
# File 'lib/omni_agent/eval/case.rb', line 31 def expect_output(to_include: nil, to_match: nil, &block) @assertions << OutputAssertion.new(to_include: to_include, to_match: to_match, &block) end |
#expect_tool_call(tool_name, with: nil) ⇒ Object
27 28 29 |
# File 'lib/omni_agent/eval/case.rb', line 27 def expect_tool_call(tool_name, with: nil) @assertions << ToolCallAssertion.new(tool_name, with: with) end |
#input(text, with: {}) ⇒ Object
18 19 20 21 |
# File 'lib/omni_agent/eval/case.rb', line 18 def input(text, with: {}) @input = text @context = with || {} end |
#judge(criteria, threshold: 0.7, provider: nil, model: nil) ⇒ Object
35 36 37 |
# File 'lib/omni_agent/eval/case.rb', line 35 def judge(criteria, threshold: 0.7, provider: nil, model: nil) @assertions << JudgeAssertion.new(criteria, threshold: threshold, provider: provider, model: model) end |
#run_alias(name) ⇒ Object
23 24 25 |
# File 'lib/omni_agent/eval/case.rb', line 23 def run_alias(name) @run_alias = name end |