{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/orq/json-schema/orq-evaluator-response-function-schema.json",
  "title": "Function",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/orq-evals-api-openapi.yml#/components/schemas/EvaluatorResponseFunction",
  "type": "object",
  "properties": {
    "_id": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "created": {
      "type": "string",
      "default": "2026-08-05T15:12:51.947Z"
    },
    "updated": {
      "type": "string",
      "default": "2026-08-05T15:12:51.947Z"
    },
    "updated_by_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "project_id": {
      "type": "string",
      "description": "Unique identifier of the project owning this evaluator."
    },
    "guardrail_config": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean",
              "default": true
            },
            "alert_on_failure": {
              "type": "boolean",
              "default": false
            },
            "type": {
              "type": "string",
              "enum": [
                "boolean"
              ]
            },
            "value": {
              "type": "boolean"
            }
          },
          "required": [
            "type",
            "value"
          ],
          "title": "Boolean"
        },
        {
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean",
              "default": true
            },
            "alert_on_failure": {
              "type": "boolean",
              "default": false
            },
            "type": {
              "type": "string",
              "enum": [
                "categorical"
              ]
            },
            "values": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            }
          },
          "required": [
            "type",
            "values"
          ],
          "title": "Categorical"
        },
        {
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean",
              "default": true
            },
            "alert_on_failure": {
              "type": "boolean",
              "default": false
            },
            "type": {
              "type": "string",
              "enum": [
                "number"
              ]
            },
            "value": {
              "type": "number"
            },
            "operator": {
              "type": "string",
              "enum": [
                "eq",
                "ne",
                "gt",
                "gte",
                "lt",
                "lte"
              ]
            }
          },
          "required": [
            "type",
            "value",
            "operator"
          ],
          "title": "Number"
        },
        {
          "type": "null"
        }
      ],
      "x-speakeasy-type-override": "any"
    },
    "type": {
      "type": "string",
      "enum": [
        "function_eval"
      ]
    },
    "output_type": {
      "type": "string",
      "enum": [
        "boolean",
        "categorical",
        "number",
        "string"
      ],
      "description": "The type of output expected from the evaluator"
    },
    "function_params": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "contains"
              ]
            },
            "value": {
              "type": "string"
            }
          },
          "required": [
            "type",
            "value"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "contains_none"
              ]
            },
            "keywords": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "type",
            "keywords"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "contains_all"
              ]
            },
            "keywords": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "type",
            "keywords"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "contains_any"
              ]
            },
            "keywords": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "type",
            "keywords"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "contains_email"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "contains_url"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "contains_valid_link"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "start_with"
              ]
            },
            "value": {
              "type": "string"
            }
          },
          "required": [
            "type",
            "value"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "ends_with"
              ]
            },
            "value": {
              "type": "string"
            }
          },
          "required": [
            "type",
            "value"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "exact_match"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "length_less_than"
              ]
            },
            "value": {
              "type": "number"
            }
          },
          "required": [
            "type",
            "value"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "length_between"
              ]
            },
            "min": {
              "type": "number"
            },
            "max": {
              "type": "number"
            }
          },
          "required": [
            "type",
            "min",
            "max"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "length_greater_than"
              ]
            },
            "value": {
              "type": "number"
            }
          },
          "required": [
            "type",
            "value"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "one_line"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "regex"
              ]
            },
            "pattern": {
              "type": "string"
            }
          },
          "required": [
            "type",
            "pattern"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "is_valid_json"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "moderations_openai"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "moderations_google"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "bert_score"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "bleu_score"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "rouge_n"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "meteor_score"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "cosine_similarity"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "levenshtein_distance"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "keywords_match"
              ]
            },
            "keywords": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "type",
            "keywords"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "most_repeated_words"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "flesch_reading_ease"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "gse_english_level"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "words_count"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "sentences_count"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "lexical_repetition"
              ]
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "grammar_diversity"
              ]
            }
          },
          "required": [
            "type"
          ]
        }
      ]
    },
    "key": {
      "type": "string",
      "minLength": 1,
      "pattern": "^[a-zA-Z0-9]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$"
    }
  },
  "required": [
    "_id",
    "description",
    "type",
    "output_type",
    "function_params",
    "key"
  ]
}