Launch Week 02 wrapped — explore all five launches

Update Transformer

PUThttps://api.confident-ai.com/v2/transformers/{transformerId}

Renames a transformer, changes its description, or replaces its code, and returns it. Sending codeDefinition overwrites the stored code, which every AI connection and metric collection already using this transformer picks up on its next run.

PUT/v2/transformers/{transformerId}
curl -X PUT "https://api.confident-ai.com/v2/transformers/{transformerId}" \
  -H "CONFIDENT_API_KEY: <PROJECT-API-KEY>" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Extract nested answer",
  "description": "Pulls the answer out of a nested envelope.",
  "codeDefinition": {
    "code": "def transform(input_data):\n    return input_data[\"data\"][\"answer\"]",
    "language": "PYTHON"
  }
}'
200
{
  "success": true,
  "data": {
    "id": "<TRANSFORMER-ID>",
    "name": "Extract nested answer",
    "description": "Pulls the answer out of a nested envelope.",
    "createdAt": "2025-01-15T10:30:00.000Z",
    "updatedAt": "2025-01-20T08:15:00.000Z",
    "codeDefinition": {
      "code": "def transform(input_data):\n    return input_data[\"data\"][\"answer\"]",
      "language": "PYTHON"
    }
  },
  "deprecated": false
}

Headers

  • CONFIDENT_API_KEYstringRequired

    The API key of your Confident AI project.

Path parameters

  • transformerIdstringRequired

    The id of the transformer.

Request body

  • namestring

    The name of the transformer, unique within the project.

  • descriptionstring | null

    What the transformer extracts. Send null to clear it.

  • codeDefinitionobject

    The code a transformer runs, with the language it is written in.

    Show 2 propertiesHide 2 properties
    • codestringRequired

      The source of the transformer. It defines a transform function that takes the value being transformed and returns the value to use in its place.

    • languageenumRequired

      The language a transformer's code is written in.

      Show 1 enum valueHide 1 enum value
      • PYTHON

Response

Update Transformer succeeded.

  • successboolean

    Indicates if the request was successful.

  • dataobject

    Code that reshapes a value on its way into or out of an evaluation, such as extracting the answer from your endpoint's response.

    Show 6 propertiesHide 6 properties
    • idstring

      The id of the transformer, generated by Confident AI.

    • namestring

      The name of the transformer.

    • descriptionstring | null

      What the transformer extracts.

    • createdAtstring

      The timestamp when the transformer was created.

    • updatedAtstring

      The timestamp when the transformer was last updated.

    • codeDefinitionobject | null

      The code a transformer runs, with the language it is written in.

      Show 2 propertiesHide 2 properties
      • codestring

        The source of the transformer. It defines a transform function that takes the value being transformed and returns the value to use in its place.

      • languageenum

        The language a transformer's code is written in.

        Show 1 enum valueHide 1 enum value
        • PYTHON
  • deprecatedboolean

    Indicates if this endpoint is deprecated.

Built byConfident AI