{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cekura-ai/json-schema/cekura-ai-patched-metric-edit-serializer-v2-schema.json",
  "title": "PatchedMetricEditSerializerV2",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cekura-ai-metrics-api-openapi.yml#/components/schemas/PatchedMetricEditSerializerV2",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "readOnly": true
    },
    "slug": {
      "type": [
        "string",
        "null"
      ],
      "description": "URL-friendly unique identifier in snake_case format",
      "maxLength": 255
    },
    "project": {
      "type": [
        "integer",
        "null"
      ]
    },
    "agent": {
      "type": [
        "integer",
        "null"
      ]
    },
    "agents": {
      "type": "array",
      "items": {
        "type": [
          "integer",
          "null"
        ]
      }
    },
    "assistant_id": {
      "type": "string",
      "writeOnly": true
    },
    "name": {
      "type": "string",
      "description": "\nName of the metric.\nExample: `\"Customer Satisfaction\"` or `\"Appointment Booking\"`\n        ",
      "maxLength": 255
    },
    "description": {
      "type": "string",
      "description": "\nDescription of what the metric measures.\nExample: `\"Measures how satisfied customers are with the service provided\"`\n        "
    },
    "type": {
      "enum": [
        "basic",
        "custom_prompt",
        "custom_code",
        "llm_judge"
      ],
      "type": "string",
      "x-spec-enum-id": "b44700c0a6443b40",
      "description": "\nType of metric\n\n\n* `basic` - Basic (Deprecated in favor of LLM Judge)\n* `custom_prompt` - Custom Prompt ( Deprecated in favor of LLM Judge)\n* `custom_code` - Custom Code\n* `llm_judge` - LLM Judge"
    },
    "eval_type": {
      "enum": [
        "binary",
        "continuous_qualitative",
        "numeric",
        "enum"
      ],
      "type": "string",
      "description": "* `binary` - Binary\n* `continuous_qualitative` - Continuous Qualitative\n* `numeric` - Numeric\n* `enum` - Enum",
      "x-spec-enum-id": "b40eac6824409cc2"
    },
    "audio_enabled": {
      "type": "boolean",
      "description": "\nWhether this metric requires audio analysis.\nExample: `true` or `false`\n        "
    },
    "observability_enabled": {
      "type": "boolean",
      "description": "\nEnable this metric for observability.\nExample: `true` or `false`\n        "
    },
    "simulation_enabled": {
      "type": "boolean",
      "description": "\nEnable this metric for simulations.\nExample: `true` or `false`\n        "
    },
    "sampling_enabled": {
      "type": "boolean",
      "description": "Enable sampling for this metric using its sample_rate, or the project sample rate when unset"
    },
    "sample_rate": {
      "type": [
        "number",
        "null"
      ],
      "format": "double",
      "maximum": 1.0,
      "minimum": 0.0,
      "description": "Sampling rate for this metric (0.0 to 1.0). Overrides the project sample rate when set."
    },
    "prompt": {
      "type": "string",
      "description": "\nEvaluation prompt for the metric.\nExample: `\"Evaluate customer satisfaction based on conversation\"`\n"
    },
    "function_name": {
      "type": [
        "string",
        "null"
      ],
      "readOnly": true,
      "description": "\nPredefined function name\nExample: `\"get_latency\"` or `\"check_critical_deviations\"`\n"
    },
    "enum_values": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "display_order": {
      "type": "integer",
      "maximum": 2147483647,
      "minimum": -2147483648,
      "description": "\nDisplay order for the metric.\nExample: `1`\n"
    },
    "custom_code": {
      "type": "string",
      "description": "\nPython custom code for the metric.\nExample:\n```python\n_resul = True\n_explanation = None\nif  \"call_end_reason\" in data and data[\"call_end_reason\"] == \"customer_satisfaction\":\n    _result = True\n    _explanation = \"Customer expressed satisfaction with service\"\n```\n"
    },
    "evaluation_trigger": {
      "enum": [
        "always",
        "automatic",
        "custom"
      ],
      "type": "string",
      "description": "* `always` - Always\n* `automatic` - Automatic\n* `custom` - Custom",
      "x-spec-enum-id": "ecd3c02e0e393ef5"
    },
    "trigger_type": {
      "enum": [
        "llm_judge",
        "custom_code"
      ],
      "type": "string",
      "description": "* `llm_judge` - LLM Judge\n* `custom_code` - Custom Code",
      "x-spec-enum-id": "2adad4b8df61914f"
    },
    "evaluation_trigger_prompt": {
      "type": "string",
      "description": "\nEvaluation trigger prompt for the metric.\nExample: `\"Evaluate metric only if call ended reason is main-agent-ended-call\"`\n"
    },
    "evaluation_trigger_custom_code": {
      "type": "string",
      "description": "\nPython custom code to determine metric relevance. Code should set _result (bool) and _explanation (str).\nExample:\n```python\n_result = True\n_explanation = \"Metric is relevant\"\nif \"call_end_reason\" in data and data[\"call_end_reason\"] == \"customer-hung-up\":\n    _result = False\n    _explanation = \"Customer hung up, metric not applicable\"\n```\n"
    },
    "llm_provider": {
      "enum": [
        "openai",
        "gemini",
        "dspy-gepa-gemini-flash",
        "deepseek-v4-flash"
      ],
      "type": "string",
      "description": "* `openai` - OpenAI\n* `gemini` - Gemini\n* `dspy-gepa-gemini-flash` - Dspy Gepa Gemini Flash\n* `deepseek-v4-flash` - DeepSeek V4 Flash",
      "x-spec-enum-id": "6d1d2e77c71d1721",
      "writeOnly": true
    },
    "relevance_llm_provider": {
      "enum": [
        "openai",
        "gemini",
        "dspy-gepa-gemini-flash",
        "deepseek-v4-flash"
      ],
      "type": "string",
      "description": "* `openai` - OpenAI\n* `gemini` - Gemini\n* `dspy-gepa-gemini-flash` - Dspy Gepa Gemini Flash\n* `deepseek-v4-flash` - DeepSeek V4 Flash",
      "x-spec-enum-id": "6d1d2e77c71d1721",
      "writeOnly": true
    },
    "vocera_defined_metric_code": {
      "type": "string",
      "readOnly": true,
      "description": "\nVocera defined metric code for the metric.\nExample: `\"7fd534f5\"`\n"
    },
    "priority_assignment_prompt": {
      "type": "string",
      "description": "\nPriority assignment prompt for the metric.\n"
    },
    "configuration": {
      "description": "\nCustom configuration parameters for specific metrics if metric supports it.\nExample:\n- For Infrastructure issues\n```json\n{\n    \"infra_issues_timeout\": 10\n}\n```\n"
    },
    "scenarios": {
      "writeOnly": true
    },
    "overall_score": {
      "type": "string",
      "readOnly": true
    },
    "total_score": {
      "type": "string",
      "readOnly": true
    },
    "kb_file_ids": {
      "description": "\nList of knowledge base file IDs for the metric.\nExample: `[123, 456]`\n"
    },
    "knowledge_base_files": {
      "type": "string",
      "readOnly": true
    },
    "metric_description_program": {},
    "metric_description_variables": {
      "type": "array",
      "items": {}
    },
    "evaluation_trigger_program": {},
    "evaluation_trigger_variables": {
      "type": "array",
      "items": {}
    },
    "alert_enabled": {
      "type": "boolean",
      "description": "\nEnable alerts for this metric when it fails (value=false).\nOnly applicable to binary metrics (eval_type=binary).\nFor other metric types, use significant_change_alert_status instead.\nExample: `true` or `false`\n        "
    },
    "alert_type": {
      "enum": [
        "disabled",
        "normal",
        "significant_change"
      ],
      "type": "string",
      "description": "* `disabled` - Alerts Disabled\n* `normal` - Normal Alerts\n* `significant_change` - Significant Change Alerts",
      "x-spec-enum-id": "9e2661f1aeca64cf",
      "default": "disabled"
    },
    "window_size": {
      "type": "integer",
      "default": 50
    },
    "std_multiplier": {
      "type": "number",
      "format": "double",
      "default": 2.0
    },
    "ewma_alpha": {
      "type": "number",
      "format": "double",
      "default": 0.1
    },
    "significant_change_alert_status": {
      "enum": [
        "enabled",
        "disabled"
      ],
      "type": "string",
      "x-spec-enum-id": "6d6f4d361b4ea1fb",
      "description": "\nAlert status: enabled or disabled.\n\n\n* `enabled` - Enabled\n* `disabled` - Disabled"
    },
    "significant_change_alert_direction": {
      "enum": [
        "",
        "increase",
        "decrease"
      ],
      "type": "string",
      "x-spec-enum-id": "1e86e60ca5cfba12",
      "description": "Alert direction: increase only, decrease only, or both (empty = both).\nExample: `\"increase\"`, `\"decrease\"`, or `\"both\"`\n\n* `` - Both (Increase and Decrease)\n* `increase` - Increase Only\n* `decrease` - Decrease Only"
    },
    "add_to_new_agents": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "When enabled, this metric is automatically assigned to new agents created in the project."
    },
    "alert_filters": {
      "oneOf": [
        {},
        {
          "type": "null"
        }
      ],
      "description": "Filters to apply before computing alerts (CallLogQueryFilter format)"
    },
    "slack_workspace": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Slack workspace to send alerts to"
    },
    "slack_channel_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Override channel ID for this metric's alerts",
      "maxLength": 255
    },
    "apply_to_all_agents": {
      "type": "boolean",
      "writeOnly": true,
      "default": false,
      "description": "For observability_dropoff: when true, copies the dropoff_nodes from configuration to every other agent in the project."
    },
    "add_to_rubric": {
      "type": "boolean",
      "writeOnly": true,
      "default": false,
      "description": "If true, this metric is added to the project's call-success rubric on save (a sensible default rule is chosen by `eval_type`). If false on an existing rubric metric, it's removed from the rubric."
    },
    "dependency_warnings": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "readOnly": true,
      "description": "Warnings about prerequisites, such as inputs disabled for a source this metric runs on."
    }
  }
}