Skip to content

Commit 830dd9d

Browse files
committed
[API] Updates inference endpoints
1 parent 97aed6c commit 830dd9d

38 files changed

+1775
-98
lines changed

elasticsearch-api/lib/elasticsearch/api/actions/inference/delete.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,27 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717
#
18-
# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80
19-
# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec
18+
# Auto generated from commit c34efd13258a01121b10a538e5b450b4e65c7bf3
19+
# @see https://github.com/elastic/elasticsearch-specification
2020
#
2121
module Elasticsearch
2222
module API
2323
module Inference
2424
module Actions
2525
# Delete an inference endpoint
2626
#
27-
# @option arguments [String] :inference_id The inference Id
2827
# @option arguments [String] :task_type The task type
29-
# @option arguments [Boolean] :dry_run If true the endpoint will not be deleted and a list of ingest processors which reference this endpoint will be returned.
30-
# @option arguments [Boolean] :force If true the endpoint will be forcefully stopped (regardless of whether or not it is referenced by any ingest processors or semantic text fields).
28+
# @option arguments [String] :inference_id The inference identifier. (*Required*)
29+
# @option arguments [Boolean] :dry_run When true, the endpoint is not deleted and a list of ingest processors which reference this endpoint is returned.
30+
# @option arguments [Boolean] :force When true, the inference endpoint is forcefully deleted even if it is still being used by ingest processors or semantic text fields.
3131
# @option arguments [Hash] :headers Custom HTTP headers
3232
#
33-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-inference-api.html
33+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-delete
3434
#
3535
def delete(arguments = {})
3636
request_opts = { endpoint: arguments[:endpoint] || 'inference.delete' }
3737

38-
defined_params = %i[inference_id task_type].each_with_object({}) do |variable, set_variables|
38+
defined_params = [:inference_id, :task_type].each_with_object({}) do |variable, set_variables|
3939
set_variables[variable] = arguments[variable] if arguments.key?(variable)
4040
end
4141
request_opts[:defined_params] = defined_params unless defined_params.empty?
@@ -47,15 +47,15 @@ def delete(arguments = {})
4747

4848
body = nil
4949

50-
_inference_id = arguments.delete(:inference_id)
51-
5250
_task_type = arguments.delete(:task_type)
5351

52+
_inference_id = arguments.delete(:inference_id)
53+
5454
method = Elasticsearch::API::HTTP_DELETE
5555
path = if _task_type && _inference_id
56-
"_inference/#{Utils.__listify(_task_type)}/#{Utils.__listify(_inference_id)}"
56+
"_inference/#{Utils.listify(_task_type)}/#{Utils.listify(_inference_id)}"
5757
else
58-
"_inference/#{Utils.__listify(_inference_id)}"
58+
"_inference/#{Utils.listify(_inference_id)}"
5959
end
6060
params = Utils.process_params(arguments)
6161

elasticsearch-api/lib/elasticsearch/api/actions/inference/get.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717
#
18-
# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80
19-
# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec
18+
# Auto generated from commit c34efd13258a01121b10a538e5b450b4e65c7bf3
19+
# @see https://github.com/elastic/elasticsearch-specification
2020
#
2121
module Elasticsearch
2222
module API
2323
module Inference
2424
module Actions
2525
# Get an inference endpoint
2626
#
27-
# @option arguments [String] :inference_id The inference Id
2827
# @option arguments [String] :task_type The task type
28+
# @option arguments [String] :inference_id The inference Id
2929
# @option arguments [Hash] :headers Custom HTTP headers
3030
#
31-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-inference-api.html
31+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-get
3232
#
3333
def get(arguments = {})
3434
request_opts = { endpoint: arguments[:endpoint] || 'inference.get' }
3535

36-
defined_params = %i[inference_id task_type].each_with_object({}) do |variable, set_variables|
36+
defined_params = [:inference_id, :task_type].each_with_object({}) do |variable, set_variables|
3737
set_variables[variable] = arguments[variable] if arguments.key?(variable)
3838
end
3939
request_opts[:defined_params] = defined_params unless defined_params.empty?
@@ -43,15 +43,15 @@ def get(arguments = {})
4343

4444
body = nil
4545

46-
_inference_id = arguments.delete(:inference_id)
47-
4846
_task_type = arguments.delete(:task_type)
4947

48+
_inference_id = arguments.delete(:inference_id)
49+
5050
method = Elasticsearch::API::HTTP_GET
5151
path = if _task_type && _inference_id
52-
"_inference/#{Utils.__listify(_task_type)}/#{Utils.__listify(_inference_id)}"
52+
"_inference/#{Utils.listify(_task_type)}/#{Utils.listify(_inference_id)}"
5353
elsif _inference_id
54-
"_inference/#{Utils.__listify(_inference_id)}"
54+
"_inference/#{Utils.listify(_inference_id)}"
5555
else
5656
'_inference'
5757
end

elasticsearch-api/lib/elasticsearch/api/actions/inference/inference.rb renamed to elasticsearch-api/lib/elasticsearch/api/actions/inference/post_eis_chat_completion.rb

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,47 +15,42 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717
#
18-
# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80
19-
# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec
18+
# Auto generated from commit c34efd13258a01121b10a538e5b450b4e65c7bf3
19+
# @see https://github.com/elastic/elasticsearch-specification
2020
#
2121
module Elasticsearch
2222
module API
2323
module Inference
2424
module Actions
25-
# Perform inference
25+
# Perform a chat completion task through the Elastic Inference Service (EIS).
26+
# Perform a chat completion inference task with the +elastic+ service.
2627
#
27-
# @option arguments [String] :inference_id The inference Id
28-
# @option arguments [String] :task_type The task type
28+
# @option arguments [String] :eis_inference_id The unique identifier of the inference endpoint. (*Required*)
2929
# @option arguments [Hash] :headers Custom HTTP headers
30-
# @option arguments [Hash] :body The inference payload
30+
# @option arguments [Hash] :body chat_completion_request
3131
#
32-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/post-inference-api.html
32+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-post-eis-chat-completion
3333
#
34-
def inference(arguments = {})
35-
request_opts = { endpoint: arguments[:endpoint] || 'inference.inference' }
34+
def post_eis_chat_completion(arguments = {})
35+
request_opts = { endpoint: arguments[:endpoint] || 'inference.post_eis_chat_completion' }
3636

37-
defined_params = %i[inference_id task_type].each_with_object({}) do |variable, set_variables|
37+
defined_params = [:eis_inference_id].each_with_object({}) do |variable, set_variables|
3838
set_variables[variable] = arguments[variable] if arguments.key?(variable)
3939
end
4040
request_opts[:defined_params] = defined_params unless defined_params.empty?
4141

42-
raise ArgumentError, "Required argument 'inference_id' missing" unless arguments[:inference_id]
42+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
43+
raise ArgumentError, "Required argument 'eis_inference_id' missing" unless arguments[:eis_inference_id]
4344

4445
arguments = arguments.clone
4546
headers = arguments.delete(:headers) || {}
4647

4748
body = arguments.delete(:body)
4849

49-
_inference_id = arguments.delete(:inference_id)
50-
51-
_task_type = arguments.delete(:task_type)
50+
_eis_inference_id = arguments.delete(:eis_inference_id)
5251

5352
method = Elasticsearch::API::HTTP_POST
54-
path = if _task_type && _inference_id
55-
"_inference/#{Utils.__listify(_task_type)}/#{Utils.__listify(_inference_id)}"
56-
else
57-
"_inference/#{Utils.__listify(_inference_id)}"
58-
end
53+
path = "_inference/chat_completion/#{Utils.listify(_eis_inference_id)}/_stream"
5954
params = {}
6055

6156
Elasticsearch::API::Response.new(

elasticsearch-api/lib/elasticsearch/api/actions/inference/put.rb

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,46 +15,55 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717
#
18-
# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80
19-
# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec
18+
# Auto generated from commit c34efd13258a01121b10a538e5b450b4e65c7bf3
19+
# @see https://github.com/elastic/elasticsearch-specification
2020
#
2121
module Elasticsearch
2222
module API
2323
module Inference
2424
module Actions
25-
# Configure an inference endpoint for use in the Inference API
25+
# Create an inference endpoint.
26+
# When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running.
27+
# After creating the endpoint, wait for the model deployment to complete before using it.
28+
# To verify the deployment status, use the get trained model statistics API.
29+
# Look for +"state": "fully_allocated"+ in the response and ensure that the +"allocation_count"+ matches the +"target_allocation_count"+.
30+
# Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.
31+
# IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face.
32+
# For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models.
33+
# However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.
2634
#
27-
# @option arguments [String] :inference_id The inference Id
2835
# @option arguments [String] :task_type The task type
36+
# @option arguments [String] :inference_id The inference Id (*Required*)
2937
# @option arguments [Hash] :headers Custom HTTP headers
30-
# @option arguments [Hash] :body The inference endpoint's task and service settings
38+
# @option arguments [Hash] :body inference_config
3139
#
32-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/put-inference-api.html
40+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put
3341
#
3442
def put(arguments = {})
3543
request_opts = { endpoint: arguments[:endpoint] || 'inference.put' }
3644

37-
defined_params = %i[inference_id task_type].each_with_object({}) do |variable, set_variables|
45+
defined_params = [:inference_id, :task_type].each_with_object({}) do |variable, set_variables|
3846
set_variables[variable] = arguments[variable] if arguments.key?(variable)
3947
end
4048
request_opts[:defined_params] = defined_params unless defined_params.empty?
4149

50+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
4251
raise ArgumentError, "Required argument 'inference_id' missing" unless arguments[:inference_id]
4352

4453
arguments = arguments.clone
4554
headers = arguments.delete(:headers) || {}
4655

4756
body = arguments.delete(:body)
4857

49-
_inference_id = arguments.delete(:inference_id)
50-
5158
_task_type = arguments.delete(:task_type)
5259

60+
_inference_id = arguments.delete(:inference_id)
61+
5362
method = Elasticsearch::API::HTTP_PUT
5463
path = if _task_type && _inference_id
55-
"_inference/#{Utils.__listify(_task_type)}/#{Utils.__listify(_inference_id)}"
64+
"_inference/#{Utils.listify(_task_type)}/#{Utils.listify(_inference_id)}"
5665
else
57-
"_inference/#{Utils.__listify(_inference_id)}"
66+
"_inference/#{Utils.listify(_inference_id)}"
5867
end
5968
params = {}
6069

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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 commit c34efd13258a01121b10a538e5b450b4e65c7bf3
19+
# @see https://github.com/elastic/elasticsearch-specification
20+
#
21+
module Elasticsearch
22+
module API
23+
module Inference
24+
module Actions
25+
# Create an AlibabaCloud AI Search inference endpoint.
26+
# Create an inference endpoint to perform an inference task with the +alibabacloud-ai-search+ service.
27+
# When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running.
28+
# After creating the endpoint, wait for the model deployment to complete before using it.
29+
# To verify the deployment status, use the get trained model statistics API.
30+
# Look for +"state": "fully_allocated"+ in the response and ensure that the +"allocation_count"+ matches the +"target_allocation_count"+.
31+
# Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.
32+
#
33+
# @option arguments [String] :task_type The type of the inference task that the model will perform. (*Required*)
34+
# @option arguments [String] :alibabacloud_inference_id The unique identifier of the inference endpoint. (*Required*)
35+
# @option arguments [Hash] :headers Custom HTTP headers
36+
# @option arguments [Hash] :body request body
37+
#
38+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-alibabacloud
39+
#
40+
def put_alibabacloud(arguments = {})
41+
request_opts = { endpoint: arguments[:endpoint] || 'inference.put_alibabacloud' }
42+
43+
defined_params = [:task_type, :alibabacloud_inference_id].each_with_object({}) do |variable, set_variables|
44+
set_variables[variable] = arguments[variable] if arguments.key?(variable)
45+
end
46+
request_opts[:defined_params] = defined_params unless defined_params.empty?
47+
48+
raise ArgumentError, "Required argument 'task_type' missing" unless arguments[:task_type]
49+
50+
unless arguments[:alibabacloud_inference_id]
51+
raise ArgumentError,
52+
"Required argument 'alibabacloud_inference_id' missing"
53+
end
54+
55+
arguments = arguments.clone
56+
headers = arguments.delete(:headers) || {}
57+
58+
body = arguments.delete(:body)
59+
60+
_task_type = arguments.delete(:task_type)
61+
62+
_alibabacloud_inference_id = arguments.delete(:alibabacloud_inference_id)
63+
64+
method = Elasticsearch::API::HTTP_PUT
65+
path = "_inference/#{Utils.listify(_task_type)}/#{Utils.listify(_alibabacloud_inference_id)}"
66+
params = {}
67+
68+
Elasticsearch::API::Response.new(
69+
perform_request(method, path, params, body, headers, request_opts)
70+
)
71+
end
72+
end
73+
end
74+
end
75+
end
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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 commit c34efd13258a01121b10a538e5b450b4e65c7bf3
19+
# @see https://github.com/elastic/elasticsearch-specification
20+
#
21+
module Elasticsearch
22+
module API
23+
module Inference
24+
module Actions
25+
# Create an Amazon Bedrock inference endpoint.
26+
# Creates an inference endpoint to perform an inference task with the +amazonbedrock+ service.
27+
#
28+
# @option arguments [String] :task_type The type of the inference task that the model will perform. (*Required*)
29+
# @option arguments [String] :amazonbedrock_inference_id The unique identifier of the inference endpoint. (*Required*)
30+
# @option arguments [Hash] :headers Custom HTTP headers
31+
# @option arguments [Hash] :body request body
32+
#
33+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-amazonbedrock
34+
#
35+
def put_amazonbedrock(arguments = {})
36+
request_opts = { endpoint: arguments[:endpoint] || 'inference.put_amazonbedrock' }
37+
38+
defined_params = [:task_type, :amazonbedrock_inference_id].each_with_object({}) do |variable, set_variables|
39+
set_variables[variable] = arguments[variable] if arguments.key?(variable)
40+
end
41+
request_opts[:defined_params] = defined_params unless defined_params.empty?
42+
43+
raise ArgumentError, "Required argument 'task_type' missing" unless arguments[:task_type]
44+
45+
unless arguments[:amazonbedrock_inference_id]
46+
raise ArgumentError,
47+
"Required argument 'amazonbedrock_inference_id' missing"
48+
end
49+
50+
arguments = arguments.clone
51+
headers = arguments.delete(:headers) || {}
52+
53+
body = arguments.delete(:body)
54+
55+
_task_type = arguments.delete(:task_type)
56+
57+
_amazonbedrock_inference_id = arguments.delete(:amazonbedrock_inference_id)
58+
59+
method = Elasticsearch::API::HTTP_PUT
60+
path = "_inference/#{Utils.listify(_task_type)}/#{Utils.listify(_amazonbedrock_inference_id)}"
61+
params = {}
62+
63+
Elasticsearch::API::Response.new(
64+
perform_request(method, path, params, body, headers, request_opts)
65+
)
66+
end
67+
end
68+
end
69+
end
70+
end

0 commit comments

Comments
 (0)