2085 lines
57 KiB
JSON
2085 lines
57 KiB
JSON
{
|
|
"components": {
|
|
"schemas": {
|
|
"AiMetadataFailure": {
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"detail": {
|
|
"description": "AI error detail",
|
|
"maxLength": 255,
|
|
"minLength": 1,
|
|
"title": "Detail",
|
|
"type": "string"
|
|
},
|
|
"error_code": {
|
|
"description": "Machine-readable AI error code",
|
|
"maxLength": 64,
|
|
"minLength": 1,
|
|
"title": "Error Code",
|
|
"type": "string"
|
|
},
|
|
"fallback_policy": {
|
|
"$ref": "#/components/schemas/FallbackPolicy",
|
|
"description": "Fallback policy triggered"
|
|
}
|
|
},
|
|
"required": [
|
|
"error_code",
|
|
"detail",
|
|
"fallback_policy"
|
|
],
|
|
"title": "AiMetadataFailure",
|
|
"type": "object"
|
|
},
|
|
"AiMetadataSuccess": {
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"effort_profile": {
|
|
"$ref": "#/components/schemas/EffortProfile",
|
|
"description": "AI effort profile applied"
|
|
},
|
|
"model": {
|
|
"description": "AI model used",
|
|
"maxLength": 64,
|
|
"minLength": 1,
|
|
"title": "Model",
|
|
"type": "string"
|
|
},
|
|
"pass_count": {
|
|
"description": "Number of passes executed",
|
|
"minimum": 1.0,
|
|
"title": "Pass Count",
|
|
"type": "integer"
|
|
}
|
|
},
|
|
"required": [
|
|
"model",
|
|
"effort_profile",
|
|
"pass_count"
|
|
],
|
|
"title": "AiMetadataSuccess",
|
|
"type": "object"
|
|
},
|
|
"BehavioralMetric": {
|
|
"enum": [
|
|
"message_count",
|
|
"conversation_count",
|
|
"conversation_turn_count",
|
|
"customer_message_count",
|
|
"customer_initiated_return"
|
|
],
|
|
"title": "BehavioralMetric",
|
|
"type": "string"
|
|
},
|
|
"CanonicalSnapshot": {
|
|
"properties": {
|
|
"captured_at": {
|
|
"description": "Timezone-aware timestamp when snapshot evidence was frozen",
|
|
"format": "date-time",
|
|
"title": "Captured At",
|
|
"type": "string"
|
|
},
|
|
"conversations": {
|
|
"items": {
|
|
"$ref": "#/components/schemas/ConversationEvidence"
|
|
},
|
|
"title": "Conversations",
|
|
"type": "array"
|
|
},
|
|
"hitl_policy": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/components/schemas/HitlPolicy"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"identity_context": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/components/schemas/IdentityContext"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"lead_profile": {
|
|
"$ref": "#/components/schemas/LeadProfile"
|
|
},
|
|
"scope": {
|
|
"$ref": "#/components/schemas/SnapshotScope",
|
|
"default": "linked_contact_history"
|
|
},
|
|
"trigger_metadata": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/components/schemas/TriggerMetadata"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"truncation": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/components/schemas/TruncationMetadata"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"version": {
|
|
"default": "1.0.0",
|
|
"maxLength": 64,
|
|
"title": "Version",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"captured_at",
|
|
"lead_profile"
|
|
],
|
|
"title": "CanonicalSnapshot",
|
|
"type": "object"
|
|
},
|
|
"ConversationEvidence": {
|
|
"properties": {
|
|
"assigned_agent_id": {
|
|
"anyOf": [
|
|
{
|
|
"maxLength": 255,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Assigned Agent Id"
|
|
},
|
|
"channel": {
|
|
"anyOf": [
|
|
{
|
|
"maxLength": 64,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Channel"
|
|
},
|
|
"conversation_id": {
|
|
"maxLength": 255,
|
|
"minLength": 1,
|
|
"title": "Conversation Id",
|
|
"type": "string"
|
|
},
|
|
"messages": {
|
|
"items": {
|
|
"$ref": "#/components/schemas/MessageEvidence"
|
|
},
|
|
"title": "Messages",
|
|
"type": "array"
|
|
}
|
|
},
|
|
"required": [
|
|
"conversation_id"
|
|
],
|
|
"title": "ConversationEvidence",
|
|
"type": "object"
|
|
},
|
|
"CreateScoringRunRequest": {
|
|
"properties": {
|
|
"rule_overrides": {
|
|
"description": "Inline dynamic rule overrides (maximum 30 rules)",
|
|
"items": {
|
|
"$ref": "#/components/schemas/DynamicRule"
|
|
},
|
|
"maxItems": 30,
|
|
"title": "Rule Overrides",
|
|
"type": "array"
|
|
},
|
|
"scoring_config_version": {
|
|
"default": "1.0.0",
|
|
"description": "Scoring config version",
|
|
"maxLength": 64,
|
|
"minLength": 1,
|
|
"title": "Scoring Config Version",
|
|
"type": "string"
|
|
},
|
|
"snapshot": {
|
|
"$ref": "#/components/schemas/CanonicalSnapshot",
|
|
"description": "Canonical Lead Snapshot containing evidence"
|
|
},
|
|
"subject_ref": {
|
|
"description": "EMS Lead reference or identifier",
|
|
"maxLength": 255,
|
|
"minLength": 1,
|
|
"title": "Subject Ref",
|
|
"type": "string"
|
|
},
|
|
"tenant_id": {
|
|
"description": "Tenant identifier",
|
|
"maxLength": 255,
|
|
"minLength": 1,
|
|
"title": "Tenant Id",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"tenant_id",
|
|
"subject_ref",
|
|
"snapshot"
|
|
],
|
|
"title": "CreateScoringRunRequest",
|
|
"type": "object"
|
|
},
|
|
"CreateScoringRunResponse": {
|
|
"properties": {
|
|
"created_at": {
|
|
"description": "Creation timestamp",
|
|
"format": "date-time",
|
|
"title": "Created At",
|
|
"type": "string"
|
|
},
|
|
"run_id": {
|
|
"description": "Server-generated unique scoring run ID",
|
|
"maxLength": 36,
|
|
"title": "Run Id",
|
|
"type": "string"
|
|
},
|
|
"scoring_config_version": {
|
|
"description": "Scoring config version applied",
|
|
"maxLength": 64,
|
|
"title": "Scoring Config Version",
|
|
"type": "string"
|
|
},
|
|
"status": {
|
|
"$ref": "#/components/schemas/ScoringRunStatus",
|
|
"default": "pending",
|
|
"description": "Initial run status"
|
|
},
|
|
"status_url": {
|
|
"description": "URL to inspect scoring run status",
|
|
"title": "Status Url",
|
|
"type": "string"
|
|
},
|
|
"subject_ref": {
|
|
"description": "EMS Lead reference",
|
|
"maxLength": 255,
|
|
"title": "Subject Ref",
|
|
"type": "string"
|
|
},
|
|
"tenant_id": {
|
|
"description": "Tenant identifier",
|
|
"maxLength": 255,
|
|
"title": "Tenant Id",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"run_id",
|
|
"status_url",
|
|
"tenant_id",
|
|
"subject_ref",
|
|
"scoring_config_version",
|
|
"created_at"
|
|
],
|
|
"title": "CreateScoringRunResponse",
|
|
"type": "object"
|
|
},
|
|
"DynamicRule": {
|
|
"description": "A configurable dynamic scoring rule that evaluates snapshot features.",
|
|
"properties": {
|
|
"custom_field_key": {
|
|
"anyOf": [
|
|
{
|
|
"maxLength": 64,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"description": "Key inside lead_profile.custom_fields if target is custom_field",
|
|
"title": "Custom Field Key"
|
|
},
|
|
"enabled": {
|
|
"default": true,
|
|
"description": "Whether this rule is active",
|
|
"title": "Enabled",
|
|
"type": "boolean"
|
|
},
|
|
"id": {
|
|
"description": "Unique identifier for the rule",
|
|
"maxLength": 64,
|
|
"minLength": 1,
|
|
"title": "Id",
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"description": "Human-readable rule name",
|
|
"maxLength": 128,
|
|
"minLength": 1,
|
|
"title": "Name",
|
|
"type": "string"
|
|
},
|
|
"operator": {
|
|
"$ref": "#/components/schemas/DynamicRuleOperator",
|
|
"description": "Comparison operator"
|
|
},
|
|
"points": {
|
|
"description": "Points awarded when matched (-100 to 100)",
|
|
"maximum": 100.0,
|
|
"minimum": -100.0,
|
|
"title": "Points",
|
|
"type": "integer"
|
|
},
|
|
"target": {
|
|
"$ref": "#/components/schemas/DynamicRuleTarget",
|
|
"default": "custom_field",
|
|
"description": "Target feature or custom_field to evaluate"
|
|
},
|
|
"value": {
|
|
"description": "Target comparison value (number, string, or list)",
|
|
"title": "Value"
|
|
}
|
|
},
|
|
"required": [
|
|
"id",
|
|
"name",
|
|
"operator",
|
|
"value",
|
|
"points"
|
|
],
|
|
"title": "DynamicRule",
|
|
"type": "object"
|
|
},
|
|
"DynamicRuleOperator": {
|
|
"enum": [
|
|
"eq",
|
|
"neq",
|
|
"gt",
|
|
"gte",
|
|
"lt",
|
|
"lte",
|
|
"contains",
|
|
"in"
|
|
],
|
|
"title": "DynamicRuleOperator",
|
|
"type": "string"
|
|
},
|
|
"DynamicRuleTarget": {
|
|
"enum": [
|
|
"student_age",
|
|
"lead_source",
|
|
"course_interest",
|
|
"study_area",
|
|
"contact_message_recency_days",
|
|
"conversation_count",
|
|
"message_count",
|
|
"custom_field"
|
|
],
|
|
"title": "DynamicRuleTarget",
|
|
"type": "string"
|
|
},
|
|
"EffortProfile": {
|
|
"enum": [
|
|
"light",
|
|
"medium",
|
|
"heavy"
|
|
],
|
|
"title": "EffortProfile",
|
|
"type": "string"
|
|
},
|
|
"ErrorResponse": {
|
|
"properties": {
|
|
"detail": {
|
|
"description": "Human-readable error description",
|
|
"title": "Detail",
|
|
"type": "string"
|
|
},
|
|
"error_code": {
|
|
"description": "Machine-readable error code",
|
|
"title": "Error Code",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"error_code",
|
|
"detail"
|
|
],
|
|
"title": "ErrorResponse",
|
|
"type": "object"
|
|
},
|
|
"FallbackPolicy": {
|
|
"enum": [
|
|
"rules_only_review",
|
|
"fail_run"
|
|
],
|
|
"title": "FallbackPolicy",
|
|
"type": "string"
|
|
},
|
|
"HTTPValidationError": {
|
|
"properties": {
|
|
"detail": {
|
|
"items": {
|
|
"$ref": "#/components/schemas/ValidationError"
|
|
},
|
|
"title": "Detail",
|
|
"type": "array"
|
|
}
|
|
},
|
|
"title": "HTTPValidationError",
|
|
"type": "object"
|
|
},
|
|
"HealthResponse": {
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"database": {
|
|
"default": "connected",
|
|
"enum": [
|
|
"connected",
|
|
"unreachable",
|
|
"unconfigured"
|
|
],
|
|
"title": "Database",
|
|
"type": "string"
|
|
},
|
|
"status": {
|
|
"default": "ok",
|
|
"enum": [
|
|
"ok",
|
|
"unhealthy"
|
|
],
|
|
"title": "Status",
|
|
"type": "string"
|
|
},
|
|
"version": {
|
|
"default": "0.1.0",
|
|
"title": "Version",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"title": "HealthResponse",
|
|
"type": "object"
|
|
},
|
|
"HitlPolicy": {
|
|
"properties": {
|
|
"confidence_threshold": {
|
|
"default": 0.8,
|
|
"maximum": 1.0,
|
|
"minimum": 0.0,
|
|
"title": "Confidence Threshold",
|
|
"type": "number"
|
|
},
|
|
"policy_version": {
|
|
"default": "1.0.0",
|
|
"maxLength": 64,
|
|
"title": "Policy Version",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"title": "HitlPolicy",
|
|
"type": "object"
|
|
},
|
|
"IdentityContext": {
|
|
"properties": {
|
|
"contact_id": {
|
|
"anyOf": [
|
|
{
|
|
"maxLength": 255,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Contact Id"
|
|
},
|
|
"details": {
|
|
"additionalProperties": true,
|
|
"title": "Details",
|
|
"type": "object"
|
|
},
|
|
"match_quality": {
|
|
"anyOf": [
|
|
{
|
|
"enum": [
|
|
"direct",
|
|
"phone_and_email",
|
|
"phone_and_name",
|
|
"phone_only"
|
|
],
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Match Quality"
|
|
}
|
|
},
|
|
"title": "IdentityContext",
|
|
"type": "object"
|
|
},
|
|
"LeadProfile": {
|
|
"properties": {
|
|
"custom_fields": {
|
|
"additionalProperties": true,
|
|
"title": "Custom Fields",
|
|
"type": "object"
|
|
},
|
|
"email": {
|
|
"anyOf": [
|
|
{
|
|
"maxLength": 255,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Email"
|
|
},
|
|
"ems_lead_id": {
|
|
"maxLength": 255,
|
|
"minLength": 1,
|
|
"title": "Ems Lead Id",
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"anyOf": [
|
|
{
|
|
"maxLength": 255,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Name"
|
|
},
|
|
"phone": {
|
|
"anyOf": [
|
|
{
|
|
"maxLength": 64,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Phone"
|
|
},
|
|
"status": {
|
|
"anyOf": [
|
|
{
|
|
"maxLength": 64,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Status"
|
|
}
|
|
},
|
|
"required": [
|
|
"ems_lead_id"
|
|
],
|
|
"title": "LeadProfile",
|
|
"type": "object"
|
|
},
|
|
"MessageEvidence": {
|
|
"properties": {
|
|
"content": {
|
|
"minLength": 1,
|
|
"title": "Content",
|
|
"type": "string"
|
|
},
|
|
"message_id": {
|
|
"maxLength": 255,
|
|
"minLength": 1,
|
|
"title": "Message Id",
|
|
"type": "string"
|
|
},
|
|
"sender_type": {
|
|
"$ref": "#/components/schemas/MessageSenderType"
|
|
},
|
|
"sent_at": {
|
|
"description": "Timezone-aware timestamp of when message was sent",
|
|
"format": "date-time",
|
|
"title": "Sent At",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"message_id",
|
|
"sender_type",
|
|
"content",
|
|
"sent_at"
|
|
],
|
|
"title": "MessageEvidence",
|
|
"type": "object"
|
|
},
|
|
"MessageSenderType": {
|
|
"enum": [
|
|
"contact",
|
|
"agent",
|
|
"bot"
|
|
],
|
|
"type": "string"
|
|
},
|
|
"RuleBreakdownItem": {
|
|
"properties": {
|
|
"detail": {
|
|
"title": "Detail",
|
|
"type": "string"
|
|
},
|
|
"points_awarded": {
|
|
"title": "Points Awarded",
|
|
"type": "integer"
|
|
},
|
|
"rule_name": {
|
|
"title": "Rule Name",
|
|
"type": "string"
|
|
},
|
|
"status": {
|
|
"$ref": "#/components/schemas/RuleEvaluationStatus"
|
|
}
|
|
},
|
|
"required": [
|
|
"rule_name",
|
|
"status",
|
|
"points_awarded",
|
|
"detail"
|
|
],
|
|
"title": "RuleBreakdownItem",
|
|
"type": "object"
|
|
},
|
|
"RuleEvaluationStatus": {
|
|
"enum": [
|
|
"matched",
|
|
"not_matched",
|
|
"skipped_missing_data"
|
|
],
|
|
"title": "RuleEvaluationStatus",
|
|
"type": "string"
|
|
},
|
|
"RuleMetric": {
|
|
"enum": [
|
|
"profile_field_count",
|
|
"conversation_count",
|
|
"message_count"
|
|
],
|
|
"title": "RuleMetric",
|
|
"type": "string"
|
|
},
|
|
"ScoringConfig": {
|
|
"properties": {
|
|
"age_primary_max": {
|
|
"default": 15,
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"title": "Age Primary Max",
|
|
"type": "integer"
|
|
},
|
|
"age_primary_min": {
|
|
"default": 3,
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"title": "Age Primary Min",
|
|
"type": "integer"
|
|
},
|
|
"age_primary_points": {
|
|
"default": 40,
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"title": "Age Primary Points",
|
|
"type": "integer"
|
|
},
|
|
"age_secondary_max": {
|
|
"default": 18,
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"title": "Age Secondary Max",
|
|
"type": "integer"
|
|
},
|
|
"age_secondary_min": {
|
|
"default": 16,
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"title": "Age Secondary Min",
|
|
"type": "integer"
|
|
},
|
|
"age_secondary_points": {
|
|
"default": 20,
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"title": "Age Secondary Points",
|
|
"type": "integer"
|
|
},
|
|
"ai_model": {
|
|
"default": "openai/gpt-4o-mini",
|
|
"maxLength": 64,
|
|
"minLength": 1,
|
|
"title": "Ai Model",
|
|
"type": "string"
|
|
},
|
|
"ai_timeout_seconds": {
|
|
"default": 10.0,
|
|
"exclusiveMinimum": 0.0,
|
|
"title": "Ai Timeout Seconds",
|
|
"type": "number"
|
|
},
|
|
"ai_weight": {
|
|
"default": 0.6,
|
|
"maximum": 1.0,
|
|
"minimum": 0.0,
|
|
"title": "Ai Weight",
|
|
"type": "number"
|
|
},
|
|
"base_score": {
|
|
"default": 0,
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"title": "Base Score",
|
|
"type": "integer"
|
|
},
|
|
"completeness_threshold": {
|
|
"default": 0.5,
|
|
"maximum": 1.0,
|
|
"minimum": 0.0,
|
|
"title": "Completeness Threshold",
|
|
"type": "number"
|
|
},
|
|
"confidence": {
|
|
"maximum": 1.0,
|
|
"minimum": 0.0,
|
|
"title": "Confidence",
|
|
"type": "number"
|
|
},
|
|
"confidence_threshold": {
|
|
"maximum": 1.0,
|
|
"minimum": 0.0,
|
|
"title": "Confidence Threshold",
|
|
"type": "number"
|
|
},
|
|
"dynamic_rules": {
|
|
"default": [],
|
|
"description": "Operator-configured dynamic rules evaluated against lead features",
|
|
"items": {
|
|
"$ref": "#/components/schemas/DynamicRule"
|
|
},
|
|
"title": "Dynamic Rules",
|
|
"type": "array"
|
|
},
|
|
"education_demo_enabled": {
|
|
"default": false,
|
|
"title": "Education Demo Enabled",
|
|
"type": "boolean"
|
|
},
|
|
"effort_profile": {
|
|
"$ref": "#/components/schemas/EffortProfile",
|
|
"default": "medium"
|
|
},
|
|
"fallback_policy": {
|
|
"$ref": "#/components/schemas/FallbackPolicy",
|
|
"default": "rules_only_review"
|
|
},
|
|
"hitl_policy_version": {
|
|
"maxLength": 64,
|
|
"minLength": 1,
|
|
"title": "Hitl Policy Version",
|
|
"type": "string"
|
|
},
|
|
"medium_extract_prompt": {
|
|
"default": "B\u1ea1n l\u00e0 tr\u1ee3 l\u00fd AI ph\u00e2n t\u00edch h\u1ed9i tho\u1ea1i \u0111\u1ec3 \u0111\u00e1nh gi\u00e1 ti\u1ec1m n\u0103ng h\u1ecdc vi\u00ean. H\u00e3y tr\u00edch xu\u1ea5t b\u1eb1ng ch\u1ee9ng c\u00f3 c\u1ea5u tr\u00fac v\u1ec1 nhu c\u1ea7u kh\u00f3a h\u1ecdc, m\u1ee9c \u0111\u1ed9 quan t\u00e2m, th\u1eddi \u0111i\u1ec3m \u0111\u0103ng k\u00fd v\u00e0 r\u00e0o c\u1ea3n. Tr\u1ea3 l\u1eddi b\u1eb1ng ti\u1ebfng Vi\u1ec7t v\u00e0 kh\u00f4ng t\u1ef1 b\u1ecba d\u1eef ki\u1ec7n.",
|
|
"description": "Editable system prompt for Medium AI evidence extraction pass",
|
|
"maxLength": 4000,
|
|
"minLength": 1,
|
|
"title": "Medium Extract Prompt",
|
|
"type": "string"
|
|
},
|
|
"medium_score_prompt": {
|
|
"default": "B\u1ea1n l\u00e0 chuy\u00ean gia ch\u1ea5m \u0111i\u1ec3m Lead gi\u00e1o d\u1ee5c t\u1eeb 0 \u0111\u1ebfn 100. D\u1ef1a tr\u00ean b\u1eb1ng ch\u1ee9ng \u0111\u00e3 tr\u00edch xu\u1ea5t, h\u00e3y \u0111\u00e1nh gi\u00e1 kh\u1ea3 n\u0103ng \u0111\u0103ng k\u00fd, \u0111\u1ed9 tin c\u1eady, l\u00fd do v\u00e0 c\u00e1c y\u1ebfu t\u1ed1 t\u00edch c\u1ef1c ho\u1eb7c ti\u00eau c\u1ef1c. L\u01b0u \u00fd: Kh\u00f4ng c\u1ed9ng l\u1ea1i \u0111i\u1ec3m c\u00e1c customer rules ho\u1eb7c metrics \u0111\u00e3 t\u00ednh \u1edf ph\u1ea7n quy t\u1eafc ri\u00eang. Tr\u1ea3 l\u1eddi b\u1eb1ng ti\u1ebfng Vi\u1ec7t v\u00e0 kh\u00f4ng t\u1ef1 b\u1ecba d\u1eef ki\u1ec7n.",
|
|
"description": "Editable system prompt for Medium AI lead scoring pass",
|
|
"maxLength": 4000,
|
|
"minLength": 1,
|
|
"title": "Medium Score Prompt",
|
|
"type": "string"
|
|
},
|
|
"recency_cold_max_days": {
|
|
"default": 30,
|
|
"minimum": 0.0,
|
|
"title": "Recency Cold Max Days",
|
|
"type": "number"
|
|
},
|
|
"recency_cold_points": {
|
|
"default": 5,
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"title": "Recency Cold Points",
|
|
"type": "integer"
|
|
},
|
|
"recency_cool_max_days": {
|
|
"default": 14,
|
|
"minimum": 0.0,
|
|
"title": "Recency Cool Max Days",
|
|
"type": "number"
|
|
},
|
|
"recency_cool_points": {
|
|
"default": 15,
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"title": "Recency Cool Points",
|
|
"type": "integer"
|
|
},
|
|
"recency_hot_max_days": {
|
|
"default": 3,
|
|
"minimum": 0.0,
|
|
"title": "Recency Hot Max Days",
|
|
"type": "number"
|
|
},
|
|
"recency_hot_points": {
|
|
"default": 40,
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"title": "Recency Hot Points",
|
|
"type": "integer"
|
|
},
|
|
"recency_warm_max_days": {
|
|
"default": 7,
|
|
"minimum": 0.0,
|
|
"title": "Recency Warm Max Days",
|
|
"type": "number"
|
|
},
|
|
"recency_warm_points": {
|
|
"default": 25,
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"title": "Recency Warm Points",
|
|
"type": "integer"
|
|
},
|
|
"rule_weight": {
|
|
"default": 0.4,
|
|
"maximum": 1.0,
|
|
"minimum": 0.0,
|
|
"title": "Rule Weight",
|
|
"type": "number"
|
|
},
|
|
"rules": {
|
|
"default": [],
|
|
"items": {
|
|
"$ref": "#/components/schemas/ScoringRule"
|
|
},
|
|
"title": "Rules",
|
|
"type": "array"
|
|
},
|
|
"selected_behavioral_metrics": {
|
|
"default": [
|
|
"message_count",
|
|
"conversation_count",
|
|
"conversation_turn_count",
|
|
"customer_message_count",
|
|
"customer_initiated_return"
|
|
],
|
|
"description": "System behavioral metrics calculated deterministically and supplied to AI context",
|
|
"items": {
|
|
"$ref": "#/components/schemas/BehavioralMetric"
|
|
},
|
|
"title": "Selected Behavioral Metrics",
|
|
"type": "array"
|
|
},
|
|
"source_call_in_points": {
|
|
"default": 15,
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"title": "Source Call In Points",
|
|
"type": "integer"
|
|
},
|
|
"source_campaign_points": {
|
|
"default": 8,
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"title": "Source Campaign Points",
|
|
"type": "integer"
|
|
},
|
|
"source_digital_points": {
|
|
"default": 10,
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"title": "Source Digital Points",
|
|
"type": "integer"
|
|
},
|
|
"source_other_points": {
|
|
"default": 5,
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"title": "Source Other Points",
|
|
"type": "integer"
|
|
},
|
|
"source_referral_points": {
|
|
"default": 20,
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"title": "Source Referral Points",
|
|
"type": "integer"
|
|
},
|
|
"version": {
|
|
"maxLength": 64,
|
|
"minLength": 1,
|
|
"title": "Version",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"version",
|
|
"confidence",
|
|
"confidence_threshold",
|
|
"hitl_policy_version"
|
|
],
|
|
"title": "ScoringConfig",
|
|
"type": "object"
|
|
},
|
|
"ScoringMode": {
|
|
"enum": [
|
|
"light_ai",
|
|
"medium_ai",
|
|
"heavy_ai",
|
|
"rules_only_fallback",
|
|
"rule_only"
|
|
],
|
|
"title": "ScoringMode",
|
|
"type": "string"
|
|
},
|
|
"ScoringRule": {
|
|
"properties": {
|
|
"metric": {
|
|
"$ref": "#/components/schemas/RuleMetric"
|
|
},
|
|
"minimum": {
|
|
"minimum": 0.0,
|
|
"title": "Minimum",
|
|
"type": "integer"
|
|
},
|
|
"points": {
|
|
"maximum": 100.0,
|
|
"minimum": -100.0,
|
|
"title": "Points",
|
|
"type": "integer"
|
|
}
|
|
},
|
|
"required": [
|
|
"metric",
|
|
"minimum",
|
|
"points"
|
|
],
|
|
"title": "ScoringRule",
|
|
"type": "object"
|
|
},
|
|
"ScoringRunResponse": {
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"ai_metadata": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/components/schemas/AiMetadataSuccess"
|
|
},
|
|
{
|
|
"$ref": "#/components/schemas/AiMetadataFailure"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Ai Metadata"
|
|
},
|
|
"ai_score": {
|
|
"anyOf": [
|
|
{
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"type": "integer"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Ai Score"
|
|
},
|
|
"breakdown": {
|
|
"anyOf": [
|
|
{
|
|
"items": {
|
|
"$ref": "#/components/schemas/RuleBreakdownItem"
|
|
},
|
|
"type": "array"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"description": "Rule evaluation breakdown",
|
|
"title": "Breakdown"
|
|
},
|
|
"category": {
|
|
"anyOf": [
|
|
{
|
|
"maxLength": 64,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"description": "Public lead tier / category derived deterministically from score",
|
|
"title": "Category"
|
|
},
|
|
"completed_at": {
|
|
"anyOf": [
|
|
{
|
|
"format": "date-time",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Completed At"
|
|
},
|
|
"confidence": {
|
|
"anyOf": [
|
|
{
|
|
"maximum": 1.0,
|
|
"minimum": 0.0,
|
|
"type": "number"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Confidence"
|
|
},
|
|
"confidence_threshold": {
|
|
"anyOf": [
|
|
{
|
|
"maximum": 1.0,
|
|
"minimum": 0.0,
|
|
"type": "number"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Confidence Threshold"
|
|
},
|
|
"created_at": {
|
|
"description": "Creation timestamp",
|
|
"format": "date-time",
|
|
"title": "Created At",
|
|
"type": "string"
|
|
},
|
|
"degraded": {
|
|
"anyOf": [
|
|
{
|
|
"type": "boolean"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Degraded"
|
|
},
|
|
"effective_config": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/components/schemas/ScoringConfig"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"effective_score": {
|
|
"anyOf": [
|
|
{
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"type": "integer"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Effective Score"
|
|
},
|
|
"error_code": {
|
|
"anyOf": [
|
|
{
|
|
"maxLength": 64,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Error Code"
|
|
},
|
|
"explanation": {
|
|
"anyOf": [
|
|
{
|
|
"maxLength": 1000,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"description": "Concise public explanation using AI reasoning where available or rule summary",
|
|
"title": "Explanation"
|
|
},
|
|
"final_score": {
|
|
"anyOf": [
|
|
{
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"type": "integer"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Final Score"
|
|
},
|
|
"parent_run_id": {
|
|
"anyOf": [
|
|
{
|
|
"maxLength": 36,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"description": "Parent scoring run ID if created via re-evaluation",
|
|
"title": "Parent Run Id"
|
|
},
|
|
"recommended_action": {
|
|
"anyOf": [
|
|
{
|
|
"maxLength": 255,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"description": "Deterministic recommended next action based on score",
|
|
"title": "Recommended Action"
|
|
},
|
|
"retryable": {
|
|
"anyOf": [
|
|
{
|
|
"type": "boolean"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Retryable"
|
|
},
|
|
"rule_score": {
|
|
"anyOf": [
|
|
{
|
|
"maximum": 100.0,
|
|
"minimum": 0.0,
|
|
"type": "integer"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Rule Score"
|
|
},
|
|
"run_id": {
|
|
"description": "Unique scoring run ID",
|
|
"maxLength": 36,
|
|
"title": "Run Id",
|
|
"type": "string"
|
|
},
|
|
"scoring_config_version": {
|
|
"description": "Scoring config version",
|
|
"maxLength": 64,
|
|
"title": "Scoring Config Version",
|
|
"type": "string"
|
|
},
|
|
"scoring_mode": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/components/schemas/ScoringMode"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"started_at": {
|
|
"anyOf": [
|
|
{
|
|
"format": "date-time",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Started At"
|
|
},
|
|
"status": {
|
|
"$ref": "#/components/schemas/ScoringRunStatus",
|
|
"description": "Current scoring run status"
|
|
},
|
|
"subject_ref": {
|
|
"description": "EMS Lead reference",
|
|
"maxLength": 255,
|
|
"title": "Subject Ref",
|
|
"type": "string"
|
|
},
|
|
"tenant_id": {
|
|
"description": "Tenant identifier",
|
|
"maxLength": 255,
|
|
"title": "Tenant Id",
|
|
"type": "string"
|
|
},
|
|
"updated_at": {
|
|
"description": "Last updated timestamp",
|
|
"format": "date-time",
|
|
"title": "Updated At",
|
|
"type": "string"
|
|
},
|
|
"version": {
|
|
"description": "Run version for optimistic concurrency",
|
|
"minimum": 1.0,
|
|
"title": "Version",
|
|
"type": "integer"
|
|
}
|
|
},
|
|
"required": [
|
|
"run_id",
|
|
"tenant_id",
|
|
"subject_ref",
|
|
"scoring_config_version",
|
|
"status",
|
|
"rule_score",
|
|
"ai_score",
|
|
"final_score",
|
|
"effective_score",
|
|
"scoring_mode",
|
|
"degraded",
|
|
"ai_metadata",
|
|
"confidence",
|
|
"confidence_threshold",
|
|
"effective_config",
|
|
"error_code",
|
|
"retryable",
|
|
"version",
|
|
"started_at",
|
|
"completed_at",
|
|
"created_at",
|
|
"updated_at"
|
|
],
|
|
"title": "ScoringRunResponse",
|
|
"type": "object"
|
|
},
|
|
"ScoringRunStatus": {
|
|
"enum": [
|
|
"pending",
|
|
"running",
|
|
"completed",
|
|
"review_required",
|
|
"failed",
|
|
"superseded"
|
|
],
|
|
"title": "ScoringRunStatus",
|
|
"type": "string"
|
|
},
|
|
"SnapshotScope": {
|
|
"enum": [
|
|
"trigger_only",
|
|
"linked_contact_history",
|
|
"multi_source_history"
|
|
],
|
|
"title": "SnapshotScope",
|
|
"type": "string"
|
|
},
|
|
"TriggerMetadata": {
|
|
"properties": {
|
|
"actor_id": {
|
|
"anyOf": [
|
|
{
|
|
"maxLength": 255,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Actor Id"
|
|
},
|
|
"trigger_conversation_id": {
|
|
"anyOf": [
|
|
{
|
|
"maxLength": 255,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Trigger Conversation Id"
|
|
},
|
|
"trigger_type": {
|
|
"default": "manual_omni",
|
|
"enum": [
|
|
"manual_omni",
|
|
"captain_tool",
|
|
"dev_console"
|
|
],
|
|
"title": "Trigger Type",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"title": "TriggerMetadata",
|
|
"type": "object"
|
|
},
|
|
"TruncationMetadata": {
|
|
"properties": {
|
|
"dropped_conversations_count": {
|
|
"default": 0,
|
|
"minimum": 0.0,
|
|
"title": "Dropped Conversations Count",
|
|
"type": "integer"
|
|
},
|
|
"dropped_messages_count": {
|
|
"default": 0,
|
|
"minimum": 0.0,
|
|
"title": "Dropped Messages Count",
|
|
"type": "integer"
|
|
},
|
|
"reason": {
|
|
"anyOf": [
|
|
{
|
|
"maxLength": 255,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Reason"
|
|
},
|
|
"truncated": {
|
|
"default": false,
|
|
"title": "Truncated",
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"title": "TruncationMetadata",
|
|
"type": "object"
|
|
},
|
|
"ValidationError": {
|
|
"properties": {
|
|
"ctx": {
|
|
"title": "Context",
|
|
"type": "object"
|
|
},
|
|
"input": {
|
|
"title": "Input"
|
|
},
|
|
"loc": {
|
|
"items": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "integer"
|
|
}
|
|
]
|
|
},
|
|
"title": "Location",
|
|
"type": "array"
|
|
},
|
|
"msg": {
|
|
"title": "Message",
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"title": "Error Type",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"loc",
|
|
"msg",
|
|
"type"
|
|
],
|
|
"title": "ValidationError",
|
|
"type": "object"
|
|
}
|
|
},
|
|
"securitySchemes": {
|
|
"HTTPBearer": {
|
|
"description": "Bearer service token for machine caller authentication",
|
|
"scheme": "bearer",
|
|
"type": "http"
|
|
}
|
|
}
|
|
},
|
|
"info": {
|
|
"description": "Lead Scoring service for AI Platform",
|
|
"title": "Lead Scoring Service",
|
|
"version": "0.1.0"
|
|
},
|
|
"openapi": "3.1.0",
|
|
"paths": {
|
|
"/health": {
|
|
"get": {
|
|
"operationId": "health_check_health_get",
|
|
"responses": {
|
|
"200": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HealthResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Service and database healthy"
|
|
},
|
|
"503": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HealthResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Database or critical dependency unreachable or unconfigured"
|
|
}
|
|
},
|
|
"summary": "Service Health Check",
|
|
"tags": [
|
|
"System"
|
|
]
|
|
}
|
|
},
|
|
"/v1/scoring-runs": {
|
|
"get": {
|
|
"operationId": "list_scoring_runs_v1_scoring_runs_get",
|
|
"parameters": [
|
|
{
|
|
"description": "Maximum number of recent runs to return",
|
|
"in": "query",
|
|
"name": "limit",
|
|
"required": false,
|
|
"schema": {
|
|
"default": 50,
|
|
"description": "Maximum number of recent runs to return",
|
|
"maximum": 100,
|
|
"minimum": 1,
|
|
"title": "Limit",
|
|
"type": "integer"
|
|
}
|
|
},
|
|
{
|
|
"description": "Number of recent runs to skip",
|
|
"in": "query",
|
|
"name": "offset",
|
|
"required": false,
|
|
"schema": {
|
|
"default": 0,
|
|
"description": "Number of recent runs to skip",
|
|
"minimum": 0,
|
|
"title": "Offset",
|
|
"type": "integer"
|
|
}
|
|
},
|
|
{
|
|
"description": "Tenant identifier for scoped tenant isolation query",
|
|
"in": "header",
|
|
"name": "X-Tenant-Id",
|
|
"required": true,
|
|
"schema": {
|
|
"description": "Tenant identifier for scoped tenant isolation query",
|
|
"maxLength": 255,
|
|
"minLength": 1,
|
|
"title": "X-Tenant-Id",
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"items": {
|
|
"$ref": "#/components/schemas/ScoringRunResponse"
|
|
},
|
|
"title": "Response 200 List Scoring Runs V1 Scoring Runs Get",
|
|
"type": "array"
|
|
}
|
|
}
|
|
},
|
|
"description": "Recent scoring runs scoped to the requested tenant",
|
|
"headers": {
|
|
"X-Total-Count": {
|
|
"description": "Authoritative total count of scoring runs for the tenant",
|
|
"schema": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"401": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Invalid or missing Bearer service token"
|
|
},
|
|
"403": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Caller not authorized for tenant"
|
|
},
|
|
"422": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
},
|
|
"description": "Validation Error"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"HTTPBearer": []
|
|
}
|
|
],
|
|
"summary": "List recent Scoring Runs for a tenant",
|
|
"tags": [
|
|
"Scoring Runs"
|
|
]
|
|
},
|
|
"post": {
|
|
"operationId": "create_scoring_run_v1_scoring_runs_post",
|
|
"parameters": [
|
|
{
|
|
"description": "Tenant-scoped idempotency key",
|
|
"in": "header",
|
|
"name": "Idempotency-Key",
|
|
"required": true,
|
|
"schema": {
|
|
"description": "Tenant-scoped idempotency key",
|
|
"maxLength": 255,
|
|
"minLength": 1,
|
|
"title": "Idempotency-Key",
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"description": "Originating DotB application identifier",
|
|
"in": "header",
|
|
"name": "X-DotB-App",
|
|
"required": true,
|
|
"schema": {
|
|
"description": "Originating DotB application identifier",
|
|
"maxLength": 64,
|
|
"minLength": 1,
|
|
"title": "X-Dotb-App",
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"description": "Originating DotB feature identifier",
|
|
"in": "header",
|
|
"name": "X-DotB-Feature",
|
|
"required": true,
|
|
"schema": {
|
|
"description": "Originating DotB feature identifier",
|
|
"maxLength": 64,
|
|
"minLength": 1,
|
|
"title": "X-Dotb-Feature",
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"description": "Optional tenant AIHub credential passed in RAM for execution attempt",
|
|
"in": "header",
|
|
"name": "X-Tenant-VKey",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"maxLength": 1024,
|
|
"minLength": 0,
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"description": "Optional tenant AIHub credential passed in RAM for execution attempt",
|
|
"title": "X-Tenant-Vkey"
|
|
}
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/CreateScoringRunRequest"
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"202": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/CreateScoringRunResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Scoring run accepted and persisted in pending state"
|
|
},
|
|
"401": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Invalid or missing Bearer service token"
|
|
},
|
|
"403": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Caller not authorized for tenant, app, or feature"
|
|
},
|
|
"409": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Idempotency key conflict with mismatched payload"
|
|
},
|
|
"422": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Validation error or structural caps exceeded"
|
|
},
|
|
"503": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Scoring admission is disabled by the operational kill switch"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"HTTPBearer": []
|
|
}
|
|
],
|
|
"summary": "Admit a new Lead Scoring Run",
|
|
"tags": [
|
|
"Scoring Runs"
|
|
]
|
|
}
|
|
},
|
|
"/v1/scoring-runs/configs": {
|
|
"get": {
|
|
"operationId": "list_scoring_configs_v1_scoring_runs_configs_get",
|
|
"parameters": [
|
|
{
|
|
"in": "header",
|
|
"name": "X-Tenant-Id",
|
|
"required": true,
|
|
"schema": {
|
|
"maxLength": 255,
|
|
"minLength": 1,
|
|
"title": "X-Tenant-Id",
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"in": "header",
|
|
"name": "X-DotB-App",
|
|
"required": true,
|
|
"schema": {
|
|
"maxLength": 64,
|
|
"minLength": 1,
|
|
"title": "X-Dotb-App",
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"in": "header",
|
|
"name": "X-DotB-Feature",
|
|
"required": true,
|
|
"schema": {
|
|
"maxLength": 64,
|
|
"minLength": 1,
|
|
"title": "X-Dotb-Feature",
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"items": {
|
|
"$ref": "#/components/schemas/ScoringConfig"
|
|
},
|
|
"title": "Response List Scoring Configs V1 Scoring Runs Configs Get",
|
|
"type": "array"
|
|
}
|
|
}
|
|
},
|
|
"description": "Successful Response"
|
|
},
|
|
"422": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
},
|
|
"description": "Validation Error"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"HTTPBearer": []
|
|
}
|
|
],
|
|
"summary": "List internal scoring configs",
|
|
"tags": [
|
|
"Scoring Runs"
|
|
]
|
|
},
|
|
"post": {
|
|
"operationId": "create_scoring_config_v1_scoring_runs_configs_post",
|
|
"parameters": [
|
|
{
|
|
"in": "header",
|
|
"name": "X-Tenant-Id",
|
|
"required": true,
|
|
"schema": {
|
|
"maxLength": 255,
|
|
"minLength": 1,
|
|
"title": "X-Tenant-Id",
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"in": "header",
|
|
"name": "X-DotB-App",
|
|
"required": true,
|
|
"schema": {
|
|
"maxLength": 64,
|
|
"minLength": 1,
|
|
"title": "X-Dotb-App",
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"in": "header",
|
|
"name": "X-DotB-Feature",
|
|
"required": true,
|
|
"schema": {
|
|
"maxLength": 64,
|
|
"minLength": 1,
|
|
"title": "X-Dotb-Feature",
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ScoringConfig"
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"201": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ScoringConfig"
|
|
}
|
|
}
|
|
},
|
|
"description": "Successful Response"
|
|
},
|
|
"422": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
},
|
|
"description": "Validation Error"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"HTTPBearer": []
|
|
}
|
|
],
|
|
"summary": "Register a process-local immutable internal scoring config",
|
|
"tags": [
|
|
"Scoring Runs"
|
|
]
|
|
}
|
|
},
|
|
"/v1/scoring-runs/{run_id}": {
|
|
"get": {
|
|
"operationId": "get_scoring_run_v1_scoring_runs__run_id__get",
|
|
"parameters": [
|
|
{
|
|
"description": "Scoring run ID",
|
|
"in": "path",
|
|
"name": "run_id",
|
|
"required": true,
|
|
"schema": {
|
|
"description": "Scoring run ID",
|
|
"maxLength": 36,
|
|
"minLength": 1,
|
|
"title": "Run Id",
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"description": "Tenant identifier for scoped tenant isolation query",
|
|
"in": "header",
|
|
"name": "X-Tenant-Id",
|
|
"required": true,
|
|
"schema": {
|
|
"description": "Tenant identifier for scoped tenant isolation query",
|
|
"maxLength": 255,
|
|
"minLength": 1,
|
|
"title": "X-Tenant-Id",
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ScoringRunResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Scoring run metadata and current status"
|
|
},
|
|
"401": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Invalid or missing Bearer service token"
|
|
},
|
|
"403": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Caller not authorized for tenant"
|
|
},
|
|
"404": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Scoring run not found for tenant"
|
|
},
|
|
"422": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Validation error for missing required headers"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"HTTPBearer": []
|
|
}
|
|
],
|
|
"summary": "Inspect Scoring Run status",
|
|
"tags": [
|
|
"Scoring Runs"
|
|
]
|
|
}
|
|
},
|
|
"/v1/scoring-runs/{run_id}/trace": {
|
|
"get": {
|
|
"operationId": "get_scoring_run_trace_v1_scoring_runs__run_id__trace_get",
|
|
"parameters": [
|
|
{
|
|
"description": "Scoring run ID",
|
|
"in": "path",
|
|
"name": "run_id",
|
|
"required": true,
|
|
"schema": {
|
|
"description": "Scoring run ID",
|
|
"maxLength": 36,
|
|
"minLength": 1,
|
|
"title": "Run Id",
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"description": "Tenant identifier for scoped tenant isolation query",
|
|
"in": "header",
|
|
"name": "X-Tenant-Id",
|
|
"required": true,
|
|
"schema": {
|
|
"description": "Tenant identifier for scoped tenant isolation query",
|
|
"maxLength": 255,
|
|
"minLength": 1,
|
|
"title": "X-Tenant-Id",
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"additionalProperties": true,
|
|
"title": "Response Get Scoring Run Trace V1 Scoring Runs Run Id Trace Get",
|
|
"type": "object"
|
|
}
|
|
}
|
|
},
|
|
"description": "Internal execution trace for scoring run"
|
|
},
|
|
"401": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Invalid or missing Bearer service token"
|
|
},
|
|
"403": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Caller unauthorized or trace disabled in production"
|
|
},
|
|
"404": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Scoring run or trace not found"
|
|
},
|
|
"422": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ErrorResponse"
|
|
}
|
|
}
|
|
},
|
|
"description": "Validation error for missing required headers"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"HTTPBearer": []
|
|
}
|
|
],
|
|
"summary": "Get internal execution trace for a scoring run (non-production only)",
|
|
"tags": [
|
|
"Scoring Runs"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|