Sha256: e487a4d169143c6a125d0bca52fc10ac738f14345530bb0076b66753a4659fd5

Contents?: true

Size: 588 Bytes

Versions: 1

Compression:

Stored size: 588 Bytes

Contents

module HuggingFace
  class EndpointsApi < BaseApi

    def request(endpoint_url:, input:, params: nil)
      retries = 0

      endpoint_connection = build_connection endpoint_url

      begin
        return super(connection: endpoint_connection, input: { inputs: input }, params: params )
      rescue ServiceUnavailable => exception

        if retries < MAX_RETRY
          logger.debug('Service unavailable, retrying...')
          retries += 1
          sleep 5
          retry
        else
          raise exception
        end
      end
    end  
        

    private


  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hugging-face-0.3.5 lib/hugging_face/endpoints_api.rb