Skip to content

Auto-generated code for main #2600

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,28 @@
# specific language governing permissions and limitations
# under the License.
#
# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80
# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec
# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80
# @see https://github.com/elastic/elasticsearch-specification
#
module Elasticsearch
module API
module Inference
module Actions
# Perform inference
# Perform chat completion inference
#
# @option arguments [String] :inference_id The inference Id
# @option arguments [String] :task_type The task type
# @option arguments [String] :inference_id The inference Id (*Required*)
# @option arguments [Time] :timeout Specifies the amount of time to wait for the inference request to complete. Server default: 30s.
# @option arguments [Hash] :headers Custom HTTP headers
# @option arguments [Hash] :body The inference payload
# @option arguments [Hash] :body request body
#
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/post-inference-api.html
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-unified-inference
#
def inference(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || 'inference.inference' }
def chat_completion_unified(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || 'inference.chat_completion_unified' }

defined_params = %i[inference_id task_type].each_with_object({}) do |variable, set_variables|
defined_params = [:inference_id].inject({}) do |set_variables, variable|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand All @@ -48,15 +49,9 @@ def inference(arguments = {})

_inference_id = arguments.delete(:inference_id)

_task_type = arguments.delete(:task_type)

method = Elasticsearch::API::HTTP_POST
path = if _task_type && _inference_id
"_inference/#{Utils.__listify(_task_type)}/#{Utils.__listify(_inference_id)}"
else
"_inference/#{Utils.__listify(_inference_id)}"
end
params = {}
path = "_inference/chat_completion/#{Utils.__listify(_inference_id)}/_stream"
params = Utils.process_params(arguments)

Elasticsearch::API::Response.new(
perform_request(method, path, params, body, headers, request_opts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,28 @@
# specific language governing permissions and limitations
# under the License.
#
# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80
# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec
# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80
# @see https://github.com/elastic/elasticsearch-specification
#
module Elasticsearch
module API
module Inference
module Actions
# Perform streaming inference
# Perform completion inference on the service
#
# @option arguments [String] :inference_id The inference Id
# @option arguments [String] :task_type The task type
# @option arguments [String] :inference_id The inference Id (*Required*)
# @option arguments [Time] :timeout Specifies the amount of time to wait for the inference request to complete. Server default: 30s.
# @option arguments [Hash] :headers Custom HTTP headers
# @option arguments [Hash] :body The inference payload
# @option arguments [Hash] :body request body
#
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/post-stream-inference-api.html
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-inference
#
def stream_inference(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || 'inference.stream_inference' }
def completion(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || 'inference.completion' }

defined_params = %i[inference_id task_type].each_with_object({}) do |variable, set_variables|
defined_params = [:inference_id].inject({}) do |set_variables, variable|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand All @@ -48,15 +49,9 @@ def stream_inference(arguments = {})

_inference_id = arguments.delete(:inference_id)

_task_type = arguments.delete(:task_type)

method = Elasticsearch::API::HTTP_POST
path = if _task_type && _inference_id
"_inference/#{Utils.__listify(_task_type)}/#{Utils.__listify(_inference_id)}/_stream"
else
"_inference/#{Utils.__listify(_inference_id)}/_stream"
end
params = {}
path = "_inference/completion/#{Utils.__listify(_inference_id)}"
params = Utils.process_params(arguments)

Elasticsearch::API::Response.new(
perform_request(method, path, params, body, headers, request_opts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,29 @@
# specific language governing permissions and limitations
# under the License.
#
# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80
# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec
# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80
# @see https://github.com/elastic/elasticsearch-specification
#
module Elasticsearch
module API
module Inference
module Actions
# Delete an inference endpoint
#
# @option arguments [String] :inference_id The inference Id
# @option arguments [String] :task_type The task type
# @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.
# @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).
# @option arguments [String] :inference_id The inference identifier. (*Required*)
# @option arguments [Boolean] :dry_run When true, the endpoint is not deleted and a list of ingest processors which reference this endpoint is returned.
# @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.
# @option arguments [Hash] :headers Custom HTTP headers
#
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-inference-api.html
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-delete
#
def delete(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || 'inference.delete' }

defined_params = %i[inference_id task_type].each_with_object({}) do |variable, set_variables|
defined_params = [:inference_id, :task_type].inject({}) do |set_variables, variable|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand All @@ -47,10 +48,10 @@ def delete(arguments = {})

body = nil

_inference_id = arguments.delete(:inference_id)

_task_type = arguments.delete(:task_type)

_inference_id = arguments.delete(:inference_id)

method = Elasticsearch::API::HTTP_DELETE
path = if _task_type && _inference_id
"_inference/#{Utils.__listify(_task_type)}/#{Utils.__listify(_inference_id)}"
Expand Down
17 changes: 9 additions & 8 deletions elasticsearch-api/lib/elasticsearch/api/actions/inference/get.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,27 @@
# specific language governing permissions and limitations
# under the License.
#
# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80
# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec
# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80
# @see https://github.com/elastic/elasticsearch-specification
#
module Elasticsearch
module API
module Inference
module Actions
# Get an inference endpoint
#
# @option arguments [String] :inference_id The inference Id
# @option arguments [String] :task_type The task type
# @option arguments [String] :inference_id The inference Id
# @option arguments [Hash] :headers Custom HTTP headers
#
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-inference-api.html
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-get
#
def get(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || 'inference.get' }

defined_params = %i[inference_id task_type].each_with_object({}) do |variable, set_variables|
defined_params = [:inference_id, :task_type].inject({}) do |set_variables, variable|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

Expand All @@ -43,17 +44,17 @@ def get(arguments = {})

body = nil

_inference_id = arguments.delete(:inference_id)

_task_type = arguments.delete(:task_type)

_inference_id = arguments.delete(:inference_id)

method = Elasticsearch::API::HTTP_GET
path = if _task_type && _inference_id
"_inference/#{Utils.__listify(_task_type)}/#{Utils.__listify(_inference_id)}"
elsif _inference_id
"_inference/#{Utils.__listify(_inference_id)}"
else
'_inference'
"_inference"
end
params = {}

Expand Down
28 changes: 19 additions & 9 deletions elasticsearch-api/lib/elasticsearch/api/actions/inference/put.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,51 @@
# specific language governing permissions and limitations
# under the License.
#
# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80
# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec
# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80
# @see https://github.com/elastic/elasticsearch-specification
#
module Elasticsearch
module API
module Inference
module Actions
# Configure an inference endpoint for use in the Inference API
# Create an inference endpoint.
# When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running.
# After creating the endpoint, wait for the model deployment to complete before using it.
# To verify the deployment status, use the get trained model statistics API.
# Look for +"state": "fully_allocated"+ in the response and ensure that the +"allocation_count"+ matches the +"target_allocation_count"+.
# Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.
# 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.
# For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models.
# 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.
#
# @option arguments [String] :inference_id The inference Id
# @option arguments [String] :task_type The task type
# @option arguments [String] :inference_id The inference Id (*Required*)
# @option arguments [Hash] :headers Custom HTTP headers
# @option arguments [Hash] :body The inference endpoint's task and service settings
# @option arguments [Hash] :body inference_config
#
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/put-inference-api.html
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put
#
def put(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || 'inference.put' }

defined_params = %i[inference_id task_type].each_with_object({}) do |variable, set_variables|
defined_params = [:inference_id, :task_type].inject({}) do |set_variables, variable|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
raise ArgumentError, "Required argument 'inference_id' missing" unless arguments[:inference_id]

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

body = arguments.delete(:body)

_inference_id = arguments.delete(:inference_id)

_task_type = arguments.delete(:task_type)

_inference_id = arguments.delete(:inference_id)

method = Elasticsearch::API::HTTP_PUT
path = if _task_type && _inference_id
"_inference/#{Utils.__listify(_task_type)}/#{Utils.__listify(_inference_id)}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80
# @see https://github.com/elastic/elasticsearch-specification
#
module Elasticsearch
module API
module Inference
module Actions
# Create a Watsonx inference endpoint.
# Creates an inference endpoint to perform an inference task with the +watsonxai+ service.
# You need an IBM Cloud Databases for Elasticsearch deployment to use the +watsonxai+ inference service.
# You can provision one through the IBM catalog, the Cloud Databases CLI plug-in, the Cloud Databases API, or Terraform.
# When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running.
# After creating the endpoint, wait for the model deployment to complete before using it.
# To verify the deployment status, use the get trained model statistics API.
# Look for +"state": "fully_allocated"+ in the response and ensure that the +"allocation_count"+ matches the +"target_allocation_count"+.
# Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.
#
# @option arguments [String] :task_type The task type.
# The only valid task type for the model to perform is +text_embedding+. (*Required*)
# @option arguments [String] :watsonx_inference_id The unique identifier of the inference endpoint. (*Required*)
# @option arguments [Hash] :headers Custom HTTP headers
# @option arguments [Hash] :body request body
#
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-service-watsonx-ai.html
#
def put_watsonx(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || 'inference.put_watsonx' }

defined_params = [:task_type, :watsonx_inference_id].inject({}) do |set_variables, variable|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

raise ArgumentError, "Required argument 'task_type' missing" unless arguments[:task_type]

raise ArgumentError,
"Required argument 'watsonx_inference_id' missing" unless arguments[:watsonx_inference_id]

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

body = arguments.delete(:body)

_task_type = arguments.delete(:task_type)

_watsonx_inference_id = arguments.delete(:watsonx_inference_id)

method = Elasticsearch::API::HTTP_PUT
path = "_inference/#{Utils.__listify(_task_type)}/#{Utils.__listify(_watsonx_inference_id)}"
params = {}

Elasticsearch::API::Response.new(
perform_request(method, path, params, body, headers, request_opts)
)
end
end
end
end
end
Loading