{
  "description": "AIEvaluation is the Schema for the AI evaluations API.\nSee also https://coralogix.com/docs/user-guides/ai/",
  "properties": {
    "apiVersion": {
      "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
      "type": "string"
    },
    "kind": {
      "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "description": "AIEvaluationSpec defines the desired state of AIEvaluation.",
      "properties": {
        "application": {
          "description": "Name of the AI application this evaluation belongs to.",
          "maxLength": 256,
          "minLength": 1,
          "type": "string",
          "x-kubernetes-validations": [
            {
              "message": "spec.application is immutable",
              "rule": "self == oldSelf"
            }
          ]
        },
        "config": {
          "description": "AI evaluation configuration.",
          "properties": {
            "allowedTopics": {
              "description": "Configuration for Allowed Topics evaluation.",
              "properties": {
                "topics": {
                  "description": "Topics considered allowed.",
                  "items": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "maxItems": 1024,
                  "minItems": 1,
                  "type": "array",
                  "x-kubernetes-list-type": "set"
                }
              },
              "required": [
                "topics"
              ],
              "type": "object",
              "additionalProperties": false
            },
            "competition": {
              "description": "Configuration for Competition evaluation.",
              "properties": {
                "competitors": {
                  "description": "Competitor names to watch for.",
                  "items": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "maxItems": 1024,
                  "minItems": 1,
                  "type": "array",
                  "x-kubernetes-list-type": "set"
                }
              },
              "required": [
                "competitors"
              ],
              "type": "object",
              "additionalProperties": false
            },
            "hallucinationCompleteness": {
              "additionalProperties": {
                "type": "string"
              },
              "description": "Configuration for Hallucination Completeness evaluation. Hallucination Completeness has no nested fields and must be set to an empty object.",
              "maxProperties": 0,
              "type": "object"
            },
            "hallucinationContextAdherence": {
              "additionalProperties": {
                "type": "string"
              },
              "description": "Configuration for Hallucination Context Adherence evaluation. Hallucination Context Adherence has no nested fields and must be set to an empty object.",
              "maxProperties": 0,
              "type": "object"
            },
            "hallucinationContextRelevance": {
              "additionalProperties": {
                "type": "string"
              },
              "description": "Configuration for Hallucination Context Relevance evaluation. Hallucination Context Relevance has no nested fields and must be set to an empty object.",
              "maxProperties": 0,
              "type": "object"
            },
            "hallucinationCorrectness": {
              "additionalProperties": {
                "type": "string"
              },
              "description": "Configuration for Hallucination Correctness evaluation. Hallucination Correctness has no nested fields and must be set to an empty object.",
              "maxProperties": 0,
              "type": "object"
            },
            "hallucinationTaskAdherence": {
              "additionalProperties": {
                "type": "string"
              },
              "description": "Configuration for Hallucination Task Adherence evaluation. Hallucination Task Adherence has no nested fields and must be set to an empty object.",
              "maxProperties": 0,
              "type": "object"
            },
            "languageMismatch": {
              "additionalProperties": {
                "type": "string"
              },
              "description": "Configuration for Language Mismatch evaluation. Language Mismatch has no nested fields and must be set to an empty object.",
              "maxProperties": 0,
              "type": "object"
            },
            "pii": {
              "description": "Configuration for PII evaluation.",
              "properties": {
                "categories": {
                  "description": "PII categories to detect.",
                  "items": {
                    "enum": [
                      "PHONE_NUMBER",
                      "EMAIL_ADDRESS",
                      "CREDIT_CARD",
                      "IBAN_CODE",
                      "US_SSN"
                    ],
                    "type": "string"
                  },
                  "maxItems": 1024,
                  "minItems": 1,
                  "type": "array",
                  "x-kubernetes-list-type": "set"
                }
              },
              "required": [
                "categories"
              ],
              "type": "object",
              "additionalProperties": false
            },
            "promptInjection": {
              "description": "Configuration for Prompt Injection evaluation.",
              "properties": {
                "additionalContext": {
                  "default": "",
                  "description": "Additional context passed to the LLM evaluator.",
                  "maxLength": 65536,
                  "type": "string"
                }
              },
              "type": "object",
              "additionalProperties": false
            },
            "restrictedTopics": {
              "description": "Configuration for Restricted Topics evaluation.",
              "properties": {
                "topics": {
                  "description": "Topics that should not appear.",
                  "items": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "maxItems": 1024,
                  "minItems": 1,
                  "type": "array",
                  "x-kubernetes-list-type": "set"
                }
              },
              "required": [
                "topics"
              ],
              "type": "object",
              "additionalProperties": false
            },
            "sexism": {
              "additionalProperties": {
                "type": "string"
              },
              "description": "Configuration for Sexism evaluation. Sexism has no nested fields and must be set to an empty object.",
              "maxProperties": 0,
              "type": "object"
            },
            "sqlAllowedTables": {
              "description": "Configuration for SQL Allowed Tables evaluation.",
              "properties": {
                "tables": {
                  "description": "SQL table names that are allowed.",
                  "items": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "maxItems": 1024,
                  "minItems": 1,
                  "type": "array",
                  "x-kubernetes-list-type": "set"
                }
              },
              "required": [
                "tables"
              ],
              "type": "object",
              "additionalProperties": false
            },
            "sqlHallucination": {
              "additionalProperties": {
                "type": "string"
              },
              "description": "Configuration for SQL Hallucination evaluation. SQL Hallucination has no nested fields and must be set to an empty object.",
              "maxProperties": 0,
              "type": "object"
            },
            "sqlReadOnly": {
              "additionalProperties": {
                "type": "string"
              },
              "description": "Configuration for SQL Read Only evaluation. SQL Read Only has no nested fields and must be set to an empty object.",
              "maxProperties": 0,
              "type": "object"
            },
            "sqlRestrictedTables": {
              "description": "Configuration for SQL Restricted Tables evaluation.",
              "properties": {
                "tables": {
                  "description": "SQL table names that are not allowed.",
                  "items": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "maxItems": 1024,
                  "minItems": 1,
                  "type": "array",
                  "x-kubernetes-list-type": "set"
                }
              },
              "required": [
                "tables"
              ],
              "type": "object",
              "additionalProperties": false
            },
            "toxicity": {
              "additionalProperties": {
                "type": "string"
              },
              "description": "Configuration for Toxicity evaluation. Toxicity has no nested fields and must be set to an empty object.",
              "maxProperties": 0,
              "type": "object"
            }
          },
          "type": "object",
          "x-kubernetes-validations": [
            {
              "message": "Exactly one of the following AI evaluation configs must be set: allowedTopics, competition, hallucinationCompleteness, hallucinationContextAdherence, hallucinationContextRelevance, hallucinationCorrectness, hallucinationTaskAdherence, languageMismatch, pii, promptInjection, restrictedTopics, sexism, sqlAllowedTables, sqlHallucination, sqlReadOnly, sqlRestrictedTables, toxicity",
              "rule": "(has(self.allowedTopics) ? 1 : 0) + (has(self.competition) ? 1 : 0) + (has(self.hallucinationCompleteness) ? 1 : 0) + (has(self.hallucinationContextAdherence) ? 1 : 0) + (has(self.hallucinationContextRelevance) ? 1 : 0) + (has(self.hallucinationCorrectness) ? 1 : 0) + (has(self.hallucinationTaskAdherence) ? 1 : 0) + (has(self.languageMismatch) ? 1 : 0) + (has(self.pii) ? 1 : 0) + (has(self.promptInjection) ? 1 : 0) + (has(self.restrictedTopics) ? 1 : 0) + (has(self.sexism) ? 1 : 0) + (has(self.sqlAllowedTables) ? 1 : 0) + (has(self.sqlHallucination) ? 1 : 0) + (has(self.sqlReadOnly) ? 1 : 0) + (has(self.sqlRestrictedTables) ? 1 : 0) + (has(self.toxicity) ? 1 : 0) == 1"
            }
          ],
          "additionalProperties": false
        },
        "isEnabled": {
          "default": true,
          "description": "Whether the evaluation is active.",
          "type": "boolean"
        },
        "subsystem": {
          "description": "Subsystem within the application.",
          "maxLength": 256,
          "minLength": 1,
          "type": "string",
          "x-kubernetes-validations": [
            {
              "message": "spec.subsystem is immutable",
              "rule": "self == oldSelf"
            }
          ]
        },
        "target": {
          "description": "Target span content the evaluation runs against.",
          "enum": [
            "prompt",
            "response"
          ],
          "type": "string",
          "x-kubernetes-validations": [
            {
              "message": "spec.target is immutable",
              "rule": "self == oldSelf"
            }
          ]
        },
        "threshold": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "string"
            }
          ],
          "description": "Score threshold. Must be between 0.0 and 1.0 inclusive.\nFractional values must be supplied as quoted quantities, for example \"0.8\".",
          "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
          "x-kubernetes-int-or-string": true
        }
      },
      "required": [
        "application",
        "config",
        "subsystem",
        "target",
        "threshold"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "description": "AIEvaluationStatus defines the observed state of AIEvaluation.",
      "properties": {
        "conditions": {
          "items": {
            "description": "Condition contains details for one aspect of the current state of this API Resource.",
            "properties": {
              "lastTransitionTime": {
                "description": "lastTransitionTime is the last time the condition transitioned from one status to another.\nThis should be when the underlying condition changed.  If that is not known, then using the time when the API field changed is acceptable.",
                "format": "date-time",
                "type": "string"
              },
              "message": {
                "description": "message is a human readable message indicating details about the transition.\nThis may be an empty string.",
                "maxLength": 32768,
                "type": "string"
              },
              "observedGeneration": {
                "description": "observedGeneration represents the .metadata.generation that the condition was set based upon.\nFor instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date\nwith respect to the current state of the instance.",
                "format": "int64",
                "minimum": 0,
                "type": "integer"
              },
              "reason": {
                "description": "reason contains a programmatic identifier indicating the reason for the condition's last transition.\nProducers of specific condition types may define expected values and meanings for this field,\nand whether the values are considered a guaranteed API.\nThe value should be a CamelCase string.\nThis field may not be empty.",
                "maxLength": 1024,
                "minLength": 1,
                "pattern": "^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$",
                "type": "string"
              },
              "status": {
                "description": "status of the condition, one of True, False, Unknown.",
                "enum": [
                  "True",
                  "False",
                  "Unknown"
                ],
                "type": "string"
              },
              "type": {
                "description": "type of condition in CamelCase or in foo.example.com/CamelCase.",
                "maxLength": 316,
                "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$",
                "type": "string"
              }
            },
            "required": [
              "lastTransitionTime",
              "message",
              "reason",
              "status",
              "type"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "id": {
          "type": "string"
        },
        "printableStatus": {
          "type": "string"
        }
      },
      "type": "object",
      "additionalProperties": false
    }
  },
  "type": "object"
}
