Complete API reference for the Python SDK
init()
api_key
(str, optional): Your ZeroEval API key. If not provided, uses ZEROEVAL_API_KEY
environment variableworkspace_name
(str, optional): The name of your workspace. Defaults to "Personal Workspace"
debug
(bool, optional): If True, enables detailed logging for debugging. Can also be enabled by setting ZEROEVAL_DEBUG=true
environment variableapi_url
(str, optional): The URL of the ZeroEval API. Defaults to "https://api.zeroeval.com"
@span
name
(str): Name of the spansession_id
(str, optional): Deprecated - Use session
parameter insteadsession
(Union[str, dict], optional): Session information. Can be:
{"id": "...", "name": "..."}
attributes
(dict, optional): Additional attributes to attach to the spaninput_data
(str, optional): Manual input data overrideoutput_data
(str, optional): Manual output data overridetags
(dict, optional): Tags to attach to the span@experiment
dataset
(Dataset, optional): Dataset to use for the experimentmodel
(str, optional): Model identifierDataset
name
(str): The name of the datasetdata
(list[dict]): A list of dictionaries containing the datadescription
(str, optional): A description of the datasetpush()
self
: The Dataset instancecreate_new_version
(bool, optional): For backward compatibility. This parameter is no longer needed as new versions are automatically created when a dataset name already exists. Defaults to Falsepull()
cls
: The Dataset class itself (automatically provided when using @classmethod
)dataset_name
(str): The name of the dataset to pull from the backendversion_number
(int, optional): Specific version number to pull. If not provided, pulls the latest versionadd_rows()
self
: The Dataset instancenew_rows
(list[dict]): A list of dictionaries representing the rows to addadd_image()
self
: The Dataset instancerow_index
(int): Index of the row to update (0-based)column_name
(str): Name of the column to add the image toimage_path
(str): Path to the image file to addadd_audio()
self
: The Dataset instancerow_index
(int): Index of the row to update (0-based)column_name
(str): Name of the column to add the audio toaudio_path
(str): Path to the audio file to addadd_media_url()
self
: The Dataset instancerow_index
(int): Index of the row to update (0-based)column_name
(str): Name of the column to add the media URL tomedia_url
(str): URL pointing to the media filemedia_type
(str, optional): Type of media - “image”, “audio”, or “video”. Defaults to “image”name
(str): The name of the datasetdescription
(str): The description of the datasetcolumns
(list[str]): List of all unique column namesdata
(list[dict]): List of the data portion for each rowbackend_id
(str): The ID in the backend (after pushing)version_id
(str): The version ID in the backendversion_number
(int): The version number in the backendExperiment
dataset
(Dataset): The dataset to run the experiment ontask
(Callable): Function that processes each row and returns outputevaluators
(list[Callable], optional): List of evaluator functions that take (row, output) and return evaluation resultname
(str, optional): Name of the experiment. Defaults to task function namedescription
(str, optional): Description of the experiment. Defaults to task function’s docstringrun()
self
: The Experiment instancesubset
(list[dict], optional): Subset of dataset rows to run the experiment on. If None, runs on entire datasetrun_task()
self
: The Experiment instancesubset
(list[dict], optional): Subset of dataset rows to run the task on. If None, runs on entire datasetraise_on_error
(bool, optional): If True, raises exceptions encountered during task execution. If False, captures errors. Defaults to Falserun_evaluators()
self
: The Experiment instanceevaluators
(list[Callable], optional): List of evaluator functions to run. If None, uses evaluators from the Experiment instanceresults
(list[ExperimentResult], optional): List of results to evaluate. If None, uses results from the Experiment instanceSpan
@span
decorator.
set_io()
self
: The Span instanceinput_data
(str, optional): Input data to attach to the span. Will be converted to string if not alreadyoutput_data
(str, optional): Output data to attach to the span. Will be converted to string if not alreadyset_tags()
self
: The Span instancetags
(dict[str, str]): Dictionary of tags to set on the spanset_attributes()
self
: The Span instanceattributes
(dict[str, Any]): Dictionary of attributes to set on the spanset_error()
self
: The Span instancecode
(str): Error code or exception class namemessage
(str): Error messagestack
(str, optional): Stack trace informationget_current_span()
get_current_trace()
get_current_session()
set_tag()
target
: The target to set tags on
Span
: Sets tags on the specific spanstr
: Sets tags on the trace (if valid trace ID) or session (if valid session ID)tags
(dict[str, str]): Dictionary of tags to setset_signal()
target
: The entity to attach signals to
Span
: Sends signals to the specific spanstr
: Sends signals to the trace (if active trace ID) or sessionsignals
(dict): Dictionary of signal names to valueszeroeval run
zeroeval setup
ZEROEVAL_API_KEY
: Your ZeroEval API keyZEROEVAL_API_URL
: API endpoint URL (defaults to https://api.zeroeval.com
)ZEROEVAL_DEBUG
: Set to true
to enable debug loggingZEROEVAL_DISABLED_INTEGRATIONS
: Comma-separated list of integrations to disable