Module: Braintrust::Eval::Scorer Deprecated

Defined in:
lib/braintrust/eval/scorer.rb

Overview

Deprecated.

Use Scorer instead.

Defined Under Namespace

Modules: PositionalArgsRemapping

Class Method Summary collapse

Class Method Details

.new(name_or_callable = nil, callable = nil, &block) ⇒ Object

Deprecated.

Use Scorer.new instead.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/braintrust/eval/scorer.rb', line 10

def self.new(name_or_callable = nil, callable = nil, &block)
  Log.warn_once(:eval_scorer_class, "Braintrust::Eval::Scorer is deprecated: use Braintrust::Scorer.new instead.")

  if name_or_callable.is_a?(String) || name_or_callable.is_a?(Symbol)
    name = name_or_callable.to_s
    block = callable.method(:call) if callable && !block
  else
    resolved = name_or_callable || callable
    block = resolved.method(:call) if resolved && !block
    name = nil
  end

  scorer = Braintrust::Scorer.new(name, &block)
  scorer.singleton_class.prepend(PositionalArgsRemapping)
  scorer
end