You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: inference.rb
    path of file: ./repos/elasticsearch-ruby/elasticsearch-api/lib/elasticsearch/api/actions/inference
    
    the code of the file until where you have to start completion: # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
#
    
        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