View Source OpenaiEx.Image (openai_ex v0.3.0)
This module provides an implementation of the OpenAI images API. The API reference can be found at https://platform.openai.com/docs/api-reference/images.
API Fields
The following fields can be used as parameters when creating a new image:
:prompt:n:response_format:size:user
Summary
Functions
Calls the image generation endpoint.
Calls the image edit endpoint.
Calls the image variation endpoint.
Creates a new image request with the given arguments.
Functions
Calls the image generation endpoint.
Arguments
openai: The OpenAI configuration to use.image: The image request to send.
Returns
A map containing the response from the OpenAI API.
See the OpenAI API Create Image reference for more information.
Calls the image edit endpoint.
Arguments
openai: The OpenAI configuration to use.image_edit: The image edit request to send.
Returns
A map containing the response from the OpenAI API.
See the OpenAI API Create Image Edit reference for more information.
Calls the image variation endpoint.
Arguments
openai: The OpenAI configuration to use.image_variation: The image variation request to send.
Returns
A map containing the response from the OpenAI API.
See the OpenAI API Create Image Variation reference for more information.
Creates a new image request with the given arguments.
Arguments
args: A list of key-value pairs, or a map, representing the fields of the image request.
Returns
A map containing the fields of the image request.
The :prompt field is required.
Example usage:
iex> _request = OpenaiEx.Image.new(prompt: "This is a test")
%{prompt: "This is a test"}
iex> _request = OpenaiEx.Image.new(%{prompt: "This is a test"})
%{prompt: "This is a test"}