Skip to content

Commit

Permalink
Added ML Model APIs (upload chunk), moved test for deprecated chunk u…
Browse files Browse the repository at this point in the history
…pload to create_metadata.yaml, updated CHANGELOG.

Signed-off-by: Nathalie Jonathan <[email protected]>
  • Loading branch information
nathaliellenaa committed Dec 20, 2024
1 parent 382477b commit 33aab02
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 17 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added support for combining output variables ([#737](https://github.com/opensearch-project/opensearch-api-specification/pull/737))
- Added 404 response to `/_search/scroll` ([#749](https://github.com/opensearch-project/opensearch-api-specification/pull/749))
- Added `node_failures` to `DELETE /_search/scroll` and `DELETE /_search/scroll/{scroll_id}` ([#749](https://github.com/opensearch-project/opensearch-api-specification/pull/749))
- Added `GET /_plugins/_ml/models/{model_id}`, `POST /_plugins/_ml/models/_search`, `POST /_plugins/_ml/models/_unload`, `_undeploy`, `_upload`, `meta`, `_register_meta`, `POST /_plugins/_ml/models/{model_id}/_load`, `_predict`, `_unload`, `chunk/{index}`, and `PUT /_plugins/_ml/models/{model_id}` ([#733](https://github.com/opensearch-project/opensearch-api-specification/pull/733))
- Added `GET /_plugins/_ml/models/{model_id}`, `POST /_plugins/_ml/models/_search`, `POST /_plugins/_ml/models/_unload`, `_undeploy`, `_upload`, `meta`, `_register_meta`, `POST /_plugins/_ml/models/{model_id}/_load`, `_predict`, `_unload`, `chunk/{chunk_number}`, `upload_chunk/{chunk_number}`, and `PUT /_plugins/_ml/models/{model_id}` ([#733](https://github.com/opensearch-project/opensearch-api-specification/pull/733))

### Removed
- Removed unsupported `_common.mapping:SourceField`'s `mode` field and associated `_common.mapping:SourceFieldMode` enum ([#652](https://github.com/opensearch-project/opensearch-api-specification/pull/652))
Expand Down Expand Up @@ -82,6 +82,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed response schema for `GET /_plugins/_security/api/nodesdn/{cluster_name}` ([#731](https://github.com/opensearch-project/opensearch-api-specification/pull/731))
- Fixed request body for `/_search/scroll/{scroll_id}` ([#732](https://github.com/opensearch-project/opensearch-api-specification/pull/732))
- Fixed type in `_msearch/template` ([#735](https://github.com/opensearch-project/opensearch-api-specification/pull/735))
- Fixed indices API schemas ([#750](https://github.com/opensearch-project/opensearch-api-specification/pull/750))

### Changed
- Changed `tasks._common:TaskInfo` and `tasks._common:TaskGroup` to be composed of a `tasks._common:TaskInfoBase` ([#683](https://github.com/opensearch-project/opensearch-api-specification/pull/683))
Expand Down
62 changes: 56 additions & 6 deletions spec/namespaces/ml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,34 @@ paths:
responses:
'200':
$ref: '#/components/responses/ml.register_model_meta@200'
/_plugins/_ml/models/{model_id}/chunk/{index}:
/_plugins/_ml/models/{model_id}/chunk/{chunk_number}:
post:
operationId: ml.chunk_model.0
x-operation-group: ml.chunk_model
description: Chunks model.
deprecated: true
x-deprecation-message: Use `upload_chunk` instead.
description: Uploads model chunk.
parameters:
- $ref: '#/components/parameters/ml.chunk_model::path.index'
- $ref: '#/components/parameters/ml.chunk_model::path.chunk_number'
- $ref: '#/components/parameters/ml.chunk_model::path.model_id'
requestBody:
$ref: '#/components/requestBodies/ml.chunk_model'
responses:
'200':
$ref: '#/components/responses/ml.chunk_model@200'
/_plugins/_ml/models/{model_id}/upload_chunk/{chunk_number}:
post:
operationId: ml.upload_chunk.0
x-operation-group: ml.upload_chunk
description: Uploads model chunk.
parameters:
- $ref: '#/components/parameters/ml.upload_chunk::path.chunk_number'
- $ref: '#/components/parameters/ml.upload_chunk::path.model_id'
requestBody:
$ref: '#/components/requestBodies/ml.upload_chunk'
responses:
'200':
$ref: '#/components/responses/ml.upload_chunk@200'
/_plugins/_ml/models/_upload:
post:
operationId: ml.upload_model.0
Expand Down Expand Up @@ -418,6 +433,17 @@ components:
description: The model chunk.
required:
- chunk
ml.upload_chunk:
content:
application/json:
schema:
type: object
properties:
chunk:
type: string
description: The model chunk.
required:
- chunk
ml.upload_model:
content:
application/json:
Expand Down Expand Up @@ -655,7 +681,18 @@ components:
properties:
status:
type: string
description: The status of the chunking operation.
description: The status of the chunk upload operation.
required:
- status
ml.upload_chunk@200:
content:
application/json:
schema:
type: object
properties:
status:
type: string
description: The status of the chunk upload operation.
required:
- status
ml.upload_model@200:
Expand Down Expand Up @@ -843,8 +880,8 @@ components:
required: true
schema:
type: string
ml.chunk_model::path.index:
name: index
ml.chunk_model::path.chunk_number:
name: chunk_number
in: path
required: true
schema:
Expand All @@ -856,6 +893,19 @@ components:
required: true
schema:
type: string
ml.upload_chunk::path.chunk_number:
name: chunk_number
in: path
required: true
schema:
type: integer
format: int64
ml.upload_chunk::path.model_id:
name: model_id
in: path
required: true
schema:
type: string
ml.delete_task::path.task_id:
name: task_id
in: path
Expand Down
46 changes: 43 additions & 3 deletions tests/plugins/ml/models/create_metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
$schema: ../../../../json_schemas/test_story.schema.yaml

description: Test the creation of model metadata using meta API (deprecated).
description: Test deprecated meta and chunk APIs for model creation and chunk upload.
distributions:
excluded:
- amazon-managed
- amazon-serverless
version: '>= 2.11'
warnings:
multiple-paths-detected: false
prologues:
- path: /_cluster/settings
method: PUT
Expand Down Expand Up @@ -39,4 +40,43 @@ chapters:
response:
status: 200
output:
model_id: payload.model_id
model_id: payload.model_id
- synopsis: Upload chunk 0.
path: /_plugins/_ml/models/{model_id}/chunk/{chunk_number}
method: POST
parameters:
chunk_number: 0
model_id: ${model_metadata.model_id}
request:
payload:
chunk: chunk0
response:
status: 200
payload:
status: Uploaded
- synopsis: Upload chunk 1.
path: /_plugins/_ml/models/{model_id}/chunk/{chunk_number}
method: POST
parameters:
chunk_number: 1
model_id: ${model_metadata.model_id}
request:
payload:
chunk: chunk1
response:
status: 200
payload:
status: Uploaded
- synopsis: Upload chunk 2.
path: /_plugins/_ml/models/{model_id}/chunk/{chunk_number}
method: POST
parameters:
chunk_number: 2
model_id: ${model_metadata.model_id}
request:
payload:
chunk: chunk2
response:
status: 200
payload:
status: Uploaded
14 changes: 7 additions & 7 deletions tests/plugins/ml/models/register_metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$schema: ../../../../json_schemas/test_story.schema.yaml

description: Test the creation of model metadata and chunking.
description: Test the creation of model metadata and upload model chunk.
distributions:
excluded:
- amazon-managed
Expand Down Expand Up @@ -43,10 +43,10 @@ chapters:
output:
model_id: payload.model_id
- synopsis: Upload chunk 0.
path: /_plugins/_ml/models/{model_id}/chunk/{index}
path: /_plugins/_ml/models/{model_id}/upload_chunk/{chunk_number}
method: POST
parameters:
index: 0
chunk_number: 0
model_id: ${model_metadata.model_id}
request:
payload:
Expand All @@ -56,10 +56,10 @@ chapters:
payload:
status: Uploaded
- synopsis: Upload chunk 1.
path: /_plugins/_ml/models/{model_id}/chunk/{index}
path: /_plugins/_ml/models/{model_id}/upload_chunk/{chunk_number}
method: POST
parameters:
index: 1
chunk_number: 1
model_id: ${model_metadata.model_id}
request:
payload:
Expand All @@ -69,10 +69,10 @@ chapters:
payload:
status: Uploaded
- synopsis: Upload chunk 2.
path: /_plugins/_ml/models/{model_id}/chunk/{index}
path: /_plugins/_ml/models/{model_id}/upload_chunk/{chunk_number}
method: POST
parameters:
index: 2
chunk_number: 2
model_id: ${model_metadata.model_id}
request:
payload:
Expand Down

0 comments on commit 33aab02

Please sign in to comment.