llm_unit

class opik.llm_unit(expected_output_key: str = 'expected_output', input_key: str = 'input', metadata_key: str = 'metadata')

Bases:

Decorator used for special tests tracking. Mark your test with llm_unit and when you run pytest, Opik will create an experiment and log test results to it: test name, test inputs, result.

Parameters:
  • expected_output_key – test argument name that will be logged as expected_output of the LLM task. If not provided, Opik will try to find expected_output in arguments.

  • input_key – test argument name that will be logged as input of the LLM task. If not provided, Opik will try to find input in arguments.

  • metadata_key – test argument name that will be logged as metadata. If not provided, Opik will try to find metadata in arguments.