stretchy-model 0.6.6 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/docs/_sidebar.md +2 -1
  3. data/docs/examples/_sidebar.md +1 -1
  4. data/docs/examples/neural_search_with_llm.md +381 -0
  5. data/docs/guides/_sidebar.md +2 -1
  6. data/lib/elasticsearch/api/actions/connector/check_in.rb +64 -0
  7. data/lib/elasticsearch/api/actions/connector/delete.rb +64 -0
  8. data/lib/elasticsearch/api/actions/connector/get.rb +64 -0
  9. data/lib/elasticsearch/api/actions/connector/last_sync.rb +66 -0
  10. data/lib/elasticsearch/api/actions/connector/list.rb +60 -0
  11. data/lib/elasticsearch/api/actions/connector/post.rb +57 -0
  12. data/lib/elasticsearch/api/actions/connector/put.rb +66 -0
  13. data/lib/elasticsearch/api/actions/connector/update_api_key_id.rb +66 -0
  14. data/lib/elasticsearch/api/actions/connector/update_configuration.rb +66 -0
  15. data/lib/elasticsearch/api/actions/connector/update_error.rb +66 -0
  16. data/lib/elasticsearch/api/actions/connector/update_filtering.rb +66 -0
  17. data/lib/elasticsearch/api/actions/connector/update_index_name.rb +66 -0
  18. data/lib/elasticsearch/api/actions/connector/update_name.rb +66 -0
  19. data/lib/elasticsearch/api/actions/connector/update_native.rb +66 -0
  20. data/lib/elasticsearch/api/actions/connector/update_pipeline.rb +66 -0
  21. data/lib/elasticsearch/api/actions/connector/update_scheduling.rb +66 -0
  22. data/lib/elasticsearch/api/actions/connector/update_service_type.rb +66 -0
  23. data/lib/elasticsearch/api/actions/connector/update_status.rb +66 -0
  24. data/lib/elasticsearch/api/namespace/connector.rb +36 -0
  25. data/lib/opensearch/api/actions/machine_learning/connector/delete.rb +42 -0
  26. data/lib/opensearch/api/actions/machine_learning/connector/get.rb +42 -0
  27. data/lib/opensearch/api/actions/machine_learning/connector/list.rb +38 -0
  28. data/lib/opensearch/api/actions/machine_learning/connector/post.rb +35 -0
  29. data/lib/opensearch/api/actions/machine_learning/connector/put.rb +44 -0
  30. data/lib/opensearch/api/actions/machine_learning/models/predict.rb +32 -0
  31. data/lib/opensearch/api/namespace/connector.rb +19 -0
  32. data/lib/stretchy/machine_learning/connector.rb +130 -0
  33. data/lib/stretchy/machine_learning/errors.rb +25 -0
  34. data/lib/stretchy/machine_learning/model.rb +162 -109
  35. data/lib/stretchy/machine_learning/registry.rb +19 -0
  36. data/lib/stretchy/open_search_compatibility.rb +2 -0
  37. data/lib/stretchy/pipelines/processor.rb +2 -0
  38. data/lib/stretchy/rails/railtie.rb +11 -0
  39. data/lib/stretchy/rails/tasks/connector/create.rake +32 -0
  40. data/lib/stretchy/rails/tasks/connector/delete.rake +27 -0
  41. data/lib/stretchy/rails/tasks/connector/status.rake +31 -0
  42. data/lib/stretchy/rails/tasks/connector/update.rake +32 -0
  43. data/lib/stretchy/rails/tasks/index/create.rake +28 -0
  44. data/lib/stretchy/rails/tasks/index/delete.rake +27 -0
  45. data/lib/stretchy/rails/tasks/index/status.rake +23 -0
  46. data/lib/stretchy/rails/tasks/ml/delete.rake +25 -0
  47. data/lib/stretchy/rails/tasks/ml/deploy.rake +78 -0
  48. data/lib/stretchy/rails/tasks/ml/status.rake +31 -0
  49. data/lib/stretchy/rails/tasks/pipeline/create.rake +27 -0
  50. data/lib/stretchy/rails/tasks/pipeline/delete.rake +26 -0
  51. data/lib/stretchy/rails/tasks/pipeline/status.rake +25 -0
  52. data/lib/stretchy/rails/tasks/status.rake +15 -0
  53. data/lib/stretchy/rails/tasks/stretchy.rake +42 -0
  54. data/lib/stretchy/version.rb +1 -1
  55. data/lib/stretchy.rb +7 -0
  56. metadata +62 -3
  57. data/docs/examples/semantic_search_with_llm.md +0 -83
@@ -0,0 +1,66 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+ #
18
+ # Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80
19
+ # @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec
20
+ #
21
+ module Elasticsearch
22
+ module API
23
+ module Connector
24
+ module Actions
25
+ # Updates the pipeline field in the connector document.
26
+ # This functionality is Experimental and may be changed or removed
27
+ # completely in a future release. Elastic will take a best effort approach
28
+ # to fix any issues, but experimental features are not subject to the
29
+ # support SLA of official GA features.
30
+ #
31
+ # @option arguments [String] :connector_id The unique identifier of the connector to be updated.
32
+ # @option arguments [Hash] :headers Custom HTTP headers
33
+ # @option arguments [Hash] :body An object with connector ingest pipeline configuration. (*Required*)
34
+ #
35
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/update-connector-pipeline-api.html
36
+ #
37
+ def update_pipeline(arguments = {})
38
+ request_opts = { endpoint: arguments[:endpoint] || 'connector.update_pipeline' }
39
+
40
+ defined_params = [:connector_id].each_with_object({}) do |variable, set_variables|
41
+ set_variables[variable] = arguments[variable] if arguments.key?(variable)
42
+ end
43
+ request_opts[:defined_params] = defined_params unless defined_params.empty?
44
+
45
+ raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
46
+ raise ArgumentError, "Required argument 'connector_id' missing" unless arguments[:connector_id]
47
+
48
+ arguments = arguments.clone
49
+ headers = arguments.delete(:headers) || {}
50
+
51
+ body = arguments.delete(:body)
52
+
53
+ _connector_id = arguments.delete(:connector_id)
54
+
55
+ method = Elasticsearch::API::HTTP_PUT
56
+ path = "_connector/#{Utils.__listify(_connector_id)}/_pipeline"
57
+ params = {}
58
+
59
+ Elasticsearch::API::Response.new(
60
+ perform_request(method, path, params, body, headers, request_opts)
61
+ )
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,66 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+ #
18
+ # Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80
19
+ # @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec
20
+ #
21
+ module Elasticsearch
22
+ module API
23
+ module Connector
24
+ module Actions
25
+ # Updates the scheduling field in the connector document.
26
+ # This functionality is Experimental and may be changed or removed
27
+ # completely in a future release. Elastic will take a best effort approach
28
+ # to fix any issues, but experimental features are not subject to the
29
+ # support SLA of official GA features.
30
+ #
31
+ # @option arguments [String] :connector_id The unique identifier of the connector to be updated.
32
+ # @option arguments [Hash] :headers Custom HTTP headers
33
+ # @option arguments [Hash] :body An object containing the connector's scheduling configuration. (*Required*)
34
+ #
35
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/update-connector-scheduling-api.html
36
+ #
37
+ def update_scheduling(arguments = {})
38
+ request_opts = { endpoint: arguments[:endpoint] || 'connector.update_scheduling' }
39
+
40
+ defined_params = [:connector_id].each_with_object({}) do |variable, set_variables|
41
+ set_variables[variable] = arguments[variable] if arguments.key?(variable)
42
+ end
43
+ request_opts[:defined_params] = defined_params unless defined_params.empty?
44
+
45
+ raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
46
+ raise ArgumentError, "Required argument 'connector_id' missing" unless arguments[:connector_id]
47
+
48
+ arguments = arguments.clone
49
+ headers = arguments.delete(:headers) || {}
50
+
51
+ body = arguments.delete(:body)
52
+
53
+ _connector_id = arguments.delete(:connector_id)
54
+
55
+ method = Elasticsearch::API::HTTP_PUT
56
+ path = "_connector/#{Utils.__listify(_connector_id)}/_scheduling"
57
+ params = {}
58
+
59
+ Elasticsearch::API::Response.new(
60
+ perform_request(method, path, params, body, headers, request_opts)
61
+ )
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,66 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+ #
18
+ # Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80
19
+ # @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec
20
+ #
21
+ module Elasticsearch
22
+ module API
23
+ module Connector
24
+ module Actions
25
+ # Updates the service type of the connector.
26
+ # This functionality is Experimental and may be changed or removed
27
+ # completely in a future release. Elastic will take a best effort approach
28
+ # to fix any issues, but experimental features are not subject to the
29
+ # support SLA of official GA features.
30
+ #
31
+ # @option arguments [String] :connector_id The unique identifier of the connector to be updated.
32
+ # @option arguments [Hash] :headers Custom HTTP headers
33
+ # @option arguments [Hash] :body An object containing the connector's service type. (*Required*)
34
+ #
35
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/update-connector-service-type-api.html
36
+ #
37
+ def update_service_type(arguments = {})
38
+ request_opts = { endpoint: arguments[:endpoint] || 'connector.update_service_type' }
39
+
40
+ defined_params = [:connector_id].each_with_object({}) do |variable, set_variables|
41
+ set_variables[variable] = arguments[variable] if arguments.key?(variable)
42
+ end
43
+ request_opts[:defined_params] = defined_params unless defined_params.empty?
44
+
45
+ raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
46
+ raise ArgumentError, "Required argument 'connector_id' missing" unless arguments[:connector_id]
47
+
48
+ arguments = arguments.clone
49
+ headers = arguments.delete(:headers) || {}
50
+
51
+ body = arguments.delete(:body)
52
+
53
+ _connector_id = arguments.delete(:connector_id)
54
+
55
+ method = Elasticsearch::API::HTTP_PUT
56
+ path = "_connector/#{Utils.__listify(_connector_id)}/_service_type"
57
+ params = {}
58
+
59
+ Elasticsearch::API::Response.new(
60
+ perform_request(method, path, params, body, headers, request_opts)
61
+ )
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,66 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+ #
18
+ # Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80
19
+ # @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec
20
+ #
21
+ module Elasticsearch
22
+ module API
23
+ module Connector
24
+ module Actions
25
+ # Updates the status of the connector.
26
+ # This functionality is Experimental and may be changed or removed
27
+ # completely in a future release. Elastic will take a best effort approach
28
+ # to fix any issues, but experimental features are not subject to the
29
+ # support SLA of official GA features.
30
+ #
31
+ # @option arguments [String] :connector_id The unique identifier of the connector to be updated.
32
+ # @option arguments [Hash] :headers Custom HTTP headers
33
+ # @option arguments [Hash] :body An object containing the connector's status. (*Required*)
34
+ #
35
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/update-connector-status-api.html
36
+ #
37
+ def update_status(arguments = {})
38
+ request_opts = { endpoint: arguments[:endpoint] || 'connector.update_status' }
39
+
40
+ defined_params = [:connector_id].each_with_object({}) do |variable, set_variables|
41
+ set_variables[variable] = arguments[variable] if arguments.key?(variable)
42
+ end
43
+ request_opts[:defined_params] = defined_params unless defined_params.empty?
44
+
45
+ raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
46
+ raise ArgumentError, "Required argument 'connector_id' missing" unless arguments[:connector_id]
47
+
48
+ arguments = arguments.clone
49
+ headers = arguments.delete(:headers) || {}
50
+
51
+ body = arguments.delete(:body)
52
+
53
+ _connector_id = arguments.delete(:connector_id)
54
+
55
+ method = Elasticsearch::API::HTTP_PUT
56
+ path = "_connector/#{Utils.__listify(_connector_id)}/_status"
57
+ params = {}
58
+
59
+ Elasticsearch::API::Response.new(
60
+ perform_request(method, path, params, body, headers, request_opts)
61
+ )
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,36 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ module Elasticsearch
19
+ module API
20
+ module Connector
21
+ module Actions; end
22
+
23
+ # Client for the "connector" namespace (includes the {Connector::Actions} methods)
24
+ #
25
+ class ConnectorClient
26
+ include Common::Client, Common::Client::Base, Connector::Actions
27
+ end
28
+
29
+ # Proxy method for {ConnectorClient}, available in the receiving object
30
+ #
31
+ def connector
32
+ @connector ||= ConnectorClient.new(self)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,42 @@
1
+ module OpenSearch
2
+ module API
3
+ module Connector
4
+ module Actions
5
+ # Deletes a connector.
6
+ # This functionality is Experimental and may be changed or removed
7
+ # completely in a future release. Elastic will take a best effort approach
8
+ # to fix any issues, but experimental features are not subject to the
9
+ # support SLA of official GA features.
10
+ #
11
+ # @option arguments [String] :connector_id The unique identifier of the connector to be deleted.
12
+ # @option arguments [Hash] :headers Custom HTTP headers
13
+ #
14
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.13/delete-connector-api.html
15
+ #
16
+ def delete(arguments = {})
17
+ request_opts = { endpoint: arguments[:endpoint] || 'connector.delete' }
18
+
19
+ defined_params = [:connector_id].each_with_object({}) do |variable, set_variables|
20
+ set_variables[variable] = arguments[variable] if arguments.key?(variable)
21
+ end
22
+ request_opts[:defined_params] = defined_params unless defined_params.empty?
23
+
24
+ raise ArgumentError, "Required argument 'connector_id' missing" unless arguments[:connector_id]
25
+
26
+ arguments = arguments.clone
27
+ headers = arguments.delete(:headers) || {}
28
+
29
+ body = nil
30
+
31
+ _connector_id = arguments.delete(:connector_id)
32
+
33
+ method = OpenSearch::API::HTTP_DELETE
34
+ path = "_plugins/_ml/connectors/#{Utils.__listify(_connector_id)}"
35
+ params = {}
36
+
37
+ perform_request(method, path, params, body, headers).body
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,42 @@
1
+ module OpenSearch
2
+ module API
3
+ module Connector
4
+ module Actions
5
+ # Returns the details about a connector.
6
+ # This functionality is Experimental and may be changed or removed
7
+ # completely in a future release. Elastic will take a best effort approach
8
+ # to fix any issues, but experimental features are not subject to the
9
+ # support SLA of official GA features.
10
+ #
11
+ # @option arguments [String] :connector_id The unique identifier of the connector to be returned.
12
+ # @option arguments [Hash] :headers Custom HTTP headers
13
+ #
14
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.13/get-connector-api.html
15
+ #
16
+ def get(arguments = {})
17
+ request_opts = { endpoint: arguments[:endpoint] || 'connector.get' }
18
+
19
+ defined_params = [:connector_id].each_with_object({}) do |variable, set_variables|
20
+ set_variables[variable] = arguments[variable] if arguments.key?(variable)
21
+ end
22
+ request_opts[:defined_params] = defined_params unless defined_params.empty?
23
+
24
+ raise ArgumentError, "Required argument 'connector_id' missing" unless arguments[:connector_id]
25
+
26
+ arguments = arguments.clone
27
+ headers = arguments.delete(:headers) || {}
28
+
29
+ body = nil
30
+
31
+ _connector_id = arguments.delete(:connector_id)
32
+
33
+ method = OpenSearch::API::HTTP_GET
34
+ path = "_plugins/_ml/connectors/#{Utils.__listify(_connector_id)}"
35
+ params = {}
36
+
37
+ perform_request(method, path, params, body, headers).body
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,38 @@
1
+ module OpenSearch
2
+ module API
3
+ module Connector
4
+ module Actions
5
+ # Lists all connectors.
6
+ # This functionality is Experimental and may be changed or removed
7
+ # completely in a future release. Elastic will take a best effort approach
8
+ # to fix any issues, but experimental features are not subject to the
9
+ # support SLA of official GA features.
10
+ #
11
+ # @option arguments [Integer] :from Starting offset (default: 0)
12
+ # @option arguments [Integer] :size Specifies a max number of results to get (default: 100)
13
+ # @option arguments [List] :index_name A comma-separated list of connector index names to fetch connector documents for
14
+ # @option arguments [List] :connector_name A comma-separated list of connector names to fetch connector documents for
15
+ # @option arguments [List] :service_type A comma-separated list of connector service types to fetch connector documents for
16
+ # @option arguments [String] :query A search string for querying connectors, filtering results by matching against connector names, descriptions, and index names
17
+ # @option arguments [Hash] :headers Custom HTTP headers
18
+ #
19
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.13/list-connector-api.html
20
+ #
21
+ def list(arguments = {})
22
+ request_opts = { endpoint: arguments[:endpoint] || 'connector.list' }
23
+
24
+ arguments = arguments.clone
25
+ headers = arguments.delete(:headers) || {}
26
+
27
+ body = nil
28
+
29
+ method = OpenSearch::API::HTTP_GET
30
+ path = '_plugins/_ml/connectors'
31
+ params = Utils.process_params(arguments)
32
+
33
+ perform_request(method, path, params, body, headers).body
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,35 @@
1
+ module OpenSearch
2
+ module API
3
+ module Connector
4
+ module Actions
5
+ # Creates a connector.
6
+ # This functionality is Experimental and may be changed or removed
7
+ # completely in a future release. Elastic will take a best effort approach
8
+ # to fix any issues, but experimental features are not subject to the
9
+ # support SLA of official GA features.
10
+ #
11
+ # @option arguments [Hash] :headers Custom HTTP headers
12
+ # @option arguments [Hash] :body The connector configuration. (*Required*)
13
+ #
14
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.13/create-connector-api.html
15
+ #
16
+ def post(arguments = {})
17
+ request_opts = { endpoint: arguments[:endpoint] || 'connector.post' }
18
+
19
+ raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
20
+
21
+ arguments = arguments.clone
22
+ headers = arguments.delete(:headers) || {}
23
+
24
+ body = arguments.delete(:body)
25
+
26
+ method = OpenSearch::API::HTTP_POST
27
+ path = '_plugins/_ml/connectors/_create'
28
+ params = {}
29
+
30
+ perform_request(method, path, params, body, headers).body
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,44 @@
1
+ module OpenSearch
2
+ module API
3
+ module Connector
4
+ module Actions
5
+ # Creates or updates a connector.
6
+ # This functionality is Experimental and may be changed or removed
7
+ # completely in a future release. Elastic will take a best effort approach
8
+ # to fix any issues, but experimental features are not subject to the
9
+ # support SLA of official GA features.
10
+ #
11
+ # @option arguments [String] :connector_id The unique identifier of the connector to be created or updated.
12
+ # @option arguments [Hash] :headers Custom HTTP headers
13
+ # @option arguments [Hash] :body The connector configuration. (*Required*)
14
+ #
15
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.13/create-connector-api.html
16
+ #
17
+ def put(arguments = {})
18
+ request_opts = { endpoint: arguments[:endpoint] || 'connector.put' }
19
+
20
+ defined_params = [:connector_id].each_with_object({}) do |variable, set_variables|
21
+ set_variables[variable] = arguments[variable] if arguments.key?(variable)
22
+ end
23
+ request_opts[:defined_params] = defined_params unless defined_params.empty?
24
+
25
+ raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
26
+ raise ArgumentError, "Required argument 'connector_id' missing" unless arguments[:connector_id]
27
+
28
+ arguments = arguments.clone
29
+ headers = arguments.delete(:headers) || {}
30
+
31
+ body = arguments.delete(:body)
32
+
33
+ _connector_id = arguments.delete(:connector_id)
34
+
35
+ method = OpenSearch::API::HTTP_PUT
36
+ path = "_plugins/_ml/connectors/#{Utils.__listify(_connector_id)}"
37
+ params = {}
38
+
39
+ perform_request(method, path, params, body, headers).body
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,32 @@
1
+ module OpenSearch
2
+ module API
3
+ module MachineLearning
4
+ module Models
5
+ module Actions
6
+ # Register a model.
7
+ #
8
+ # @option arguments [String] :model_id The model id
9
+ # @option arguments [Hash] :body The deploy options
10
+ #
11
+ #
12
+ # POST /_plugins/_ml/models/<model_id>/_predict
13
+ def predict(arguments = {})
14
+ raise ArgumentError, "Required argument 'model_id' missing" unless arguments[:model_id]
15
+ raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
16
+ _id = arguments.delete(:model_id)
17
+ arguments = arguments.clone
18
+ headers = arguments.delete(:headers) || {}
19
+
20
+ method = OpenSearch::API::HTTP_POST
21
+ path = "_plugins/_ml/models/#{Utils.__listify(_id)}/_predict"
22
+ params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
23
+
24
+ body = arguments[:body]
25
+ perform_request(method, path, params, body, headers).body
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,19 @@
1
+ module OpenSearch
2
+ module API
3
+ module Connector
4
+ module Actions; end
5
+
6
+ # Client for the "connector" namespace (includes the {Connector::Actions} methods)
7
+ #
8
+ class ConnectorClient
9
+ include Common::Client, Common::Client::Base, Connector::Actions
10
+ end
11
+
12
+ # Proxy method for {ConnectorClient}, available in the receiving object
13
+ #
14
+ def connector
15
+ @connector ||= ConnectorClient.new(self)
16
+ end
17
+ end
18
+ end
19
+ end