Skip to content

Commit f03262c

Browse files
committed
[API] Adds new inference PUT endpoints
1 parent 45b29d7 commit f03262c

34 files changed

+1867
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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 f284cc16f4d4b4289bc679aa1529bb504190fe80
19+
# @see https://github.com/elastic/elasticsearch-specification
20+
#
21+
module Elasticsearch
22+
module API
23+
module Inference
24+
module Actions
25+
# Perform a chat completion task through the Elastic Inference Service (EIS).
26+
# Perform a chat completion inference task with the +elastic+ service.
27+
#
28+
# @option arguments [String] :eis_inference_id The unique identifier of the inference endpoint. (*Required*)
29+
# @option arguments [Hash] :headers Custom HTTP headers
30+
# @option arguments [Hash] :body chat_completion_request
31+
#
32+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-post-eis-chat-completion
33+
#
34+
def post_eis_chat_completion(arguments = {})
35+
request_opts = { endpoint: arguments[:endpoint] || 'inference.post_eis_chat_completion' }
36+
37+
defined_params = [:eis_inference_id].each_with_object({}) do |variable, set_variables|
38+
set_variables[variable] = arguments[variable] if arguments.key?(variable)
39+
end
40+
request_opts[:defined_params] = defined_params unless defined_params.empty?
41+
42+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
43+
raise ArgumentError, "Required argument 'eis_inference_id' missing" unless arguments[:eis_inference_id]
44+
45+
arguments = arguments.clone
46+
headers = arguments.delete(:headers) || {}
47+
48+
body = arguments.delete(:body)
49+
50+
_eis_inference_id = arguments.delete(:eis_inference_id)
51+
52+
method = Elasticsearch::API::HTTP_POST
53+
path = "_inference/chat_completion/#{Utils.listify(_eis_inference_id)}/_stream"
54+
params = {}
55+
56+
Elasticsearch::API::Response.new(
57+
perform_request(method, path, params, body, headers, request_opts)
58+
)
59+
end
60+
end
61+
end
62+
end
63+
end
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 f284cc16f4d4b4289bc679aa1529bb504190fe80
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
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 f284cc16f4d4b4289bc679aa1529bb504190fe80
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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 f284cc16f4d4b4289bc679aa1529bb504190fe80
19+
# @see https://github.com/elastic/elasticsearch-specification
20+
#
21+
module Elasticsearch
22+
module API
23+
module Inference
24+
module Actions
25+
# Create an Anthropic inference endpoint.
26+
# Create an inference endpoint to perform an inference task with the +anthropic+ 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 task type.
34+
# The only valid task type for the model to perform is +completion+. (*Required*)
35+
# @option arguments [String] :anthropic_inference_id The unique identifier of the inference endpoint. (*Required*)
36+
# @option arguments [Hash] :headers Custom HTTP headers
37+
# @option arguments [Hash] :body request body
38+
#
39+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-anthropic
40+
#
41+
def put_anthropic(arguments = {})
42+
request_opts = { endpoint: arguments[:endpoint] || 'inference.put_anthropic' }
43+
44+
defined_params = [:task_type, :anthropic_inference_id].each_with_object({}) do |variable, set_variables|
45+
set_variables[variable] = arguments[variable] if arguments.key?(variable)
46+
end
47+
request_opts[:defined_params] = defined_params unless defined_params.empty?
48+
49+
raise ArgumentError, "Required argument 'task_type' missing" unless arguments[:task_type]
50+
51+
unless arguments[:anthropic_inference_id]
52+
raise ArgumentError,
53+
"Required argument 'anthropic_inference_id' missing"
54+
end
55+
56+
arguments = arguments.clone
57+
headers = arguments.delete(:headers) || {}
58+
59+
body = arguments.delete(:body)
60+
61+
_task_type = arguments.delete(:task_type)
62+
63+
_anthropic_inference_id = arguments.delete(:anthropic_inference_id)
64+
65+
method = Elasticsearch::API::HTTP_PUT
66+
path = "_inference/#{Utils.listify(_task_type)}/#{Utils.listify(_anthropic_inference_id)}"
67+
params = {}
68+
69+
Elasticsearch::API::Response.new(
70+
perform_request(method, path, params, body, headers, request_opts)
71+
)
72+
end
73+
end
74+
end
75+
end
76+
end
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 f284cc16f4d4b4289bc679aa1529bb504190fe80
19+
# @see https://github.com/elastic/elasticsearch-specification
20+
#
21+
module Elasticsearch
22+
module API
23+
module Inference
24+
module Actions
25+
# Create an Azure AI studio inference endpoint.
26+
# Create an inference endpoint to perform an inference task with the +azureaistudio+ 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] :azureaistudio_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-azureaistudio
39+
#
40+
def put_azureaistudio(arguments = {})
41+
request_opts = { endpoint: arguments[:endpoint] || 'inference.put_azureaistudio' }
42+
43+
defined_params = [:task_type, :azureaistudio_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[:azureaistudio_inference_id]
51+
raise ArgumentError,
52+
"Required argument 'azureaistudio_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+
_azureaistudio_inference_id = arguments.delete(:azureaistudio_inference_id)
63+
64+
method = Elasticsearch::API::HTTP_PUT
65+
path = "_inference/#{Utils.listify(_task_type)}/#{Utils.listify(_azureaistudio_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

0 commit comments

Comments
 (0)