diff --git a/.github/workflows/test-spec.yml b/.github/workflows/test-spec.yml index 72fa6ae0..8f15414e 100644 --- a/.github/workflows/test-spec.yml +++ b/.github/workflows/test-spec.yml @@ -39,10 +39,10 @@ jobs: - version: 2.17.0 - version: 2.18.0 hub: opensearchstaging - ref: '@sha256:2f215e1bed35f49d5e0bb9408824767e7e18dd50a9e85b4f414bf39fa573a37a' + ref: '@sha256:4445e195c53992038891519dc3be0d273cdaad1b047943d68921168ed243e7e9' - version: 3.0.0 hub: opensearchstaging - ref: '@sha256:06af2ba4037f8423dc1a4ed3cd29108a1912774e7c659e73f0fac09e1bb2b63d' + ref: '@sha256:cf07c0ffa7d9e8a3e7fdb58041caae3bb81f1123260431b99d0ebf4a52c3d9a3' name: test-opensearch-spec (version=${{ matrix.entry.version }}, hub=${{ matrix.entry.hub || 'opensearchproject' }}, tests=${{ matrix.entry.tests || 'default' }}) runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c1317eb..d6cab5d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -96,6 +96,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added `/_plugins/_ism/policies`, `add`, `remove`, `change_policy`, `explain`, and `retry` ([#568](https://github.com/opensearch-project/opensearch-api-specification/pull/568)) ([#578](https://github.com/opensearch-project/opensearch-api-specification/pull/578)) - Added `/_plugins/refresh_search_analyzers` ([#578](https://github.com/opensearch-project/opensearch-api-specification/pull/578)) - Added `/_bulk/stream` ([#584](https://github.com/opensearch-project/opensearch-api-specification/pull/584)) +- Added `/_plugins/_ml/agents/_register`, `/_plugins/_ml/connectors/_create`, `DELETE /_plugins/_ml/agents/{agent_id}`, `DELETE /_plugins/_ml/connectors/{connector_id}` ([#228](https://github.com/opensearch-project/opensearch-api-specification/issues/228)) +- Added the `context` query param to the `put_script` APIs ([#586](https://github.com/opensearch-project/opensearch-api-specification/pull/586)) ### Changed @@ -115,6 +117,11 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Rename `Bytes` component to `StorageType` ([#552](https://github.com/opensearch-project/opensearch-api-specification/pull/552)) - Rename `ByteSize` to `StorageSize` ([#552](https://github.com/opensearch-project/opensearch-api-specification/pull/552)) - Split `Percentage` into `PercentageNumber`, `PercentageString` ([#573](https://github.com/opensearch-project/opensearch-api-specification/pull/573)) +- Unified all `routing` query params to take a string or array of strings ([#586](https://github.com/opensearch-project/opensearch-api-specification/pull/586)) +- Changed `rank_eval`'s `search_type` query param to use the `SearchType` enum rather than a plain string ([#586](https://github.com/opensearch-project/opensearch-api-specification/pull/586)) +- Changed `cluster.reroute`'s `metric` path param to use an enum of metrics ([#586](https://github.com/opensearch-project/opensearch-api-specification/pull/586)) +- Changed `indices.stats`'s `metric` path param to use an enum of metrics ([#586](https://github.com/opensearch-project/opensearch-api-specification/pull/586)) +- Changed `CleanupRepositoryResults`' properties to be `int64`s ([#587](https://github.com/opensearch-project/opensearch-api-specification/pull/587)) ### Deprecated @@ -159,6 +166,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Fixed tasks namespace schemas ([#520](https://github.com/opensearch-project/opensearch-api-specification/pull/520)) - Fixed `/_plugins/_transform/_preview` ([#568](https://github.com/opensearch-project/opensearch-api-specification/pull/568)) - Fixed create/delete/index operation in `_bulk` ([#582](https://github.com/opensearch-project/opensearch-api-specification/pull/582)) +- Add `mode` and `compression` to k-NN index creation and search, and add `rescore` and `oversample_factor` to k-NN search ([#588](https://github.com/opensearch-project/opensearch-api-specification/pull/588)) ### Security diff --git a/spec/namespaces/_core.yaml b/spec/namespaces/_core.yaml index d358a08f..a9e7b8b0 100644 --- a/spec/namespaces/_core.yaml +++ b/spec/namespaces/_core.yaml @@ -611,6 +611,7 @@ paths: parameters: - $ref: '#/components/parameters/put_script::path.id' - $ref: '#/components/parameters/put_script::query.cluster_manager_timeout' + - $ref: '#/components/parameters/put_script::query.context' - $ref: '#/components/parameters/put_script::query.master_timeout' - $ref: '#/components/parameters/put_script::query.timeout' requestBody: @@ -628,6 +629,7 @@ paths: parameters: - $ref: '#/components/parameters/put_script::path.id' - $ref: '#/components/parameters/put_script::query.cluster_manager_timeout' + - $ref: '#/components/parameters/put_script::query.context' - $ref: '#/components/parameters/put_script::query.master_timeout' - $ref: '#/components/parameters/put_script::query.timeout' requestBody: @@ -662,6 +664,7 @@ paths: - $ref: '#/components/parameters/put_script::path.context' - $ref: '#/components/parameters/put_script::path.id' - $ref: '#/components/parameters/put_script::query.cluster_manager_timeout' + - $ref: '#/components/parameters/put_script::query.context' - $ref: '#/components/parameters/put_script::query.master_timeout' - $ref: '#/components/parameters/put_script::query.timeout' requestBody: @@ -680,6 +683,7 @@ paths: - $ref: '#/components/parameters/put_script::path.context' - $ref: '#/components/parameters/put_script::path.id' - $ref: '#/components/parameters/put_script::query.cluster_manager_timeout' + - $ref: '#/components/parameters/put_script::query.context' - $ref: '#/components/parameters/put_script::query.master_timeout' - $ref: '#/components/parameters/put_script::query.timeout' requestBody: @@ -3722,10 +3726,7 @@ components: description: Comma-separated list of specific routing values. style: form schema: - type: array - items: - type: string - description: Comma-separated list of specific routing values. + $ref: '../schemas/_common.yaml#/components/schemas/Routing' explode: true delete::path.id: in: path @@ -5107,6 +5108,14 @@ components: schema: $ref: '../schemas/_common.yaml#/components/schemas/Duration' x-version-added: '2.0' + put_script::query.context: + name: context + in: query + description: |- + Context in which the script or search template should run. + To prevent errors, the API immediately compiles the script or template in this context. + schema: + type: string put_script::query.master_timeout: in: query name: master_timeout @@ -5164,7 +5173,7 @@ components: name: search_type description: Search operation type schema: - type: string + $ref: '../schemas/_common.yaml#/components/schemas/SearchType' style: form reindex::query.max_docs: name: max_docs diff --git a/spec/namespaces/cluster.yaml b/spec/namespaces/cluster.yaml index 3157459e..8820d2ed 100644 --- a/spec/namespaces/cluster.yaml +++ b/spec/namespaces/cluster.yaml @@ -1274,7 +1274,11 @@ components: name: metric description: Limits the information returned to the specified metrics. schema: - $ref: '../schemas/_common.yaml#/components/schemas/Metrics' + oneOf: + - $ref: '../schemas/cluster.reroute.yaml#/components/schemas/Metric' + - type: array + items: + $ref: '../schemas/cluster.reroute.yaml#/components/schemas/Metric' style: form cluster.reroute::query.retry_failed: in: query diff --git a/spec/namespaces/indices.yaml b/spec/namespaces/indices.yaml index b3cc12eb..dcd75861 100644 --- a/spec/namespaces/indices.yaml +++ b/spec/namespaces/indices.yaml @@ -4773,10 +4773,10 @@ components: description: List of shard health statuses used to limit the request. schema: oneOf: - - $ref: '../schemas/indices.shard_stores.yaml#/components/schemas/ShardStoreStatus' + - $ref: '../schemas/indices.shard_stores.yaml#/components/schemas/Status' - type: array items: - $ref: '../schemas/indices.shard_stores.yaml#/components/schemas/ShardStoreStatus' + $ref: '../schemas/indices.shard_stores.yaml#/components/schemas/Status' style: form indices.shrink::path.index: in: path @@ -5035,7 +5035,11 @@ components: description: Limit the information returned the specific metrics. required: true schema: - $ref: '../schemas/_common.yaml#/components/schemas/Metrics' + oneOf: + - $ref: '../schemas/indices.stats.yaml#/components/schemas/Metric' + - type: array + items: + $ref: '../schemas/indices.stats.yaml#/components/schemas/Metric' style: simple indices.stats::query.completion_fields: in: query diff --git a/spec/namespaces/knn.yaml b/spec/namespaces/knn.yaml index d960f34a..a33bd02d 100644 --- a/spec/namespaces/knn.yaml +++ b/spec/namespaces/knn.yaml @@ -268,11 +268,16 @@ components: format: int32 description: type: string + mode: + type: string + compression_level: + type: string method: type: string + spaceType: + type: string required: - dimension - - method - training_field - training_index required: true @@ -281,7 +286,16 @@ components: knn.get_model@200: {} knn.search_models@200: {} knn.stats@200: {} - knn.train_model@200: {} + knn.train_model@200: + content: + application/json: + schema: + type: object + properties: + model_id: + type: string + required: + - model_id knn.warmup@200: {} parameters: knn.delete_model::path.model_id: @@ -500,10 +514,7 @@ components: description: Comma-separated list of specific routing values. style: form schema: - type: array - items: - type: string - description: Comma-separated list of specific routing values. + $ref: '../schemas/_common.yaml#/components/schemas/Routing' explode: true knn.search_models::query.scroll: name: scroll diff --git a/spec/namespaces/ml.yaml b/spec/namespaces/ml.yaml index 17ee0308..700fc334 100644 --- a/spec/namespaces/ml.yaml +++ b/spec/namespaces/ml.yaml @@ -102,6 +102,46 @@ paths: responses: '200': $ref: '#/components/responses/ml.search_models@200' + /_plugins/_ml/connectors/_create: + post: + operationId: ml.create_connector.0 + x-operation-group: ml.create_connector + description: Creates a standalone connector. + requestBody: + $ref: '#/components/requestBodies/ml.create_connector' + responses: + '200': + $ref: '#/components/responses/ml.create_connector@200' + /_plugins/_ml/connectors/{connector_id}: + delete: + operationId: ml.delete_connector.0 + x-operation-group: ml.delete_connector + description: Deletes a standalone connector. + parameters: + - $ref: '#/components/parameters/ml.delete_connector::path.connector_id' + responses: + '200': + $ref: '#/components/responses/ml.delete_connector@200' + /_plugins/_ml/agents/_register: + post: + operationId: ml.register_agents.0 + x-operation-group: ml.register_agents + description: Register an agent. + requestBody: + $ref: '#/components/requestBodies/ml.register_agents' + responses: + '200': + $ref: '#/components/responses/ml.register_agents@200' + /_plugins/_ml/agents/{agent_id}: + delete: + operationId: ml.delete_agent.0 + x-operation-group: ml.delete_agent + description: Delete an agent. + parameters: + - $ref: '#/components/parameters/ml.delete_agent::path.agent_id' + responses: + '200': + $ref: '#/components/responses/ml.delete_agent@200' components: requestBodies: ml.register_model_group: @@ -110,7 +150,7 @@ components: schema: type: object properties: - name: + name: type: string description: The model group name. description: @@ -136,7 +176,7 @@ components: schema: type: object properties: - name: + name: type: string description: The model name. version: @@ -161,6 +201,16 @@ components: application/json: schema: $ref: '../schemas/ml._common.yaml#/components/schemas/SearchModelsQuery' + ml.create_connector: + content: + application/json: + schema: + $ref: '../schemas/ml._common.yaml#/components/schemas/CreateConnectorRequest' + ml.register_agents: + content: + application/json: + schema: + $ref: '../schemas/ml._common.yaml#/components/schemas/RegisterAgentsRequest' responses: ml.register_model_group@200: content: @@ -230,6 +280,32 @@ components: application/json: schema: $ref: '../schemas/ml._common.yaml#/components/schemas/SearchModelsResponse' + ml.create_connector@200: + content: + application/json: + schema: + type: object + properties: + connector_id: + type: string + ml.delete_connector@200: + content: + application/json: + schema: + $ref: '../schemas/_common.yaml#/components/schemas/WriteResponseBase' + ml.register_agents@200: + content: + application/json: + schema: + type: object + properties: + agent_id: + type: string + ml.delete_agent@200: + content: + application/json: + schema: + $ref: '../schemas/_common.yaml#/components/schemas/WriteResponseBase' parameters: ml.get_model_group::path.model_group_id: name: model_group_id @@ -267,9 +343,21 @@ components: required: true schema: type: string + ml.delete_connector::path.connector_id: + name: connector_id + in: path + required: true + schema: + type: string + ml.delete_agent::path.agent_id: + name: agent_id + in: path + required: true + schema: + type: string ml.get_task::path.task_id: name: task_id in: path required: true schema: - type: string + type: string \ No newline at end of file diff --git a/spec/schemas/_common.mapping.yaml b/spec/schemas/_common.mapping.yaml index a26c15e6..2c26487f 100644 --- a/spec/schemas/_common.mapping.yaml +++ b/spec/schemas/_common.mapping.yaml @@ -1141,6 +1141,14 @@ components: properties: dimension: type: number + space_type: + type: string + data_type: + type: string + mode: + type: string + compression_level: + type: string method: $ref: '#/components/schemas/KnnVectorMethod' required: diff --git a/spec/schemas/_common.yaml b/spec/schemas/_common.yaml index d7d74260..c3e9468d 100644 --- a/spec/schemas/_common.yaml +++ b/spec/schemas/_common.yaml @@ -356,7 +356,11 @@ components: ScrollId: type: string Routing: - type: string + oneOf: + - type: string + - type: array + items: + type: string DateTime: description: |- A date and time, either as a string whose format can depend on the context (defaulting to ISO 8601), or a @@ -656,6 +660,16 @@ components: boost: description: Boost value to apply to kNN scores type: number + method_parameters: + type: object + x-version-added: '2.16' + additionalProperties: + type: number + rescore: + type: object + x-version-added: '2.17' + additionalProperties: + type: number required: - vector QueryVector: @@ -919,12 +933,6 @@ components: - urgent DataStreamName: type: string - Metrics: - oneOf: - - type: string - - type: array - items: - type: string CompletionStats: type: object properties: diff --git a/spec/schemas/cluster.reroute.yaml b/spec/schemas/cluster.reroute.yaml index d6a6c9d0..2e569fae 100644 --- a/spec/schemas/cluster.reroute.yaml +++ b/spec/schemas/cluster.reroute.yaml @@ -82,6 +82,18 @@ components: - index - node - shard + Metric: + type: string + enum: + - _all + - blocks + - cluster_manager_node + - master_node + - metadata + - nodes + - routing_nodes + - routing_table + - version RerouteExplanation: type: object properties: diff --git a/spec/schemas/indices.shard_stores.yaml b/spec/schemas/indices.shard_stores.yaml index a6a1a6f2..8e4268a5 100644 --- a/spec/schemas/indices.shard_stores.yaml +++ b/spec/schemas/indices.shard_stores.yaml @@ -6,7 +6,7 @@ info: paths: {} components: schemas: - ShardStoreStatus: + Status: type: string enum: - all diff --git a/spec/schemas/indices.stats.yaml b/spec/schemas/indices.stats.yaml index b2391cdd..cb13ae0b 100644 --- a/spec/schemas/indices.stats.yaml +++ b/spec/schemas/indices.stats.yaml @@ -109,6 +109,27 @@ components: $ref: '#/components/schemas/ShardRetentionLeases' shard_path: $ref: '#/components/schemas/ShardPath' + Metric: + type: string + enum: + - _all + - completion + - docs + - fielddata + - flush + - get + - indexing + - merge + - query_cache + - recovery + - refresh + - request_cache + - search + - segments + - store + - suggest + - translog + - warmer ShardCommit: type: object properties: diff --git a/spec/schemas/ml._common.yaml b/spec/schemas/ml._common.yaml index e9562151..46cffc9f 100644 --- a/spec/schemas/ml._common.yaml +++ b/spec/schemas/ml._common.yaml @@ -156,3 +156,131 @@ components: UndeployModelNodeStats: type: object additionalProperties: true + CreateConnectorRequest: + type: object + properties: + name: + type: string + description: + type: string + version: + type: integer + protocol: + type: string + credential: + $ref: '#/components/schemas/Credential' + parameters: + $ref: '#/components/schemas/Parameters' + client_config: + $ref: '#/components/schemas/ClientConfig' + actions: + type: array + items: + $ref: '#/components/schemas/Action' + required: + - actions + - credential + - description + - name + - parameters + - protocol + - version + Credential: + type: object + properties: + access_key: + type: string + secret_key: + type: string + session_token: + type: string + additionalProperties: true + Parameters: + type: object + additionalProperties: true + ClientConfig: + type: object + properties: + max_connection: + type: integer + connection_timeout: + type: integer + read_timeout: + type: integer + retry_backoff_policy: + type: string + max_retry_times: + type: integer + retry_backoff_millis: + type: integer + retry_timeout_seconds: + type: integer + Action: + type: object + properties: + action_type: + type: string + method: + type: string + headers: + $ref: '#/components/schemas/Headers' + url: + type: string + request_body: + type: string + pre_process_function: + type: string + post_process_function: + type: string + RegisterAgentsRequest: + type: object + properties: + name: + type: string + type: + type: string + description: + type: string + tools: + type: array + items: + $ref: '#/components/schemas/ToolItems' + parameters: + $ref: '#/components/schemas/Parameters' + app_type: + type: string + memory: + $ref: '#/components/schemas/Memory' + llm: + $ref: '#/components/schemas/LLM' + required: + - name + - type + LLM: + type: object + properties: + model_id: + type: string + parameters: + $ref: '#/components/schemas/Parameters' + Memory: + type: object + properties: + type: + type: string + ToolItems: + type: object + properties: + name: + type: string + type: + type: string + parameters: + $ref: '#/components/schemas/Parameters' + additionalProperties: true + Headers: + type: object + properties: + content_type: + type: string + additionalProperties: true \ No newline at end of file diff --git a/spec/schemas/snapshot.cleanup_repository.yaml b/spec/schemas/snapshot.cleanup_repository.yaml index 0682a883..de41cadb 100644 --- a/spec/schemas/snapshot.cleanup_repository.yaml +++ b/spec/schemas/snapshot.cleanup_repository.yaml @@ -11,10 +11,12 @@ components: properties: deleted_blobs: description: Number of binary large objects (blobs) removed during cleanup. - type: number + type: integer + format: int64 deleted_bytes: description: Number of bytes freed by cleanup operations. - type: number + type: integer + format: int64 required: - deleted_blobs - deleted_bytes diff --git a/tests/default/_core/search/knn/on_disk.yaml b/tests/default/_core/search/knn/on_disk.yaml new file mode 100644 index 00000000..ac42d42f --- /dev/null +++ b/tests/default/_core/search/knn/on_disk.yaml @@ -0,0 +1,71 @@ +$schema: ../../../../../json_schemas/test_story.schema.yaml + +description: Test search endpoint with knn query. +version: '>= 2.17' + +prologues: + - method: PUT + path: /movies + request: + payload: + settings: + index: + knn: true + mappings: + properties: + recommendation_vector: + type: knn_vector + dimension: 8 + space_type: l2 + data_type: float + mode: on_disk + compression_level: 16x + status: [200] + - method: POST + path: /_bulk + request: + content_type: application/x-ndjson + payload: + - {index: {_index: movies, _id: '1'}} + - {recommendation_vector: [1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5], duration: 12.2} + - {index: {_index: movies, _id: '2'}} + - {recommendation_vector: [2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5], duration: 7.1} + - {index: {_index: movies, _id: '3'}} + - {recommendation_vector: [3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5], duration: 12.9} + - {index: {_index: movies, _id: '4'}} + - {recommendation_vector: [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5], duration: 1.2} + - {index: {_index: movies, _id: '5'}} + - {recommendation_vector: [5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5], duration: 3.7} + - {index: {_index: movies, _id: '6'}} + - {recommendation_vector: [6.5, 6.5, 6.5, 6.5, 6.5, 6.5, 6.5, 6.5], duration: 10.3} + - {index: {_index: movies, _id: '7'}} + - {recommendation_vector: [7.5, 7.5, 7.5, 7.5, 7.5, 7.5, 7.5, 7.5], duration: 5.5} + - {index: {_index: movies, _id: '8'}} + - {recommendation_vector: [8.5, 8.5, 8.5, 8.5, 8.5, 8.5, 8.5, 8.5], duration: 4.4} + - {index: {_index: movies, _id: '9'}} + - {recommendation_vector: [9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5], duration: 8.9} + status: [200] +epilogues: + - path: /movies + method: DELETE + status: [200, 404] + +chapters: + - synopsis: Test k-NN disk-based search. + method: POST + path: /{index}/_search + parameters: + index: movies + request: + payload: + query: + knn: + recommendation_vector: + vector: [1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5] + k: 5 + method_parameters: + ef_search: 512 + rescore: + oversample_factor: 10 + response: + status: 200 \ No newline at end of file diff --git a/tests/default/_core/search/knn.yaml b/tests/default/_core/search/knn/search.yaml similarity index 98% rename from tests/default/_core/search/knn.yaml rename to tests/default/_core/search/knn/search.yaml index 6fcfb12e..ae4daede 100644 --- a/tests/default/_core/search/knn.yaml +++ b/tests/default/_core/search/knn/search.yaml @@ -1,4 +1,4 @@ -$schema: ../../../../json_schemas/test_story.schema.yaml +$schema: ../../../../../json_schemas/test_story.schema.yaml description: Test search endpoint with knn query. version: '>= 1.2' diff --git a/tests/default/indices/bulk/stream.yaml b/tests/default/indices/bulk/stream.yaml index 217887f6..997aa9e6 100644 --- a/tests/default/indices/bulk/stream.yaml +++ b/tests/default/indices/bulk/stream.yaml @@ -1,4 +1,4 @@ -$schema: ../../../json_schemas/test_story.schema.yaml +$schema: ../../../../json_schemas/test_story.schema.yaml description: Test bulk streaming index endpoint. epilogues: diff --git a/tests/default/knn/train_model.yaml b/tests/default/knn/train_model.yaml new file mode 100644 index 00000000..b45ac5c6 --- /dev/null +++ b/tests/default/knn/train_model.yaml @@ -0,0 +1,73 @@ +$schema: ../../../json_schemas/test_story.schema.yaml + +description: Test training k-NN model with disk-based parameters. +version: '>= 2.17' + +prologues: + - method: PUT + path: /movies + request: + payload: + settings: + index: + knn: true + mappings: + properties: + recommendation_vector: + type: knn_vector + dimension: 8 + status: [200] + - method: POST + path: /_bulk + request: + content_type: application/x-ndjson + payload: + - {index: {_index: movies, _id: '1'}} + - {recommendation_vector: [1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5], duration: 12.2} + - {index: {_index: movies, _id: '2'}} + - {recommendation_vector: [2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5], duration: 7.1} + - {index: {_index: movies, _id: '3'}} + - {recommendation_vector: [3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5], duration: 12.9} + - {index: {_index: movies, _id: '4'}} + - {recommendation_vector: [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5], duration: 1.2} + - {index: {_index: movies, _id: '5'}} + - {recommendation_vector: [5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5], duration: 3.7} + - {index: {_index: movies, _id: '6'}} + - {recommendation_vector: [6.5, 6.5, 6.5, 6.5, 6.5, 6.5, 6.5, 6.5], duration: 10.3} + - {index: {_index: movies, _id: '7'}} + - {recommendation_vector: [7.5, 7.5, 7.5, 7.5, 7.5, 7.5, 7.5, 7.5], duration: 5.5} + - {index: {_index: movies, _id: '8'}} + - {recommendation_vector: [8.5, 8.5, 8.5, 8.5, 8.5, 8.5, 8.5, 8.5], duration: 4.4} + - {index: {_index: movies, _id: '9'}} + - {recommendation_vector: [9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5], duration: 8.9} + status: [200] +epilogues: + - path: /movies + method: DELETE + status: [200, 404] + - path: /_plugins/_knn/models/{model_id} + parameters: + model_id: ${train_model.test_model_id} + method: DELETE + status: [200, 404] + +chapters: + - synopsis: Test training a model with disk-based parameters. + id: train_model + method: POST + path: /_plugins/_knn/models/_train + request: + payload: + training_index: movies + training_field: recommendation_vector + dimension: 8 + max_training_vector_count: 1200 + search_size: 100 + description: Test model + mode: on_disk + compression_level: 32x + spaceType: l2 + response: + status: 200 + output: + test_model_id: payload.model_id \ No newline at end of file diff --git a/tests/plugins/ml/ml/agents.yaml b/tests/plugins/ml/ml/agents.yaml new file mode 100644 index 00000000..be85d327 --- /dev/null +++ b/tests/plugins/ml/ml/agents.yaml @@ -0,0 +1,50 @@ +$schema: ../../../../json_schemas/test_story.schema.yaml + +description: Test the register of Agents. +distributions: + excluded: + - amazon-managed + - amazon-serverless +version: '>= 2.11' +epilogues: + - path: /_plugins/_ml/agents/{agent_id} + method: DELETE + status: [200, 404] + parameters: + agent_id: ${register_agent.test_agent_id} +chapters: + - synopsis: Register agent. + warnings: + multiple-paths-detected: false + id: register_agent + path: /_plugins/_ml/agents/_register + method: POST + request: + payload: + name: Test_Agent_For_RAG + type: flow + description: this is a test agent + tools: + - type: VectorDBTool + parameters: + model_id: YOUR_TEXT_EMBEDDING_MODEL_ID + index: my_test_data + embedding_field: embedding + source_field: + - text + input: test_question + - type: MLModelTool + description: A general tool to answer any question + parameters: + model_id: YOUR_LLM_MODEL_ID + response: + status: 200 + output: + test_agent_id: payload.agent_id + - synopsis: Delete agent. + path: /_plugins/_ml/agents/{agent_id} + method: DELETE + parameters: + agent_id: ${register_agent.test_agent_id} + response: + status: 200 \ No newline at end of file diff --git a/tests/plugins/ml/ml/connectors.yaml b/tests/plugins/ml/ml/connectors.yaml new file mode 100644 index 00000000..201019c0 --- /dev/null +++ b/tests/plugins/ml/ml/connectors.yaml @@ -0,0 +1,50 @@ +$schema: ../../../../json_schemas/test_story.schema.yaml + +description: Test the creation of connectors. +distributions: + excluded: + - amazon-managed + - amazon-serverless +version: '>= 2.11' +epilogues: + - path: /_plugins/_ml/connectors/{connector_id} + method: DELETE + status: [200, 404] + parameters: + connector_id: ${create_connector.test_connector_id} +chapters: + - synopsis: Create connector. + warnings: + multiple-paths-detected: false + id: create_connector + path: /_plugins/_ml/connectors/_create + method: POST + request: + payload: + name: OpenAI Chat Connector + description: The connector to public OpenAI model service for GPT 3.5 + version: 1 + protocol: http + parameters: + endpoint: api.openai.com + model: gpt-3.5-turbo + credential: + openAI_key: test_api_key + actions: + - action_type: predict + method: POST + url: 'https://${parameters.endpoint}/v1/chat/completions' + headers: + Authorization: 'Bearer ${credential.openAI_key}' + request_body: '{ "model": "${parameters.model}", "messages": ${parameters.messages} }' + response: + status: 200 + output: + test_connector_id: payload.connector_id + - synopsis: Delete connector. + path: /_plugins/_ml/connectors/{connector_id} + method: DELETE + parameters: + connector_id: ${create_connector.test_connector_id} + response: + status: 200 \ No newline at end of file diff --git a/tools/tests/tester/fixtures/evals/passed/passed.yaml b/tools/tests/tester/fixtures/evals/passed/passed.yaml index da08a29f..a87c944c 100644 --- a/tools/tests/tester/fixtures/evals/passed/passed.yaml +++ b/tools/tests/tester/fixtures/evals/passed/passed.yaml @@ -202,7 +202,7 @@ chapters: - title: This GET /_cat/health should be skipped (> 2.999.0). overall: result: SKIPPED - message: Skipped because version 2.16.0 does not satisfy >= 2.999.0. + message: Skipped because version 2.17.0 does not satisfy >= 2.999.0. - title: This GET /_cat/health should run (>= 1.3, < 99.0). overall: result: PASSED diff --git a/tools/tests/tester/fixtures/evals/skipped/semver.yaml b/tools/tests/tester/fixtures/evals/skipped/semver.yaml index 30709742..799717af 100644 --- a/tools/tests/tester/fixtures/evals/skipped/semver.yaml +++ b/tools/tests/tester/fixtures/evals/skipped/semver.yaml @@ -3,5 +3,5 @@ full_path: tools/tests/tester/fixtures/stories/skipped/semver.yaml result: SKIPPED description: This story should be skipped because of version. -message: Skipped because version 2.16.0 does not satisfy >= 2.999.0. +message: Skipped because version 2.17.0 does not satisfy >= 2.999.0. diff --git a/tools/tests/tester/helpers.ts b/tools/tests/tester/helpers.ts index 1a38c4c6..354fcabe 100644 --- a/tools/tests/tester/helpers.ts +++ b/tools/tests/tester/helpers.ts @@ -142,5 +142,5 @@ export async function load_actual_evaluation (evaluator: StoryEvaluator, name: s full_path, display_path: `${name}.yaml`, story: read_yaml(full_path) - }, process.env.OPENSEARCH_VERSION ?? '2.16.0', process.env.OPENSEARCH_DISTRIBUTION ?? 'opensearch.org')) + }, process.env.OPENSEARCH_VERSION ?? '2.17.0', process.env.OPENSEARCH_DISTRIBUTION ?? 'opensearch.org')) }