Transformers
Create Python-based transformers to extract and reshape data from AI app responses before evaluation.
Create Python-based transformers to extract and reshape data from AI app responses before evaluation.
Transformers are Python functions that preprocess and reshape data before it runs through evaluation pipelines. They let you extract the exact fields needed for evaluation, even from nested or non-standard response structures from your AI application.
To create a new transformer:
Every transformer must define a transformer function that accepts a data parameter and returns the transformed result:
The from typing import Any import and the def transformer(data: Any): function signature are fixed and cannot be modified.
The built-in debugger lets you verify your transformer before saving:
{"key": "value"})Test data is persisted locally so you can iterate without re-entering it each time.
Transformers are used in AI Connections as an alternative to JSON key paths for extracting data from AI app responses. You can assign a transformer for each of the following fields:
When configuring an AI Connection, select the Transformer tab in any parsing section and choose the transformer you want to use from the dropdown.
From the transformers list, use the three-dot menu on any row to Edit or Delete a transformer.
Transformers is a premium feature. You must be on the Premium plan or above to create and use transformers.