Sha256: f9311af07dc434b19ec8008a444f2cc7251523219ca338ca65869e169c12bde1

Contents?: true

Size: 935 Bytes

Versions: 3

Compression:

Stored size: 935 Bytes

Contents

# frozen_string_literal: true

require_relative "ai21/version"
require_relative "ai21/helper"
require_relative "ai21/http"
require_relative "ai21/client"
require_relative "ai21/dataset"
require_relative "ai21/custom_model"

module AI21
  class Error < StandardError; end

  class ConfigurationError < Error; end

  class Configuration
    attr_writer :access_token
    attr_accessor :api_version, :uri_base

    def initialize
      @access_token = nil
      @uri_base = "https://api.ai21.com/studio/"
      @api_version = "v1"
    end

    def access_token
      return @access_token if @access_token

      error_text = "AI21 access token is missing. Visit https://studio.ai21.com/account"
      raise ConfigurationError, error_text
    end
  end

  class << self
    attr_writer :configuration

    def configuration
      @configuration ||= Configuration.new
    end

    def configure
      yield(configuration)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ai21-0.2.1 lib/ai21.rb
ai21-0.2.0 lib/ai21.rb
ai21-0.1.0 lib/ai21.rb