lib/gen_ai/image/open_ai.rb in gen-ai-0.2.2 vs lib/gen_ai/image/open_ai.rb in gen-ai-0.2.3
- old
+ new
@@ -2,10 +2,11 @@
module GenAI
class Image
class OpenAI < Base
DEFAULT_SIZE = '256x256'
+ DEFAULT_MODEL = 'dall-e-3'
RESPONSE_FORMAT = 'b64_json'
def initialize(token:, options: {})
depends_on 'ruby-openai'
@@ -17,11 +18,11 @@
response = handle_errors { @client.images.generate(parameters: parameters) }
build_result(
raw: response,
- model: 'dall-e',
+ model: parameters[:model],
parsed: response['data'].map { |datum| datum[RESPONSE_FORMAT] }
)
end
def variations(image, options = {})
@@ -52,9 +53,10 @@
def build_generation_options(prompt, options)
{
prompt: prompt,
size: options.delete(:size) || DEFAULT_SIZE,
+ model: options.delete(:model) || DEFAULT_MODEL,
response_format: options.delete(:response_format) || RESPONSE_FORMAT
}.merge(options)
end
def build_variations_options(image, options)