Launch Week 02 wrapped — explore all five launches

Create Transformer

POSThttps://api.confident-ai.com/v2/transformers

Creates a transformer in your Confident AI project and returns its id. Test the code against a sample before attaching the transformer to anything.

POST/v2/transformers
curl -X POST "https://api.confident-ai.com/v2/transformers" \
  -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>"
  },
  "deprecated": false
}

Headers

  • CONFIDENT_API_KEYstringRequired

    The API key of your Confident AI project.

Request body

  • namestringRequired

    The name of the transformer, unique within the project.

  • descriptionstring | null

    What the transformer extracts. Send null to leave it unset.

  • codeDefinitionobjectRequired

    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

Create Transformer succeeded.

  • successboolean

    Indicates if the request was successful.

  • dataobject

    A reference to a transformer by its id.

    Show 1 propertyHide 1 property
    • idstring

      The id of the transformer, generated by Confident AI.

  • deprecatedboolean

    Indicates if this endpoint is deprecated.

Built byConfident AI