Class: Ticuna::BaseProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/ticuna/base_provider.rb

Direct Known Subclasses

Providers::OpenAI

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key:, base_url:) ⇒ BaseProvider

Returns a new instance of BaseProvider.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ticuna/base_provider.rb', line 8

def initialize(api_key:, base_url:)
  @api_key = api_key
  @base_url = base_url

  @connection = Faraday.new(
    url: base_url,
    headers: {
      "Content-Type" => "application/json",
      "Authorization" => "Bearer #{api_key}"
    }
  ) do |f|
    f.options.timeout = nil
    f.options.open_timeout = nil
  end
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



6
7
8
# File 'lib/ticuna/base_provider.rb', line 6

def api_key
  @api_key
end

#base_urlObject (readonly)

Returns the value of attribute base_url.



6
7
8
# File 'lib/ticuna/base_provider.rb', line 6

def base_url
  @base_url
end

#connectionObject (readonly)

Returns the value of attribute connection.



6
7
8
# File 'lib/ticuna/base_provider.rb', line 6

def connection
  @connection
end