Class: OpenAI::Images

Inherits:
Object
  • Object
show all
Defined in:
lib/openai/images.rb

Instance Method Summary collapse

Constructor Details

#initialize(access_token: nil, organization_id: nil) ⇒ Images

Returns a new instance of Images.



3
4
5
6
# File 'lib/openai/images.rb', line 3

def initialize(access_token: nil, organization_id: nil)
  OpenAI.configuration.access_token = access_token if access_token
  OpenAI.configuration.organization_id = organization_id if organization_id
end

Instance Method Details

#edit(parameters: {}) ⇒ Object



12
13
14
# File 'lib/openai/images.rb', line 12

def edit(parameters: {})
  OpenAI::Client.multipart_post(path: "/images/edits", parameters: open_files(parameters))
end

#generate(parameters: {}) ⇒ Object



8
9
10
# File 'lib/openai/images.rb', line 8

def generate(parameters: {})
  OpenAI::Client.json_post(path: "/images/generations", parameters: parameters)
end

#variations(parameters: {}) ⇒ Object



16
17
18
# File 'lib/openai/images.rb', line 16

def variations(parameters: {})
  OpenAI::Client.multipart_post(path: "/images/variations", parameters: open_files(parameters))
end