class DefaultLLMJudge

source code

properties


client

source code

def client(self) -> Union[Unify, AsyncUnify]:

include_rationale

source code

def include_rationale(self) -> bool:

input_parser

source code

def input_parser(self) -> Dict[str, List[Union[str, int]]]:

name

source code

def name(self) -> Optional[str]:

prompt

source code

def prompt(self) -> Prompt:

response_parser

source code

def response_parser(self) -> Dict[str, List[Union[str, int]]]:

score_config

source code

def score_config(self) -> Dict[float, str]:

setters


set_client

source code

def set_client(self, value: Union[Unify, AsyncUnify]) -> Self:

set_include_rationale

source code

def set_include_rationale(self, value: bool) -> Self:

set_input_parser

source code

def set_input_parser(self, value: Dict[str, List[Union[str, int]]]) -> Self:

set_name

source code

def set_name(self, value: str) -> Self:

set_prompt

source code

def set_prompt(self, value: Union[str, Prompt]) -> Self:

set_response_parser

source code

def set_response_parser(self, value: Dict[str, List[Union[str, int]]]) -> Self:

set_score_config

source code

def set_score_config(self, value: Dict[float, str]) -> Self:

methods


evaluate

source code

def evaluate(
        self,
        input: Any,
        response: Any,
    ) -> Union[float, Tuple[float, Union[str, ChatCompletion]]]:

dunder_methods


__init__

source code

def __init__(
        self,
        client: Union[Unify, AsyncUnify],
        prompt: Optional[Union[str, Prompt]] = None,
        score_config: Optional[Dict[float, str]] = None,
        name: Optional[str] = None,
        input_parser: Optional[Dict[str, Union[List[Union[str, int]], None]]] = None,
        response_parser: Optional[Dict[str, Union[List[Union[str, int]], None]]] = None,
        include_rationale: bool = False,
        api_key: Optional[str] = None,
    ):

Creates an LLM as a Judge Evaluator.

Arguments:

  • client - The client to use as the LLM Judge.
  • prompt - The prompt for the judge to use when performing evaluations.
  • score_config - Either a derived Score subclass, or the configuration for the
  • name - The name to give to this LLM Judge evaluator, optional.
  • input_parser - Function to parse the input and update corresponding
  • response_parser - Function to parse the response and update corresponding
  • include_rationale - Whether to include the LLM’s rationale as part of
  • api_key - API key for accessing the Unify API. If None, it attempts to

Raises:

  • UnifyError: If the API key is missing.