Test Cases
Creating test cases in your traces to run evaluations on-the-fly
Overview
Confident AI allows you to run evaluations on your spans and traces, which requires you to set test case parameters in update_current_span and update_current_trace.
Each metric requires different test case parameters. For detailed information on required test case parameters for each metric, refer to the official DeepEval documentation.
Test Case Parameters
Python
TypeScript
Both update_current_span and update_current_trace accept 7 OPTIONAL test case parameters:
input: The input to your LLM appoutput: The output of your LLM appexpected_output: The expected output of your LLM appretrieval_context: A list of strings representing the retrieved text chunks from a retrieval systemcontext: A list of strings representing the ideal retrieved text chunks provided from a retrieval systemtools_called: A list ofToolCallobjects representing the tools called by your LLM appexpected_tools: A list ofToolCallobjects representing the expected tools to be called by the LLM app
The input and output accept Any type for visualization purposes, but we recommend setting them as strings for running evaluations.
Set Span Test Case Parameters
You can set span-level test case parameters in the update_current_span function:
Python
TypeScript
Set Trace Test Case Parameters
You can set trace-level test case parameters in the update_current_trace function.
update_current_trace can be set multiple times at any point in your code under the observe decorator, which is useful when a parameter is only accessible in specific parts of your code.