Class: BddOpenai::Services::Files::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/bdd_openai/services/files/base.rb

Direct Known Subclasses

Delete, List, Retrieve, Upload

Instance Method Summary collapse

Constructor Details

#initialize(api_key = '') ⇒ Base

Returns a new instance of Base.

Parameters:

  • api_key (String) (defaults to: '')

    The key of the OpenAI API



8
9
10
11
12
# File 'lib/bdd_openai/services/files/base.rb', line 8

def initialize(api_key = '')
  @http_client = BddOpenai::Client::HttpClient.new
  @openai_api_domain = 'https://api.openai.com/v1'
  @openai_api_key = api_key
end

Instance Method Details

#default_headersObject



14
15
16
17
18
19
# File 'lib/bdd_openai/services/files/base.rb', line 14

def default_headers
  {
    "Authorization": "Bearer #{@openai_api_key}",
    "Content-Type": 'application/json'
  }
end