Skip to main content

Test Case Classes

The Test Case classes define the structure for test cases used in evaluations, including support for text, conversational, LLM, multimodal (image/audio), and more.

TestCase Class

Represents a general test case for evaluation.
Attributes:
  • text (Optional[str]): Text for the test case.
  • document (Optional[str]): Document content.
  • input (Optional[str]): Input string.
  • output (Optional[str]): Output string.
  • prompt (Optional[str]): Prompt used.
  • criteria (Optional[str]): Evaluation criteria.
  • actual_json (Optional[dict]): Actual JSON object.
  • expected_json (Optional[dict]): Expected JSON object.
  • expected_text (Optional[str]): Expected text output.
  • query (Optional[str]): Query string.
  • response (Optional[str]): Response string.
  • context (Union[List[str], str]): Context for the test case.

ConversationalTestCase Class

Represents a conversational test case, consisting of a list of LLM test cases (messages).
Attributes:
  • messages (List[LLMTestCase]): List of LLM test case messages.

LLMTestCase Class

Represents a test case for LLM (Language Model) evaluation.
Attributes:
  • query (str): The input query.
  • response (str): The model’s response.
  • context (Optional[Union[str, List[str]]]): Context for the test case.
  • expected_response (Optional[str]): The expected response.

MLLMImage Class

Represents an image input for multimodal LLM test cases.
Attributes:
  • url (str): URL or local path to the image.
  • local (Optional[bool]): Whether the image is local.

MLLMAudio Class

Represents an audio input for multimodal LLM test cases.
Attributes:
  • url (str): URL or local path to the audio file.
  • local (Optional[bool]): Whether the audio is local.
  • is_plain_text (bool): Whether the input is plain text (not audio).

MLLMTestCase Class

Represents a multimodal LLM test case, supporting image and audio inputs.
Attributes:
  • image_url (Optional[Union[str, MLLMImage]]): Image input.
  • input_image_url (Optional[Union[str, MLLMImage]]): Input image.
  • output_image_url (Optional[Union[str, MLLMImage]]): Output image.
  • input_audio (Optional[Union[str, MLLMAudio]]): Input audio.
  • call_type (Optional[str]): Type of call (if applicable).

Example Usage