Skip to content

Commit

Permalink
Split get_all variants out of ml.get_memory and ml.get_message (#…
Browse files Browse the repository at this point in the history
…796)

* Split `get_all` variants out of `ml.get_memory` and `ml.get_message`

Signed-off-by: Thomas Farr <[email protected]>

* Fixing tests

Signed-off-by: Thomas Farr <[email protected]>

* Re-org test files

Signed-off-by: Thomas Farr <[email protected]>

* Fix typo

Signed-off-by: Thomas Farr <[email protected]>

* Fix schema path

Signed-off-by: Thomas Farr <[email protected]>

---------

Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia authored Jan 15, 2025
1 parent 1681adc commit 1422af3
Show file tree
Hide file tree
Showing 12 changed files with 278 additions and 161 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Changed `SearchModelsQuery`, `CreateConnectorRequest` & `RegisterAgentsRequest` to be defined inline of request bodies ([#725](https://github.com/opensearch-project/opensearch-api-specification/pull/725))
- Changed `indices.data_streams_stats:DataStreamsStatsItem` to instead be `indices._common:DataStreamStats` ([#725](https://github.com/opensearch-project/opensearch-api-specification/pull/725))
- Changed naming of `snapshot._common`'s `Status`, `ShardsStats`, `ShardsStatsStage`, `ShardsStatsSummary` and `ShardsStatsSummaryItem` schemas to be prefixed with `Snapshot` ([#730](https://github.com/opensearch-project/opensearch-api-specification/pull/730))
- Changed `ml.get_memory` and `ml.get_message` to split out `get_all` variants ([#796](https://github.com/opensearch-project/opensearch-api-specification/pull/796))

## [0.1.0] - 2024-10-25

Expand Down
167 changes: 122 additions & 45 deletions spec/namespaces/ml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -428,15 +428,16 @@ paths:
$ref: '#/components/responses/ml.delete_agent@200'
/_plugins/_ml/memory:
get:
operationId: ml.get_memory.0
x-operation-group: ml.get_memory
operationId: ml.get_all_memories.0
x-operation-group: ml.get_all_memories
x-version-added: '2.12'
description: Get a memory.
requestBody:
$ref: '#/components/requestBodies/ml.get_memory'
description: Get all memories.
parameters:
- $ref: '#/components/parameters/ml.get_all_memories::query.max_results'
- $ref: '#/components/parameters/ml.get_all_memories::query.next_token'
responses:
'200':
$ref: '#/components/responses/ml.get_memory@200'
$ref: '#/components/responses/ml.get_all_memories@200'
post:
operationId: ml.create_memory.0
x-operation-group: ml.create_memory
Expand All @@ -449,12 +450,10 @@ paths:
$ref: '#/components/responses/ml.create_memory@200'
/_plugins/_ml/memory/{memory_id}:
get:
operationId: ml.get_memory.1
operationId: ml.get_memory.0
x-operation-group: ml.get_memory
x-version-added: '2.12'
description: Get a memory.
requestBody:
$ref: '#/components/requestBodies/ml.get_memory'
parameters:
- $ref: '#/components/parameters/ml.get_memory::path.memory_id'
responses:
Expand Down Expand Up @@ -505,15 +504,17 @@ paths:
$ref: '#/components/responses/ml.search_memory@200'
/_plugins/_ml/memory/{memory_id}/messages:
get:
operationId: ml.get_message.0
x-operation-group: ml.get_message
operationId: ml.get_all_messages.0
x-operation-group: ml.get_all_messages
x-version-added: '2.12'
description: Get a message.
description: Get all messages in a memory.
parameters:
- $ref: '#/components/parameters/ml.get_message::path.memory_id'
- $ref: '#/components/parameters/ml.get_all_messages::path.memory_id'
- $ref: '#/components/parameters/ml.get_all_messages::query.max_results'
- $ref: '#/components/parameters/ml.get_all_messages::query.next_token'
responses:
'200':
$ref: '#/components/responses/ml.get_message@200'
$ref: '#/components/responses/ml.get_all_messages@200'
post:
operationId: ml.create_message.0
x-operation-group: ml.create_message
Expand All @@ -528,7 +529,7 @@ paths:
$ref: '#/components/responses/ml.create_message@200'
/_plugins/_ml/memory/message/{message_id}:
get:
operationId: ml.get_message.1
operationId: ml.get_message.0
x-operation-group: ml.get_message
x-version-added: '2.12'
description: Get a message.
Expand Down Expand Up @@ -582,6 +583,8 @@ paths:
description: Get a message traces.
parameters:
- $ref: '#/components/parameters/ml.get_message_traces::path.message_id'
- $ref: '#/components/parameters/ml.get_message_traces::query.max_results'
- $ref: '#/components/parameters/ml.get_message_traces::query.next_token'
responses:
'200':
$ref: '#/components/responses/ml.get_message_traces@200'
Expand Down Expand Up @@ -817,7 +820,7 @@ components:
version:
$ref: '../schemas/_common.yaml#/components/schemas/VersionString'
model_format:
$ref: '../schemas/_common.yaml#/components/schemas/ModelFormat'
$ref: '../schemas/ml._common.yaml#/components/schemas/ModelFormat'
description:
type: string
description: The model description.
Expand All @@ -838,7 +841,7 @@ components:
version:
$ref: '../schemas/_common.yaml#/components/schemas/VersionString'
model_format:
$ref: '../schemas/_common.yaml#/components/schemas/ModelFormat'
$ref: '../schemas/ml._common.yaml#/components/schemas/ModelFormat'
model_group_id:
$ref: '../schemas/_common.yaml#/components/schemas/Id'
model_content_hash_value:
Expand Down Expand Up @@ -875,7 +878,7 @@ components:
version:
$ref: '../schemas/_common.yaml#/components/schemas/VersionString'
model_format:
$ref: '../schemas/_common.yaml#/components/schemas/ModelFormat'
$ref: '../schemas/ml._common.yaml#/components/schemas/ModelFormat'
model_group_id:
$ref: '../schemas/_common.yaml#/components/schemas/Id'
model_content_hash_value:
Expand Down Expand Up @@ -934,7 +937,7 @@ components:
version:
$ref: '../schemas/_common.yaml#/components/schemas/VersionString'
model_format:
$ref: '../schemas/_common.yaml#/components/schemas/ModelFormat'
$ref: '../schemas/ml._common.yaml#/components/schemas/ModelFormat'
description:
type: string
description: The model description.
Expand Down Expand Up @@ -1005,8 +1008,6 @@ components:
type: array
items:
$ref: '../schemas/_common.yaml#/components/schemas/Id'
required:
- model_ids
ml.unload_model:
content:
application/json:
Expand All @@ -1021,8 +1022,6 @@ components:
type: array
items:
$ref: '../schemas/_common.yaml#/components/schemas/Id'
required:
- model_ids
ml.predict_model:
content:
application/json:
Expand Down Expand Up @@ -1214,20 +1213,6 @@ components:
required:
- name
- type
ml.get_memory:
content:
application/json:
schema:
type: object
properties:
max_results:
type: integer
format: int64
description: The maximum number of results to return.
next_token:
type: integer
format: int64
description: The index of the first memory in the sorted list of memories to return.
ml.create_memory:
content:
application/json:
Expand Down Expand Up @@ -1325,15 +1310,19 @@ components:
type: object
properties:
user_rate_limiter:
$ref: '../schemas/ml._common.yaml#/components/schemas/UserRateLimiter'
type: object
additionalProperties:
$ref: '../schemas/ml._common.yaml#/components/schemas/RateLimiter'
ml.update_controller:
content:
application/json:
schema:
type: object
properties:
user_rate_limiter:
$ref: '../schemas/ml._common.yaml#/components/schemas/UserRateLimiter'
type: object
additionalProperties:
$ref: '../schemas/ml._common.yaml#/components/schemas/RateLimiter'
model_id:
$ref: '../schemas/_common.yaml#/components/schemas/Name'
ml.get_profile:
Expand Down Expand Up @@ -1520,7 +1509,7 @@ components:
content:
application/json:
schema:
$ref: '../schemas/ml._common.yaml#/components/schemas/UpdateModelResponse'
$ref: '../schemas/_common.yaml#/components/schemas/WriteResponseBase'
ml.delete_task@200:
content:
application/json:
Expand Down Expand Up @@ -1596,7 +1585,23 @@ components:
content:
application/json:
schema:
$ref: '../schemas/ml._common.yaml#/components/schemas/GetMemoryResponse'
$ref: '../schemas/ml._common.yaml#/components/schemas/Memory'
ml.get_all_memories@200:
content:
application/json:
schema:
type: object
properties:
memories:
type: array
items:
$ref: '../schemas/ml._common.yaml#/components/schemas/Memory'
next_token:
description: The index of the next memory after the last memory in the returned list.
type: integer
format: int32
required:
- memories
ml.create_memory@200:
content:
application/json:
Expand Down Expand Up @@ -1642,7 +1647,23 @@ components:
content:
application/json:
schema:
$ref: '../schemas/ml._common.yaml#/components/schemas/GetMessageResponse'
$ref: '../schemas/ml._common.yaml#/components/schemas/Message'
ml.get_all_messages@200:
content:
application/json:
schema:
type: object
properties:
messages:
type: array
items:
$ref: '../schemas/ml._common.yaml#/components/schemas/Message'
next_token:
description: The index of the next message after the last message in the returned list.
type: integer
format: int32
required:
- messages
ml.update_message@200:
content:
application/json:
Expand All @@ -1657,15 +1678,27 @@ components:
content:
application/json:
schema:
$ref: '../schemas/ml._common.yaml#/components/schemas/GetMessageTracesResponse'
type: object
properties:
traces:
type: array
items:
$ref: '../schemas/ml._common.yaml#/components/schemas/Message'
next_token:
type: integer
format: int32
required:
- traces
ml.get_controller@200:
content:
application/json:
schema:
type: object
properties:
user_rate_limiter:
$ref: '../schemas/ml._common.yaml#/components/schemas/UserRateLimiter'
type: object
additionalProperties:
$ref: '../schemas/ml._common.yaml#/components/schemas/RateLimiter'
model_id:
$ref: '../schemas/_common.yaml#/components/schemas/Name'
ml.create_controller@200:
Expand Down Expand Up @@ -1709,6 +1742,22 @@ components:
schema:
$ref: '../schemas/ml._common.yaml#/components/schemas/GetStatsResponse'
parameters:
ml.get_all_memories::query.max_results:
name: max_results
in: query
required: false
schema:
description: The maximum number of results to return. If there are fewer memories than the number set in `max_results`, the response returns only the number of memories that exist. Default is `10`.
type: integer
format: int32
ml.get_all_memories::query.next_token:
name: next_token
in: query
required: false
schema:
description: The index of the first memory in the sorted list of memories to return. Memories are ordered by `create_time`. For example, if memories `A`, `B`, and `C` exist, `next_token=1` returns memories `B` and `C`. Default is `0` (return all memories).
type: integer
format: int32
ml.get_model_group::path.model_group_id:
name: model_group_id
in: path
Expand Down Expand Up @@ -1885,12 +1934,26 @@ components:
required: true
schema:
type: string
ml.get_message::path.memory_id:
ml.get_all_messages::path.memory_id:
name: memory_id
in: path
required: true
schema:
type: string
ml.get_all_messages::query.max_results:
name: max_results
in: query
required: false
schema:
type: integer
format: int32
ml.get_all_messages::query.next_token:
name: next_token
in: query
required: false
schema:
type: integer
format: int32
ml.get_message::path.message_id:
name: message_id
in: path
Expand All @@ -1915,6 +1978,20 @@ components:
required: true
schema:
type: string
ml.get_message_traces::query.max_results:
name: max_results
in: query
required: false
schema:
type: integer
format: int32
ml.get_message_traces::query.next_token:
name: next_token
in: query
required: false
schema:
type: integer
format: int32
ml.get_controller::path.model_id:
name: model_id
in: path
Expand Down
7 changes: 1 addition & 6 deletions spec/schemas/_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2475,9 +2475,4 @@ components:
type: number
required:
- active_threads
- thread_executions
ModelFormat:
type: string
enum:
- ONNX
- TORCH_SCRIPT
- thread_executions
Loading

0 comments on commit 1422af3

Please sign in to comment.