Skip to content

Commit

Permalink
Added ML create, update, get, search message, and get message traces …
Browse files Browse the repository at this point in the history
…APIs, updated max_score schema type and test description in memory/update.yaml.

Signed-off-by: Nathalie Jonathan <[email protected]>
  • Loading branch information
nathaliellenaa committed Jan 8, 2025
1 parent 5f0367a commit b073571
Show file tree
Hide file tree
Showing 9 changed files with 540 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added `GET /_plugins/_ml/connectors/{connector_id}`, `_search`, `POST /_plugins/_ml/connectors/_search`, and `PUT /_plugins/_ml/connectors/{connector_id}` ([#764](https://github.com/opensearch-project/opensearch-api-specification/pull/764))
- Added the ability to skip an individual chapter test ([#765](https://github.com/opensearch-project/opensearch-api-specification/pull/765))
- Added uploading of test spec logs ([#767](https://github.com/opensearch-project/opensearch-api-specification/pull/767))
- Added `POST /_plugins/_ml/memory`, `PUT /_plugins/_ml/memory/{memory_id}`, `GET /_plugins/_ml/memory`, `GET /_plugins/_ml/memory/{memory_id}`, `_search`, `POST /_plugins/_ml/memory/_search`, and `DELETE /_plugins/_ml/memory/{memory_id}` ([#771](https://github.com/opensearch-project/opensearch-api-specification/pull/771))
- Added `POST /_plugins/_ml/memory`, `POST /_plugins/_ml/memory/_search`, `{memory_id}/_search`, `{memory_id}/messages`, `PUT /_plugins/_ml/memory/{memory_id}`, `message/{message_id}`, `GET /_plugins/_ml/memory`, `GET /_plugins/_ml/memory/{memory_id}`, `_search`, `message/{message_id}`, `{memory_id}/messages`, `{memory_id}/_search`, `message/{message_id}/traces`, and `DELETE /_plugins/_ml/memory/{memory_id}` ([#771](https://github.com/opensearch-project/opensearch-api-specification/pull/771))

### 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
209 changes: 208 additions & 1 deletion spec/namespaces/ml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,88 @@ paths:
responses:
'200':
$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
x-version-added: '2.12'
description: Get a message.
parameters:
- $ref: '#/components/parameters/ml.get_message::path.memory_id'
responses:
'200':
$ref: '#/components/responses/ml.get_message@200'
post:
operationId: ml.create_message.0
x-operation-group: ml.create_message
x-version-added: '2.12'
description: Create a message.
parameters:
- $ref: '#/components/parameters/ml.create_message::path.memory_id'
requestBody:
$ref: '#/components/requestBodies/ml.create_message'
responses:
'200':
$ref: '#/components/responses/ml.create_message@200'
/_plugins/_ml/memory/message/{message_id}:
get:
operationId: ml.get_message.1
x-operation-group: ml.get_message
x-version-added: '2.12'
description: Get a message.
parameters:
- $ref: '#/components/parameters/ml.get_message::path.message_id'
responses:
'200':
$ref: '#/components/responses/ml.get_message@200'
put:
operationId: ml.update_message.0
x-operation-group: ml.update_message
x-version-added: '2.12'
description: Update a message.
parameters:
- $ref: '#/components/parameters/ml.update_message::path.message_id'
requestBody:
$ref: '#/components/requestBodies/ml.update_message'
responses:
'200':
$ref: '#/components/responses/ml.update_message@200'
/_plugins/_ml/memory/{memory_id}/_search:
get:
operationId: ml.search_message.0
x-operation-group: ml.search_message
x-version-added: '2.12'
description: Search messages.
parameters:
- $ref: '#/components/parameters/ml.search_message::path.memory_id'
requestBody:
$ref: '#/components/requestBodies/ml.search_message'
responses:
'200':
$ref: '#/components/responses/ml.search_message@200'
post:
operationId: ml.search_message.1
x-operation-group: ml.search_message
x-version-added: '2.12'
description: Search messages.
parameters:
- $ref: '#/components/parameters/ml.search_message::path.memory_id'
requestBody:
$ref: '#/components/requestBodies/ml.search_message'
responses:
'200':
$ref: '#/components/responses/ml.search_message@200'
/_plugins/_ml/memory/message/{message_id}/traces:
get:
operationId: ml.get_message_traces.0
x-operation-group: ml.get_message_traces
x-version-added: '2.12'
description: Get a message traces.
parameters:
- $ref: '#/components/parameters/ml.get_message_traces::path.message_id'
responses:
'200':
$ref: '#/components/responses/ml.get_message_traces@200'
components:
requestBodies:
ml.register_model_group:
Expand Down Expand Up @@ -671,6 +753,63 @@ components:
items:
$ref: '../schemas/ml._common.yaml#/components/schemas/SortMemory'
description: The sort order.
ml.create_message:
content:
application/json:
schema:
type: object
properties:
input:
type: string
description: The question in the message.
prompt_template:
type: string
description: The prompt template.
response:
type: string
description: The answer to the question.
origin:
type: string
description: The system name that generated the response.
additional_info:
$ref: '../schemas/ml._common.yaml#/components/schemas/AdditionalInfo'
ml.update_message:
content:
application/json:
schema:
type: object
properties:
input:
type: string
description: The question in the message.
prompt_template:
type: string
description: The prompt template.
response:
type: string
description: The answer to the question.
origin:
type: string
description: The system name that generated the response.
additional_info:
$ref: '../schemas/ml._common.yaml#/components/schemas/AdditionalInfo'
ml.search_message:
content:
application/json:
schema:
type: object
properties:
query:
$ref: '../schemas/ml._common.yaml#/components/schemas/Query'
size:
type: integer
format: int64
description: The number of messages to return.
sort:
type: array
items:
$ref: '../schemas/ml._common.yaml#/components/schemas/SortMessage'
description: The sort order.
responses:
ml.register_model_group@200:
content:
Expand Down Expand Up @@ -818,7 +957,9 @@ components:
type: object
properties:
memory_id:
type: string
$ref: '../schemas/_common.yaml#/components/schemas/Name'
required:
- memory_id
ml.update_memory@200:
content:
application/json:
Expand All @@ -840,6 +981,36 @@ components:
application/json:
schema:
$ref: '../schemas/ml._common.yaml#/components/schemas/SearchMemoryResponse'
ml.create_message@200:
content:
application/json:
schema:
type: object
properties:
message_id:
$ref: '../schemas/_common.yaml#/components/schemas/Name'
required:
- message_id
ml.get_message@200:
content:
application/json:
schema:
$ref: '../schemas/ml._common.yaml#/components/schemas/GetMessageResponse'
ml.update_message@200:
content:
application/json:
schema:
$ref: '../schemas/_common.yaml#/components/schemas/WriteResponseBase'
ml.search_message@200:
content:
application/json:
schema:
$ref: '../schemas/ml._common.yaml#/components/schemas/SearchMessageResponse'
ml.get_message_traces@200:
content:
application/json:
schema:
$ref: '../schemas/ml._common.yaml#/components/schemas/GetMessageTracesResponse'
parameters:
ml.get_model_group::path.model_group_id:
name: model_group_id
Expand Down Expand Up @@ -953,5 +1124,41 @@ components:
name: memory_id
in: path
required: true
schema:
type: string
ml.create_message::path.memory_id:
name: memory_id
in: path
required: true
schema:
type: string
ml.get_message::path.memory_id:
name: memory_id
in: path
required: true
schema:
type: string
ml.get_message::path.message_id:
name: message_id
in: path
required: true
schema:
type: string
ml.update_message::path.message_id:
name: message_id
in: path
required: true
schema:
type: string
ml.search_message::path.memory_id:
name: memory_id
in: path
required: true
schema:
type: string
ml.get_message_traces::path.message_id:
name: message_id
in: path
required: true
schema:
type: string
Loading

0 comments on commit b073571

Please sign in to comment.