{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/coactive/main/json-schema/coactive-agentic-search-chat-response-schema.json",
  "title": "ChatResponse",
  "description": "Response schema for chat endpoint.",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/coactive-agentic-search-agenticsearch-api-openapi.yml#/components/schemas/agentic-search_ChatResponse",
  "type": "object",
  "properties": {
    "chat_response_text": {
      "type": "string",
      "description": "LLM response text"
    },
    "tool_results": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/agentic-search_ToolResult"
      },
      "description": "Results from MCP tools invoked during this request. "
    },
    "history_chat_messages": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": {
          "description": "Any type"
        }
      },
      "description": "Conversation history (includes current message)"
    },
    "suggested_follow_ups": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Suggested follow-up messages to continue the conversation"
    }
  },
  "required": [
    "chat_response_text",
    "tool_results",
    "history_chat_messages",
    "suggested_follow_ups"
  ],
  "$defs": {
    "agentic-search_AudioChunk": {
      "type": "object",
      "properties": {
        "coactive_image_id": {
          "type": "string",
          "format": "uuid"
        },
        "video": {
          "$ref": "#/$defs/agentic-search_Video"
        },
        "start_time_ms": {
          "type": "integer"
        },
        "end_time_ms": {
          "type": "integer"
        },
        "score": {
          "type": "number",
          "format": "double"
        },
        "timestamp": {
          "type": [
            "integer",
            "null"
          ]
        },
        "moderation_score": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        }
      },
      "required": [
        "coactive_image_id",
        "video",
        "start_time_ms",
        "end_time_ms",
        "score"
      ],
      "description": "A single audio chunk result.",
      "title": "AudioChunk"
    },
    "agentic-search_AudioSegment": {
      "type": "object",
      "properties": {
        "start_time_ms": {
          "type": "integer"
        },
        "end_time_ms": {
          "type": "integer"
        },
        "speech_to_text_transcription": {
          "type": "string"
        }
      },
      "required": [
        "start_time_ms",
        "end_time_ms",
        "speech_to_text_transcription"
      ],
      "description": "Metadata about a video audio segment.",
      "title": "AudioSegment"
    },
    "agentic-search_AudioSoundSearchResponse": {
      "type": "object",
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/agentic-search_AudioChunk"
          }
        }
      },
      "description": "Response schema for apollo_search_audio_sound_search tool.",
      "title": "AudioSoundSearchResponse"
    },
    "agentic-search_CompositeSlice": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "index": {
          "type": [
            "integer",
            "null"
          ]
        },
        "start_frame_num": {
          "type": [
            "integer",
            "null"
          ]
        },
        "end_frame_num": {
          "type": [
            "integer",
            "null"
          ]
        },
        "start_time_ms": {
          "type": [
            "integer",
            "null"
          ]
        },
        "end_time_ms": {
          "type": [
            "integer",
            "null"
          ]
        },
        "composite_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "composite_type": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "composite_type"
      ],
      "description": "Composite slice details (used by both video search and transcript matching).",
      "title": "CompositeSlice"
    },
    "agentic-search_CompositeSliceWithScore": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "index": {
          "type": [
            "integer",
            "null"
          ]
        },
        "start_frame_num": {
          "type": [
            "integer",
            "null"
          ]
        },
        "end_frame_num": {
          "type": [
            "integer",
            "null"
          ]
        },
        "start_time_ms": {
          "type": [
            "integer",
            "null"
          ]
        },
        "end_time_ms": {
          "type": [
            "integer",
            "null"
          ]
        },
        "composite_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "composite_type": {
          "type": "string"
        },
        "composite_slice_score": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        }
      },
      "required": [
        "id",
        "composite_type"
      ],
      "description": "Composite slice details with drill-down information.",
      "title": "CompositeSliceWithScore"
    },
    "agentic-search_DatasetType": {
      "type": "string",
      "enum": [
        "native_video",
        "legacy"
      ],
      "description": "Dataset type enum.",
      "title": "DatasetType"
    },
    "agentic-search_GetVideoDetailsResponse": {
      "type": "object",
      "properties": {
        "dataset_id": {
          "type": "string",
          "format": "uuid"
        },
        "text_query": {
          "type": "string"
        },
        "video_id": {
          "type": "string",
          "format": "uuid"
        },
        "composite_type": {
          "type": "string"
        },
        "source_path": {
          "type": "string"
        },
        "slices": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/agentic-search_CompositeSliceWithScore"
          }
        }
      },
      "required": [
        "dataset_id",
        "text_query",
        "video_id",
        "composite_type",
        "source_path"
      ],
      "description": "Response schema for get_video_details tool.",
      "title": "GetVideoDetailsResponse"
    },
    "agentic-search_HybridSearchResponse": {
      "type": "object",
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/agentic-search_HybridSearchResultItem"
          }
        }
      },
      "description": "Response schema for hybrid search tool.",
      "title": "HybridSearchResponse"
    },
    "agentic-search_HybridSearchResultItem": {
      "type": "object",
      "properties": {
        "coactive_image_id": {
          "type": "string",
          "format": "uuid"
        },
        "path": {
          "type": [
            "string",
            "null"
          ]
        },
        "metadata": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "description": "Any type"
          }
        },
        "moderation_score": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "relevance_score": {
          "type": "number",
          "format": "double"
        }
      },
      "required": [
        "coactive_image_id",
        "relevance_score"
      ],
      "description": "Single hybrid search result item.",
      "title": "HybridSearchResultItem"
    },
    "agentic-search_ImageKeyframeSearchResponse": {
      "type": "object",
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/agentic-search_ImageKeyframeSearchResultItem"
          }
        }
      },
      "description": "Response schema for image and keyframe search tools.",
      "title": "ImageKeyframeSearchResponse"
    },
    "agentic-search_ImageKeyframeSearchResultItem": {
      "type": "object",
      "properties": {
        "coactive_image_id": {
          "type": "string",
          "format": "uuid"
        },
        "path": {
          "type": [
            "string",
            "null"
          ]
        },
        "metadata": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "description": "Any type"
          }
        },
        "moderation_score": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "video": {
          "oneOf": [
            {
              "$ref": "#/$defs/agentic-search_Video"
            },
            {
              "type": "null"
            }
          ]
        },
        "shot": {
          "oneOf": [
            {
              "$ref": "#/$defs/agentic-search_Shot"
            },
            {
              "type": "null"
            }
          ]
        },
        "audio_segment": {
          "oneOf": [
            {
              "$ref": "#/$defs/agentic-search_AudioSegment"
            },
            {
              "type": "null"
            }
          ]
        },
        "timestamp": {
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "required": [
        "coactive_image_id"
      ],
      "description": "Base result item with common fields for image and keyframe search results.",
      "title": "ImageKeyframeSearchResultItem"
    },
    "agentic-search_KeyframeSearchResponse": {
      "type": "object",
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/agentic-search_KeyframeSearchResultItem"
          }
        }
      },
      "description": "Response schema for keyframe search tool.",
      "title": "KeyframeSearchResponse"
    },
    "agentic-search_KeyframeSearchResultItem": {
      "type": "object",
      "properties": {
        "keyframe_id": {
          "type": "string",
          "format": "uuid"
        },
        "score": {
          "type": "number",
          "format": "double"
        },
        "asset_type": {
          "type": "string"
        },
        "dataset_id": {
          "type": "string",
          "format": "uuid"
        },
        "video_id": {
          "type": "string",
          "format": "uuid"
        },
        "composite_slice_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "moderation_score": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        }
      },
      "required": [
        "keyframe_id",
        "score",
        "asset_type",
        "dataset_id",
        "video_id"
      ],
      "description": "Single keyframe search result item.",
      "title": "KeyframeSearchResultItem"
    },
    "agentic-search_MetadataFilterTriggerResponse": {
      "type": "object",
      "properties": {
        "run_id": {
          "type": "integer"
        }
      },
      "required": [
        "run_id"
      ],
      "description": "All metadata-filter search tools now return an async job run_id.",
      "title": "MetadataFilterTriggerResponse"
    },
    "agentic-search_Shot": {
      "type": "object",
      "properties": {
        "shot_id": {
          "type": "string",
          "format": "uuid"
        },
        "start_time_ms": {
          "type": "integer"
        },
        "end_time_ms": {
          "type": "integer"
        }
      },
      "required": [
        "shot_id",
        "start_time_ms",
        "end_time_ms"
      ],
      "description": "Metadata about a video shot.",
      "title": "Shot"
    },
    "agentic-search_TextToImageSearchByPersonResponse": {
      "type": "object",
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/agentic-search_TextToImageSearchByPersonResultItem"
          }
        },
        "videos": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/agentic-search_TextToImageSearchByPersonVideoResult"
          }
        }
      },
      "description": "Response schema for text_to_image_search_by_person tool.",
      "title": "TextToImageSearchByPersonResponse"
    },
    "agentic-search_TextToImageSearchByPersonResultItem": {
      "type": "object",
      "properties": {
        "coactive_image_id": {
          "type": "string",
          "format": "uuid"
        },
        "asset_type": {
          "type": "string"
        },
        "dataset_id": {
          "type": "string",
          "format": "uuid"
        },
        "video_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "composite_slice_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "composite_type": {
          "type": [
            "string",
            "null"
          ]
        },
        "composite_start_time_ms": {
          "type": [
            "integer",
            "null"
          ]
        },
        "composite_end_time_ms": {
          "type": [
            "integer",
            "null"
          ]
        },
        "moderation_score": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        }
      },
      "required": [
        "coactive_image_id",
        "asset_type",
        "dataset_id"
      ],
      "description": "Single result item for text-to-image search by person.",
      "title": "TextToImageSearchByPersonResultItem"
    },
    "agentic-search_TextToImageSearchByPersonVideoResult": {
      "type": "object",
      "properties": {
        "video_id": {
          "type": "string",
          "format": "uuid"
        },
        "moderation_score": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        }
      },
      "required": [
        "video_id"
      ],
      "description": "Video result aggregated from person search results.",
      "title": "TextToImageSearchByPersonVideoResult"
    },
    "agentic-search_ToolName": {
      "type": "string",
      "enum": [
        "video_search_search_videos",
        "video_search_get_video_details",
        "apollo_search_image_to_image",
        "apollo_search_image_to_keyframes",
        "apollo_search_hybrid_search",
        "apollo_search_transcript_exact_match",
        "apollo_search_audio_search",
        "apollo_search_audio_sound_search",
        "apollo_search_text_to_image_search_by_person",
        "metadata_filter_search_text_to_video_with_metadata_filters",
        "metadata_filter_search_text_to_transcript_with_metadata_filters",
        "metadata_filter_search_audio_sound_with_metadata_filters",
        "metadata_filter_search_text_to_image_with_metadata_filters"
      ],
      "description": "Enum of available MCP tool names.",
      "title": "ToolName"
    },
    "agentic-search_ToolResult": {
      "type": "object",
      "properties": {
        "tool_name": {
          "$ref": "#/$defs/agentic-search_ToolName",
          "description": "Name of the MCP tool that was invoked"
        },
        "dataset_id": {
          "type": "string",
          "format": "uuid",
          "description": "ID of the dataset that the tool was invoked for"
        },
        "dataset_type": {
          "$ref": "#/$defs/agentic-search_DatasetType",
          "description": "Type of the dataset that the tool was invoked for"
        },
        "invocation_timestamp": {
          "type": "string",
          "description": "Timestamp of the MCP tool invocation (ISO 8601 format)"
        },
        "result": {
          "$ref": "#/$defs/agentic-search_ToolResultResult",
          "description": "Result from the MCP tool invocation"
        }
      },
      "required": [
        "tool_name",
        "dataset_id",
        "dataset_type",
        "invocation_timestamp",
        "result"
      ],
      "description": "Result from a MCP tool invocation.",
      "title": "ToolResult"
    },
    "agentic-search_ToolResultResult": {
      "oneOf": [
        {
          "$ref": "#/$defs/agentic-search_VideoSearchResponse"
        },
        {
          "$ref": "#/$defs/agentic-search_ImageKeyframeSearchResponse"
        },
        {
          "$ref": "#/$defs/agentic-search_KeyframeSearchResponse"
        },
        {
          "$ref": "#/$defs/agentic-search_TranscriptExactMatchResponse"
        },
        {
          "$ref": "#/$defs/agentic-search_HybridSearchResponse"
        },
        {
          "$ref": "#/$defs/agentic-search_GetVideoDetailsResponse"
        },
        {
          "$ref": "#/$defs/agentic-search_TextToImageSearchByPersonResponse"
        },
        {
          "$ref": "#/$defs/agentic-search_MetadataFilterTriggerResponse"
        },
        {
          "$ref": "#/$defs/agentic-search_AudioSoundSearchResponse"
        }
      ],
      "description": "Result from the MCP tool invocation",
      "title": "ToolResultResult"
    },
    "agentic-search_TranscriptExactMatchResponse": {
      "type": "object",
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/agentic-search_VideoTranscriptMatch"
          }
        }
      },
      "description": "Response schema for apollo_search_transcript_exact_match tool.",
      "title": "TranscriptExactMatchResponse"
    },
    "agentic-search_Video": {
      "type": "object",
      "properties": {
        "coactive_video_id": {
          "type": "string",
          "format": "uuid"
        },
        "path": {
          "type": [
            "string",
            "null"
          ]
        },
        "metadata": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "description": "Any type"
          }
        }
      },
      "required": [
        "coactive_video_id"
      ],
      "description": "Video asset metadata.",
      "title": "Video"
    },
    "agentic-search_VideoKeyframe": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "frame_time_ms": {
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "required": [
        "id"
      ],
      "description": "Video keyframe details.",
      "title": "VideoKeyframe"
    },
    "agentic-search_VideoMetadata": {
      "type": "object",
      "properties": {
        "data": {
          "type": "object",
          "additionalProperties": {
            "description": "Any type"
          }
        }
      },
      "description": "Metadata associated with a video.",
      "title": "VideoMetadata"
    },
    "agentic-search_VideoSearchResponse": {
      "type": "object",
      "properties": {
        "results": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/agentic-search_VideoSearchResultItem"
          }
        }
      },
      "description": "Response schema for search_videos tool.",
      "title": "VideoSearchResponse"
    },
    "agentic-search_VideoSearchResultItem": {
      "type": "object",
      "properties": {
        "dataset_id": {
          "type": "string",
          "format": "uuid"
        },
        "text_query": {
          "type": "string"
        },
        "video_id": {
          "type": "string",
          "format": "uuid"
        },
        "source_path": {
          "type": "string"
        },
        "video_score": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "metadata": {
          "oneOf": [
            {
              "$ref": "#/$defs/agentic-search_VideoSearchResultItemMetadata"
            },
            {
              "type": "null"
            }
          ]
        },
        "top_composite_slice": {
          "oneOf": [
            {
              "$ref": "#/$defs/agentic-search_CompositeSlice"
            },
            {
              "type": "null"
            }
          ]
        },
        "top_keyframe": {
          "oneOf": [
            {
              "$ref": "#/$defs/agentic-search_VideoKeyframe"
            },
            {
              "type": "null"
            }
          ]
        },
        "moderation_score": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        }
      },
      "required": [
        "dataset_id",
        "text_query",
        "video_id",
        "source_path"
      ],
      "description": "Single video search result item.",
      "title": "VideoSearchResultItem"
    },
    "agentic-search_VideoSearchResultItemMetadata": {
      "oneOf": [
        {
          "$ref": "#/$defs/agentic-search_VideoMetadata"
        },
        {
          "type": "object",
          "additionalProperties": {
            "description": "Any type"
          }
        }
      ],
      "title": "VideoSearchResultItemMetadata"
    },
    "agentic-search_VideoTranscriptMatch": {
      "type": "object",
      "properties": {
        "coactive_image_id": {
          "type": "string",
          "format": "uuid"
        },
        "video": {
          "$ref": "#/$defs/agentic-search_Video"
        },
        "audio_segment": {
          "$ref": "#/$defs/agentic-search_AudioSegment"
        },
        "coverage_score": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "timestamp": {
          "type": [
            "integer",
            "null"
          ]
        },
        "moderation_score": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        }
      },
      "required": [
        "coactive_image_id",
        "video",
        "audio_segment"
      ],
      "description": "A single transcript match result with keyframe and slice information.",
      "title": "VideoTranscriptMatch"
    }
  }
}