Module: Elasticsearch::API::Inference::Actions

Included in:
InferenceClient
Defined in:
lib/elasticsearch/api/namespace/inference.rb,
lib/elasticsearch/api/actions/inference/get.rb,
lib/elasticsearch/api/actions/inference/put.rb,
lib/elasticsearch/api/actions/inference/delete.rb,
lib/elasticsearch/api/actions/inference/rerank.rb,
lib/elasticsearch/api/actions/inference/update.rb,
lib/elasticsearch/api/actions/inference/inference.rb,
lib/elasticsearch/api/actions/inference/put_elser.rb,
lib/elasticsearch/api/actions/inference/completion.rb,
lib/elasticsearch/api/actions/inference/put_cohere.rb,
lib/elasticsearch/api/actions/inference/put_custom.rb,
lib/elasticsearch/api/actions/inference/put_jinaai.rb,
lib/elasticsearch/api/actions/inference/put_openai.rb,
lib/elasticsearch/api/actions/inference/put_mistral.rb,
lib/elasticsearch/api/actions/inference/put_watsonx.rb,
lib/elasticsearch/api/actions/inference/put_deepseek.rb,
lib/elasticsearch/api/actions/inference/put_voyageai.rb,
lib/elasticsearch/api/actions/inference/put_anthropic.rb,
lib/elasticsearch/api/actions/inference/text_embedding.rb,
lib/elasticsearch/api/actions/inference/put_azureopenai.rb,
lib/elasticsearch/api/actions/inference/put_alibabacloud.rb,
lib/elasticsearch/api/actions/inference/put_hugging_face.rb,
lib/elasticsearch/api/actions/inference/sparse_embedding.rb,
lib/elasticsearch/api/actions/inference/put_amazonbedrock.rb,
lib/elasticsearch/api/actions/inference/put_azureaistudio.rb,
lib/elasticsearch/api/actions/inference/put_elasticsearch.rb,
lib/elasticsearch/api/actions/inference/stream_completion.rb,
lib/elasticsearch/api/actions/inference/put_googleaistudio.rb,
lib/elasticsearch/api/actions/inference/put_googlevertexai.rb,
lib/elasticsearch/api/actions/inference/put_amazonsagemaker.rb,
lib/elasticsearch/api/actions/inference/chat_completion_unified.rb

Instance Method Summary collapse

Instance Method Details

#chat_completion_unified(arguments = {}) ⇒ Object

Perform chat completion inference

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference payload

Raises:

  • (ArgumentError)

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/elasticsearch/api/actions/inference/chat_completion_unified.rb', line 33

def chat_completion_unified(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.chat_completion_unified' }

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

  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)

  method = Elasticsearch::API::HTTP_POST
  path   = "_inference/chat_completion/#{Utils.__listify(_inference_id)}/_stream"
  params = {}

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

#completion(arguments = {}) ⇒ Object

Perform completion inference

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference payload

Raises:

  • (ArgumentError)

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/elasticsearch/api/actions/inference/completion.rb', line 33

def completion(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.completion' }

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

  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)

  method = Elasticsearch::API::HTTP_POST
  path   = "_inference/completion/#{Utils.__listify(_inference_id)}"
  params = {}

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

#delete(arguments = {}) ⇒ Object

Delete an inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :inference_id (String)

    The inference Id

  • :task_type (String)

    The task type

  • :dry_run (Boolean)

    If true the endpoint will not be deleted and a list of ingest processors which reference this endpoint will be returned.

  • :force (Boolean)

    If true the endpoint will be forcefully stopped (regardless of whether or not it is referenced by any ingest processors or semantic text fields).

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/elasticsearch/api/actions/inference/delete.rb', line 35

def delete(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.delete' }

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

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

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

  body = nil

  _inference_id = arguments.delete(:inference_id)

  _task_type = arguments.delete(:task_type)

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

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

#get(arguments = {}) ⇒ Object

Get an inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :inference_id (String)

    The inference Id

  • :task_type (String)

    The task type

  • :headers (Hash)

    Custom HTTP headers

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/elasticsearch/api/actions/inference/get.rb', line 33

def get(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.get' }

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

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

  body = nil

  _inference_id = arguments.delete(:inference_id)

  _task_type = arguments.delete(:task_type)

  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'
           end
  params = {}

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

#inference(arguments = {}) ⇒ Object

Perform inference

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :inference_id (String)

    The inference Id

  • :task_type (String)

    The task type

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference payload

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/elasticsearch/api/actions/inference/inference.rb', line 34

def inference(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.inference' }

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

  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)

  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 = {}

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

#put(arguments = {}) ⇒ Object

Configure an inference endpoint for use in the Inference API

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :inference_id (String)

    The inference Id

  • :task_type (String)

    The task type

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/elasticsearch/api/actions/inference/put.rb', line 34

def put(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put' }

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

  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)

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

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

#put_alibabacloud(arguments = {}) ⇒ Object

Configure an AlibabaCloud AI Search inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :alibabacloud_inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/elasticsearch/api/actions/inference/put_alibabacloud.rb', line 34

def put_alibabacloud(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_alibabacloud' }

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

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

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

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _alibabacloud_inference_id = arguments.delete(:alibabacloud_inference_id)

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

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

#put_amazonbedrock(arguments = {}) ⇒ Object

Configure an Amazon Bedrock inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :amazonbedrock_inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/elasticsearch/api/actions/inference/put_amazonbedrock.rb', line 34

def put_amazonbedrock(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_amazonbedrock' }

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

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

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

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _amazonbedrock_inference_id = arguments.delete(:amazonbedrock_inference_id)

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

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

#put_amazonsagemaker(arguments = {}) ⇒ Object

Configure a Amazon SageMaker inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :amazonsagemaker_inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/elasticsearch/api/actions/inference/put_amazonsagemaker.rb', line 34

def put_amazonsagemaker(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_amazonsagemaker' }

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

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

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

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _amazonsagemaker_inference_id = arguments.delete(:amazonsagemaker_inference_id)

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

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

#put_anthropic(arguments = {}) ⇒ Object

Configure an Anthropic inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :anthropic_inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/elasticsearch/api/actions/inference/put_anthropic.rb', line 34

def put_anthropic(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_anthropic' }

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

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

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

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _anthropic_inference_id = arguments.delete(:anthropic_inference_id)

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

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

#put_azureaistudio(arguments = {}) ⇒ Object

Configure an Azure AI Studio inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :azureaistudio_inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/elasticsearch/api/actions/inference/put_azureaistudio.rb', line 34

def put_azureaistudio(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_azureaistudio' }

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

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

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

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _azureaistudio_inference_id = arguments.delete(:azureaistudio_inference_id)

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

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

#put_azureopenai(arguments = {}) ⇒ Object

Configure an Azure OpenAI inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :azureopenai_inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/elasticsearch/api/actions/inference/put_azureopenai.rb', line 34

def put_azureopenai(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_azureopenai' }

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

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

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

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _azureopenai_inference_id = arguments.delete(:azureopenai_inference_id)

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

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

#put_cohere(arguments = {}) ⇒ Object

Configure a Cohere inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :cohere_inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/elasticsearch/api/actions/inference/put_cohere.rb', line 34

def put_cohere(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_cohere' }

  defined_params = %i[task_type cohere_inference_id].each_with_object({}) do |variable, set_variables|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
  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 'cohere_inference_id' missing" unless arguments[:cohere_inference_id]

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _cohere_inference_id = arguments.delete(:cohere_inference_id)

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

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

#put_custom(arguments = {}) ⇒ Object

Configure a custom inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :custom_inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/elasticsearch/api/actions/inference/put_custom.rb', line 34

def put_custom(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_custom' }

  defined_params = %i[task_type custom_inference_id].each_with_object({}) do |variable, set_variables|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
  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 'custom_inference_id' missing" unless arguments[:custom_inference_id]

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _custom_inference_id = arguments.delete(:custom_inference_id)

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

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

#put_deepseek(arguments = {}) ⇒ Object

Configure a DeepSeek inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :deepseek_inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/elasticsearch/api/actions/inference/put_deepseek.rb', line 34

def put_deepseek(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_deepseek' }

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

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

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

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _deepseek_inference_id = arguments.delete(:deepseek_inference_id)

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

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

#put_elasticsearch(arguments = {}) ⇒ Object

Configure an Elasticsearch inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :elasticsearch_inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/elasticsearch/api/actions/inference/put_elasticsearch.rb', line 34

def put_elasticsearch(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_elasticsearch' }

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

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

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

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _elasticsearch_inference_id = arguments.delete(:elasticsearch_inference_id)

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

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

#put_elser(arguments = {}) ⇒ Object

Configure an ELSER inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :elser_inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/elasticsearch/api/actions/inference/put_elser.rb', line 34

def put_elser(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_elser' }

  defined_params = %i[task_type elser_inference_id].each_with_object({}) do |variable, set_variables|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
  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 'elser_inference_id' missing" unless arguments[:elser_inference_id]

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _elser_inference_id = arguments.delete(:elser_inference_id)

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

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

#put_googleaistudio(arguments = {}) ⇒ Object

Configure a Google AI Studio inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :googleaistudio_inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/elasticsearch/api/actions/inference/put_googleaistudio.rb', line 34

def put_googleaistudio(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_googleaistudio' }

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

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

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

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _googleaistudio_inference_id = arguments.delete(:googleaistudio_inference_id)

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

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

#put_googlevertexai(arguments = {}) ⇒ Object

Configure a Google Vertex AI inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :googlevertexai_inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/elasticsearch/api/actions/inference/put_googlevertexai.rb', line 34

def put_googlevertexai(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_googlevertexai' }

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

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

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

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _googlevertexai_inference_id = arguments.delete(:googlevertexai_inference_id)

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

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

#put_hugging_face(arguments = {}) ⇒ Object

Configure a HuggingFace inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :huggingface_inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/elasticsearch/api/actions/inference/put_hugging_face.rb', line 34

def put_hugging_face(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_hugging_face' }

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

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

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

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _huggingface_inference_id = arguments.delete(:huggingface_inference_id)

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

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

#put_jinaai(arguments = {}) ⇒ Object

Configure a JinaAI inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :jinaai_inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/elasticsearch/api/actions/inference/put_jinaai.rb', line 34

def put_jinaai(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_jinaai' }

  defined_params = %i[task_type jinaai_inference_id].each_with_object({}) do |variable, set_variables|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
  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 'jinaai_inference_id' missing" unless arguments[:jinaai_inference_id]

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _jinaai_inference_id = arguments.delete(:jinaai_inference_id)

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

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

#put_mistral(arguments = {}) ⇒ Object

Configure a Mistral inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :mistral_inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/elasticsearch/api/actions/inference/put_mistral.rb', line 34

def put_mistral(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_mistral' }

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

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

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

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _mistral_inference_id = arguments.delete(:mistral_inference_id)

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

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

#put_openai(arguments = {}) ⇒ Object

Configure an OpenAI inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :openai_inference_id (String)

    The inference ID

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/elasticsearch/api/actions/inference/put_openai.rb', line 34

def put_openai(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_openai' }

  defined_params = %i[task_type openai_inference_id].each_with_object({}) do |variable, set_variables|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
  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 'openai_inference_id' missing" unless arguments[:openai_inference_id]

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _openai_inference_id = arguments.delete(:openai_inference_id)

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

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

#put_voyageai(arguments = {}) ⇒ Object

Configure a VoyageAI inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :voyageai_inference_id (String)

    The inference ID

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/elasticsearch/api/actions/inference/put_voyageai.rb', line 34

def put_voyageai(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_voyageai' }

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

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

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

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

  body = arguments.delete(:body)

  _task_type = arguments.delete(:task_type)

  _voyageai_inference_id = arguments.delete(:voyageai_inference_id)

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

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

#put_watsonx(arguments = {}) ⇒ Object

Configure a Watsonx inference endpoint

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :task_type (String)

    The task type

  • :watsonx_inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/elasticsearch/api/actions/inference/put_watsonx.rb', line 34

def put_watsonx(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.put_watsonx' }

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

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

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

  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

#rerank(arguments = {}) ⇒ Object

Perform reranking inference

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference payload

Raises:

  • (ArgumentError)

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/elasticsearch/api/actions/inference/rerank.rb', line 33

def rerank(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.rerank' }

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

  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)

  method = Elasticsearch::API::HTTP_POST
  path   = "_inference/rerank/#{Utils.__listify(_inference_id)}"
  params = {}

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

#sparse_embedding(arguments = {}) ⇒ Object

Perform sparse embedding inference

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference payload

Raises:

  • (ArgumentError)

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/elasticsearch/api/actions/inference/sparse_embedding.rb', line 33

def sparse_embedding(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.sparse_embedding' }

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

  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)

  method = Elasticsearch::API::HTTP_POST
  path   = "_inference/sparse_embedding/#{Utils.__listify(_inference_id)}"
  params = {}

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

#stream_completion(arguments = {}) ⇒ Object

Perform streaming completion inference

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference payload

Raises:

  • (ArgumentError)

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/elasticsearch/api/actions/inference/stream_completion.rb', line 33

def stream_completion(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.stream_completion' }

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

  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)

  method = Elasticsearch::API::HTTP_POST
  path   = "_inference/completion/#{Utils.__listify(_inference_id)}/_stream"
  params = {}

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

#text_embedding(arguments = {}) ⇒ Object

Perform text embedding inference

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :inference_id (String)

    The inference Id

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference payload

Raises:

  • (ArgumentError)

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/elasticsearch/api/actions/inference/text_embedding.rb', line 33

def text_embedding(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.text_embedding' }

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

  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)

  method = Elasticsearch::API::HTTP_POST
  path   = "_inference/text_embedding/#{Utils.__listify(_inference_id)}"
  params = {}

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

#update(arguments = {}) ⇒ Object

Update inference

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :inference_id (String)

    The inference Id

  • :task_type (String)

    The task type

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The inference endpoint’s task and service settings

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/elasticsearch/api/actions/inference/update.rb', line 34

def update(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'inference.update' }

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

  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)

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

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