diff --git a/CHANGELOG.md b/CHANGELOG.md index e07527e58..0815e2fd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -105,6 +105,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 ([#]()) ## [0.1.0] - 2024-10-25 diff --git a/spec/namespaces/ml.yaml b/spec/namespaces/ml.yaml index 0e430a0ef..439276240 100644 --- a/spec/namespaces/ml.yaml +++ b/spec/namespaces/ml.yaml @@ -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 @@ -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: @@ -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 @@ -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. @@ -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' @@ -774,7 +777,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. @@ -795,7 +798,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: @@ -832,7 +835,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: @@ -891,7 +894,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. @@ -962,8 +965,6 @@ components: type: array items: $ref: '../schemas/_common.yaml#/components/schemas/Id' - required: - - model_ids ml.unload_model: content: application/json: @@ -978,8 +979,6 @@ components: type: array items: $ref: '../schemas/_common.yaml#/components/schemas/Id' - required: - - model_ids ml.predict_model: content: application/json: @@ -1171,20 +1170,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: @@ -1282,7 +1267,9 @@ 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: @@ -1290,7 +1277,9 @@ 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' model_id: $ref: '../schemas/_common.yaml#/components/schemas/Name' ml.get_profile: @@ -1477,7 +1466,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: @@ -1553,7 +1542,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: @@ -1599,7 +1604,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: @@ -1614,7 +1635,17 @@ 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: @@ -1622,7 +1653,9 @@ 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' model_id: $ref: '../schemas/_common.yaml#/components/schemas/Name' ml.create_controller@200: @@ -1661,6 +1694,22 @@ components: schema: $ref: '../schemas/ml._common.yaml#/components/schemas/GetProfileResponse' 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 @@ -1837,12 +1886,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 @@ -1867,6 +1930,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 diff --git a/spec/schemas/_common.yaml b/spec/schemas/_common.yaml index 9f9a838eb..3130f33c1 100644 --- a/spec/schemas/_common.yaml +++ b/spec/schemas/_common.yaml @@ -2474,9 +2474,4 @@ components: type: number required: - active_threads - - thread_executions - ModelFormat: - type: string - enum: - - ONNX - - TORCH_SCRIPT \ No newline at end of file + - thread_executions \ No newline at end of file diff --git a/spec/schemas/ml._common.yaml b/spec/schemas/ml._common.yaml index 77d7b6d38..4aec5b113 100644 --- a/spec/schemas/ml._common.yaml +++ b/spec/schemas/ml._common.yaml @@ -136,7 +136,7 @@ components: model_config: $ref: '#/components/schemas/ModelConfig' model_format: - $ref: '_common.yaml#/components/schemas/ModelFormat' + $ref: '#/components/schemas/ModelFormat' model_task_type: type: string description: The model task type. @@ -795,7 +795,7 @@ components: type: string description: The model version. model_format: - $ref: '_common.yaml#/components/schemas/ModelFormat' + $ref: '#/components/schemas/ModelFormat' model_state: type: string description: The model state. @@ -841,9 +841,8 @@ components: type: object properties: limit: - type: integer - format: int64 description: The maximum limit. + $ref: '_common.yaml#/components/schemas/StringifiedDouble' unit: type: string description: The unit of time. @@ -898,30 +897,6 @@ components: response_validation_regex: type: string description: The response validation regex. - UpdateModelResponse: - type: object - properties: - _index: - $ref: '_common.yaml#/components/schemas/IndexName' - _id: - $ref: '_common.yaml#/components/schemas/Id' - _version: - $ref: '_common.yaml#/components/schemas/VersionNumber' - result: - $ref: '_common.yaml#/components/schemas/Result' - forced_refresh: - type: boolean - description: Whether the model is forced to refresh. - _shards: - $ref: '_common.yaml#/components/schemas/ShardStatistics' - _seq_no: - $ref: '_common.yaml#/components/schemas/SequenceNumber' - _primary_term: - type: integer - format: int64 - description: The primary term. - required: - - _index Task: type: object properties: @@ -1169,19 +1144,6 @@ components: description: The last updated time. SearchConnectorsResponse: $ref: '#/components/schemas/SearchResponse' - GetMemoryResponse: - oneOf: - - $ref: '#/components/schemas/Memory' - - type: object - properties: - memories: - type: array - items: - $ref: '#/components/schemas/Memory' - next_token: - type: integer - format: int64 - description: The index of the first memory in the sorted list of memories. SearchMemoryResponse: $ref: '#/components/schemas/SearchResponse' Message: @@ -1216,47 +1178,13 @@ components: type: integer format: int64 description: The trace number. - GetMessageResponse: - oneOf: - - $ref: '#/components/schemas/Message' - - type: object - properties: - messages: - type: array - items: - $ref: '#/components/schemas/Message' SearchMessageResponse: $ref: '#/components/schemas/SearchResponse' - GetMessageTracesResponse: - type: object - properties: - traces: - type: array - items: - $ref: '#/components/schemas/Message' - UserRateLimiter: - type: object - properties: - user1: - $ref: '#/components/schemas/User' - additionalProperties: true - User: - type: object - properties: - limit: - type: [integer, string] - description: Max Predict API calls per user per time unit. - unit: - type: string - description: The unit of time. - enum: - - DAYS - - HOURS - - MICROSECONDS - - MILLISECONDS - - MINUTES - - NANOSECONDS - - SECONDS + ModelFormat: + type: string + enum: + - ONNX + - TORCH_SCRIPT ProfileRequest: type: object properties: @@ -1367,4 +1295,4 @@ components: Tasks: type: object additionalProperties: - $ref: '#/components/schemas/Task' \ No newline at end of file + $ref: '#/components/schemas/Task'