diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f24a2b46..045729721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Removed invalid `required` from `ppl` responses ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646)) - Added schema for security API error responses ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646)) - Fixed `/{index}/_create/{id}` returning `201` ([#669](https://github.com/opensearch-project/opensearch-api-specification/pull/669)) +- Fixed `ml._common.yaml#SearchModelsResponse` and `SearchModelsHitsHit` ([#672](https://github.com/opensearch-project/opensearch-api-specification/pull/672)) ## [0.1.0] - 2024-10-25 diff --git a/spec/schemas/ml._common.yaml b/spec/schemas/ml._common.yaml index 46cffc9f3..36f6c4954 100644 --- a/spec/schemas/ml._common.yaml +++ b/spec/schemas/ml._common.yaml @@ -22,6 +22,14 @@ components: SearchModelsResponse: type: object properties: + took: + type: integer + description: The time taken to execute the search. + timed_out: + type: boolean + description: Whether the search timed out. + _shards: + $ref: '_common.yaml#/components/schemas/ShardStatistics' hits: $ref: '#/components/schemas/SearchModelsHits' required: @@ -35,6 +43,10 @@ components: type: array items: $ref: '#/components/schemas/SearchModelsHitsHit' + max_score: + type: number + format: float + description: The maximum score. required: - hits - total @@ -43,6 +55,7 @@ components: properties: value: type: integer + format: int64 description: The total number of hits. relation: type: string @@ -53,18 +66,140 @@ components: SearchModelsHitsHit: type: object properties: + _version: + $ref: '_common.yaml#/components/schemas/VersionNumber' + _seq_no: + $ref: '_common.yaml#/components/schemas/SequenceNumber' + _primary_term: + type: integer + description: The primary term. _index: - type: string - description: The index. + $ref: '_common.yaml#/components/schemas/IndexName' _id: + $ref: '_common.yaml#/components/schemas/Id' + _score: + type: number + format: float + description: The score. + _source: + $ref: '#/components/schemas/Source' + model_id: + $ref: '_common.yaml#/components/schemas/Name' + required: + - _score + Source: + type: object + properties: + last_deployed_time: + type: integer + format: int64 + description: The last deployed time. + model_version: type: string - description: The hit ID. + description: The model version. + version: + $ref: '_common.yaml#/components/schemas/VersionString' + created_time: + type: integer + format: int64 + description: The created time. + chunk_number: + type: integer + format: int64 + description: The chunk number. + deploy_to_all_nodes: + type: boolean + description: Whether to deploy to all nodes. + is_hidden: + type: boolean + description: Whether the model is hidden. model_id: + $ref: '_common.yaml#/components/schemas/Name' + description: type: string - description: The model ID. - required: - - _id - - model_id + description: The model description. + model_state: + type: string + description: The model state. + enum: + - DEPLOYED + - DEPLOYING + - DEPLOY_FAILED + - PARTIALLY_DEPLOYED + - REGISTERED + - REGISTERING + model_content_size_in_bytes: + type: integer + format: int64 + description: The model content size in bytes. + model_content_hash_value: + type: string + description: The model content hash value. + planning_worker_node_count: + type: number + description: The planning worker node count. + model_config: + $ref: '#/components/schemas/ModelConfig' + model_format: + type: string + description: The model format. + model_task_type: + type: string + description: The model task type. + last_updated_time: + type: integer + format: int64 + description: The last updated time. + last_registered_time: + type: integer + format: int64 + description: The last registered time. + auto_redeploy_retry_times: + type: integer + format: int64 + description: The auto redeploy retry times. + name: + type: string + description: The model name. + connector_id: + type: string + description: The connector ID. + current_worker_node_count: + type: number + description: The current worker node count. + model_group_id: + type: string + description: The model group ID. + planning_worker_nodes: + type: array + items: + $ref: '_common.yaml#/components/schemas/NodeIds' + total_chunks: + type: integer + format: int64 + description: The total chunks. + algorithm: + type: string + description: The algorithm. + url: + type: string + description: The model URL. + ModelConfig: + type: object + properties: + all_config: + type: string + description: The all config. + model_type: + type: string + description: The model type. + embedding_dimension: + type: integer + format: int64 + description: The embedding dimension. + framework_type: + type: string + description: The framework type. ModelGroupRegistration: type: object properties: diff --git a/tests/plugins/ml/ml/models.yaml b/tests/plugins/ml/ml/models.yaml index ce087654f..92cac3ca3 100644 --- a/tests/plugins/ml/ml/models.yaml +++ b/tests/plugins/ml/ml/models.yaml @@ -37,6 +37,20 @@ chapters: retry: count: 5 wait: 30000 + - synopsis: Search model. + path: /_plugins/_ml/models/_search + method: GET + request: + payload: + query: + match_all: {} + size: 1000 + response: + status: 200 + payload: + hits: + hits: + - _score: 1 - synopsis: Delete model. path: /_plugins/_ml/models/{model_id} parameters: diff --git a/tests/plugins/ml/ml/tasks.yaml b/tests/plugins/ml/ml/tasks.yaml new file mode 100644 index 000000000..542ea3468 --- /dev/null +++ b/tests/plugins/ml/ml/tasks.yaml @@ -0,0 +1,28 @@ +$schema: ../../../../json_schemas/test_story.schema.yaml + +description: Test the creation of tasks. +version: '>= 2.11' +warnings: + multiple-paths-detected: false +chapters: + - synopsis: Register model. + id: register_model + path: /_plugins/_ml/models/_register + method: POST + request: + payload: + name: huggingface/sentence-transformers/msmarco-distilbert-base-tas-b + version: 1.0.1 + model_format: TORCH_SCRIPT + response: + status: 200 + output: + task_id: payload.task_id + - synopsis: Delete task. + id: delete_task + path: /_plugins/_ml/tasks/{task_id} + method: DELETE + parameters: + task_id: ${register_model.task_id} + response: + status: 200 \ No newline at end of file