Skip to content

Commit 1422af3

Browse files
authored
Split get_all variants out of ml.get_memory and ml.get_message (#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]>
1 parent 1681adc commit 1422af3

File tree

12 files changed

+278
-161
lines changed

12 files changed

+278
-161
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
106106
- Changed `SearchModelsQuery`, `CreateConnectorRequest` & `RegisterAgentsRequest` to be defined inline of request bodies ([#725](https://github.com/opensearch-project/opensearch-api-specification/pull/725))
107107
- Changed `indices.data_streams_stats:DataStreamsStatsItem` to instead be `indices._common:DataStreamStats` ([#725](https://github.com/opensearch-project/opensearch-api-specification/pull/725))
108108
- 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))
109+
- 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))
109110

110111
## [0.1.0] - 2024-10-25
111112

spec/namespaces/ml.yaml

+122-45
Original file line numberDiff line numberDiff line change
@@ -428,15 +428,16 @@ paths:
428428
$ref: '#/components/responses/ml.delete_agent@200'
429429
/_plugins/_ml/memory:
430430
get:
431-
operationId: ml.get_memory.0
432-
x-operation-group: ml.get_memory
431+
operationId: ml.get_all_memories.0
432+
x-operation-group: ml.get_all_memories
433433
x-version-added: '2.12'
434-
description: Get a memory.
435-
requestBody:
436-
$ref: '#/components/requestBodies/ml.get_memory'
434+
description: Get all memories.
435+
parameters:
436+
- $ref: '#/components/parameters/ml.get_all_memories::query.max_results'
437+
- $ref: '#/components/parameters/ml.get_all_memories::query.next_token'
437438
responses:
438439
'200':
439-
$ref: '#/components/responses/ml.get_memory@200'
440+
$ref: '#/components/responses/ml.get_all_memories@200'
440441
post:
441442
operationId: ml.create_memory.0
442443
x-operation-group: ml.create_memory
@@ -449,12 +450,10 @@ paths:
449450
$ref: '#/components/responses/ml.create_memory@200'
450451
/_plugins/_ml/memory/{memory_id}:
451452
get:
452-
operationId: ml.get_memory.1
453+
operationId: ml.get_memory.0
453454
x-operation-group: ml.get_memory
454455
x-version-added: '2.12'
455456
description: Get a memory.
456-
requestBody:
457-
$ref: '#/components/requestBodies/ml.get_memory'
458457
parameters:
459458
- $ref: '#/components/parameters/ml.get_memory::path.memory_id'
460459
responses:
@@ -505,15 +504,17 @@ paths:
505504
$ref: '#/components/responses/ml.search_memory@200'
506505
/_plugins/_ml/memory/{memory_id}/messages:
507506
get:
508-
operationId: ml.get_message.0
509-
x-operation-group: ml.get_message
507+
operationId: ml.get_all_messages.0
508+
x-operation-group: ml.get_all_messages
510509
x-version-added: '2.12'
511-
description: Get a message.
510+
description: Get all messages in a memory.
512511
parameters:
513-
- $ref: '#/components/parameters/ml.get_message::path.memory_id'
512+
- $ref: '#/components/parameters/ml.get_all_messages::path.memory_id'
513+
- $ref: '#/components/parameters/ml.get_all_messages::query.max_results'
514+
- $ref: '#/components/parameters/ml.get_all_messages::query.next_token'
514515
responses:
515516
'200':
516-
$ref: '#/components/responses/ml.get_message@200'
517+
$ref: '#/components/responses/ml.get_all_messages@200'
517518
post:
518519
operationId: ml.create_message.0
519520
x-operation-group: ml.create_message
@@ -528,7 +529,7 @@ paths:
528529
$ref: '#/components/responses/ml.create_message@200'
529530
/_plugins/_ml/memory/message/{message_id}:
530531
get:
531-
operationId: ml.get_message.1
532+
operationId: ml.get_message.0
532533
x-operation-group: ml.get_message
533534
x-version-added: '2.12'
534535
description: Get a message.
@@ -582,6 +583,8 @@ paths:
582583
description: Get a message traces.
583584
parameters:
584585
- $ref: '#/components/parameters/ml.get_message_traces::path.message_id'
586+
- $ref: '#/components/parameters/ml.get_message_traces::query.max_results'
587+
- $ref: '#/components/parameters/ml.get_message_traces::query.next_token'
585588
responses:
586589
'200':
587590
$ref: '#/components/responses/ml.get_message_traces@200'
@@ -817,7 +820,7 @@ components:
817820
version:
818821
$ref: '../schemas/_common.yaml#/components/schemas/VersionString'
819822
model_format:
820-
$ref: '../schemas/_common.yaml#/components/schemas/ModelFormat'
823+
$ref: '../schemas/ml._common.yaml#/components/schemas/ModelFormat'
821824
description:
822825
type: string
823826
description: The model description.
@@ -838,7 +841,7 @@ components:
838841
version:
839842
$ref: '../schemas/_common.yaml#/components/schemas/VersionString'
840843
model_format:
841-
$ref: '../schemas/_common.yaml#/components/schemas/ModelFormat'
844+
$ref: '../schemas/ml._common.yaml#/components/schemas/ModelFormat'
842845
model_group_id:
843846
$ref: '../schemas/_common.yaml#/components/schemas/Id'
844847
model_content_hash_value:
@@ -875,7 +878,7 @@ components:
875878
version:
876879
$ref: '../schemas/_common.yaml#/components/schemas/VersionString'
877880
model_format:
878-
$ref: '../schemas/_common.yaml#/components/schemas/ModelFormat'
881+
$ref: '../schemas/ml._common.yaml#/components/schemas/ModelFormat'
879882
model_group_id:
880883
$ref: '../schemas/_common.yaml#/components/schemas/Id'
881884
model_content_hash_value:
@@ -934,7 +937,7 @@ components:
934937
version:
935938
$ref: '../schemas/_common.yaml#/components/schemas/VersionString'
936939
model_format:
937-
$ref: '../schemas/_common.yaml#/components/schemas/ModelFormat'
940+
$ref: '../schemas/ml._common.yaml#/components/schemas/ModelFormat'
938941
description:
939942
type: string
940943
description: The model description.
@@ -1005,8 +1008,6 @@ components:
10051008
type: array
10061009
items:
10071010
$ref: '../schemas/_common.yaml#/components/schemas/Id'
1008-
required:
1009-
- model_ids
10101011
ml.unload_model:
10111012
content:
10121013
application/json:
@@ -1021,8 +1022,6 @@ components:
10211022
type: array
10221023
items:
10231024
$ref: '../schemas/_common.yaml#/components/schemas/Id'
1024-
required:
1025-
- model_ids
10261025
ml.predict_model:
10271026
content:
10281027
application/json:
@@ -1214,20 +1213,6 @@ components:
12141213
required:
12151214
- name
12161215
- type
1217-
ml.get_memory:
1218-
content:
1219-
application/json:
1220-
schema:
1221-
type: object
1222-
properties:
1223-
max_results:
1224-
type: integer
1225-
format: int64
1226-
description: The maximum number of results to return.
1227-
next_token:
1228-
type: integer
1229-
format: int64
1230-
description: The index of the first memory in the sorted list of memories to return.
12311216
ml.create_memory:
12321217
content:
12331218
application/json:
@@ -1325,15 +1310,19 @@ components:
13251310
type: object
13261311
properties:
13271312
user_rate_limiter:
1328-
$ref: '../schemas/ml._common.yaml#/components/schemas/UserRateLimiter'
1313+
type: object
1314+
additionalProperties:
1315+
$ref: '../schemas/ml._common.yaml#/components/schemas/RateLimiter'
13291316
ml.update_controller:
13301317
content:
13311318
application/json:
13321319
schema:
13331320
type: object
13341321
properties:
13351322
user_rate_limiter:
1336-
$ref: '../schemas/ml._common.yaml#/components/schemas/UserRateLimiter'
1323+
type: object
1324+
additionalProperties:
1325+
$ref: '../schemas/ml._common.yaml#/components/schemas/RateLimiter'
13371326
model_id:
13381327
$ref: '../schemas/_common.yaml#/components/schemas/Name'
13391328
ml.get_profile:
@@ -1520,7 +1509,7 @@ components:
15201509
content:
15211510
application/json:
15221511
schema:
1523-
$ref: '../schemas/ml._common.yaml#/components/schemas/UpdateModelResponse'
1512+
$ref: '../schemas/_common.yaml#/components/schemas/WriteResponseBase'
15241513
ml.delete_task@200:
15251514
content:
15261515
application/json:
@@ -1596,7 +1585,23 @@ components:
15961585
content:
15971586
application/json:
15981587
schema:
1599-
$ref: '../schemas/ml._common.yaml#/components/schemas/GetMemoryResponse'
1588+
$ref: '../schemas/ml._common.yaml#/components/schemas/Memory'
1589+
ml.get_all_memories@200:
1590+
content:
1591+
application/json:
1592+
schema:
1593+
type: object
1594+
properties:
1595+
memories:
1596+
type: array
1597+
items:
1598+
$ref: '../schemas/ml._common.yaml#/components/schemas/Memory'
1599+
next_token:
1600+
description: The index of the next memory after the last memory in the returned list.
1601+
type: integer
1602+
format: int32
1603+
required:
1604+
- memories
16001605
ml.create_memory@200:
16011606
content:
16021607
application/json:
@@ -1642,7 +1647,23 @@ components:
16421647
content:
16431648
application/json:
16441649
schema:
1645-
$ref: '../schemas/ml._common.yaml#/components/schemas/GetMessageResponse'
1650+
$ref: '../schemas/ml._common.yaml#/components/schemas/Message'
1651+
ml.get_all_messages@200:
1652+
content:
1653+
application/json:
1654+
schema:
1655+
type: object
1656+
properties:
1657+
messages:
1658+
type: array
1659+
items:
1660+
$ref: '../schemas/ml._common.yaml#/components/schemas/Message'
1661+
next_token:
1662+
description: The index of the next message after the last message in the returned list.
1663+
type: integer
1664+
format: int32
1665+
required:
1666+
- messages
16461667
ml.update_message@200:
16471668
content:
16481669
application/json:
@@ -1657,15 +1678,27 @@ components:
16571678
content:
16581679
application/json:
16591680
schema:
1660-
$ref: '../schemas/ml._common.yaml#/components/schemas/GetMessageTracesResponse'
1681+
type: object
1682+
properties:
1683+
traces:
1684+
type: array
1685+
items:
1686+
$ref: '../schemas/ml._common.yaml#/components/schemas/Message'
1687+
next_token:
1688+
type: integer
1689+
format: int32
1690+
required:
1691+
- traces
16611692
ml.get_controller@200:
16621693
content:
16631694
application/json:
16641695
schema:
16651696
type: object
16661697
properties:
16671698
user_rate_limiter:
1668-
$ref: '../schemas/ml._common.yaml#/components/schemas/UserRateLimiter'
1699+
type: object
1700+
additionalProperties:
1701+
$ref: '../schemas/ml._common.yaml#/components/schemas/RateLimiter'
16691702
model_id:
16701703
$ref: '../schemas/_common.yaml#/components/schemas/Name'
16711704
ml.create_controller@200:
@@ -1709,6 +1742,22 @@ components:
17091742
schema:
17101743
$ref: '../schemas/ml._common.yaml#/components/schemas/GetStatsResponse'
17111744
parameters:
1745+
ml.get_all_memories::query.max_results:
1746+
name: max_results
1747+
in: query
1748+
required: false
1749+
schema:
1750+
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`.
1751+
type: integer
1752+
format: int32
1753+
ml.get_all_memories::query.next_token:
1754+
name: next_token
1755+
in: query
1756+
required: false
1757+
schema:
1758+
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).
1759+
type: integer
1760+
format: int32
17121761
ml.get_model_group::path.model_group_id:
17131762
name: model_group_id
17141763
in: path
@@ -1885,12 +1934,26 @@ components:
18851934
required: true
18861935
schema:
18871936
type: string
1888-
ml.get_message::path.memory_id:
1937+
ml.get_all_messages::path.memory_id:
18891938
name: memory_id
18901939
in: path
18911940
required: true
18921941
schema:
18931942
type: string
1943+
ml.get_all_messages::query.max_results:
1944+
name: max_results
1945+
in: query
1946+
required: false
1947+
schema:
1948+
type: integer
1949+
format: int32
1950+
ml.get_all_messages::query.next_token:
1951+
name: next_token
1952+
in: query
1953+
required: false
1954+
schema:
1955+
type: integer
1956+
format: int32
18941957
ml.get_message::path.message_id:
18951958
name: message_id
18961959
in: path
@@ -1915,6 +1978,20 @@ components:
19151978
required: true
19161979
schema:
19171980
type: string
1981+
ml.get_message_traces::query.max_results:
1982+
name: max_results
1983+
in: query
1984+
required: false
1985+
schema:
1986+
type: integer
1987+
format: int32
1988+
ml.get_message_traces::query.next_token:
1989+
name: next_token
1990+
in: query
1991+
required: false
1992+
schema:
1993+
type: integer
1994+
format: int32
19181995
ml.get_controller::path.model_id:
19191996
name: model_id
19201997
in: path

spec/schemas/_common.yaml

+1-6
Original file line numberDiff line numberDiff line change
@@ -2475,9 +2475,4 @@ components:
24752475
type: number
24762476
required:
24772477
- active_threads
2478-
- thread_executions
2479-
ModelFormat:
2480-
type: string
2481-
enum:
2482-
- ONNX
2483-
- TORCH_SCRIPT
2478+
- thread_executions

0 commit comments

Comments
 (0)