View Source OpenAI.Images (OpenAI API Wrapper v0.1.3)
Provides the ability to interact with the OpenAI imagess API.
See the OpenAI imagess API documentation here.
Link to this section Summary
Types
Images dimensions accepted by the images API.
The parameters allowed for edit/3
.
The parameters allowed for generate/2
.
The format in which generated images are returned.
The parameters allowed for variation/2
.
Functions
Create an edited or extended image given an original image and a prompt. Maximum prompt lengh is 1000 characters.
Generate an image given a prompt. Maximum prompt length is 1000 characters.
Creates a variation of a given image.
Link to this section Types
@type dimensions() :: :"256x256" | :"512x512" | :"1024x1024" | binary()
Images dimensions accepted by the images API.
OpenAI API accepts:
256x256
512x512
1024x1024
@type edit_params() :: {:mask, binary()} | {:n, integer()} | {:size, dimensions()} | {:response_format, response_format()} | {:user, binary()}
The parameters allowed for edit/3
.
We make no effort to assign defaults, and so if params are left blank they will be set to whatever the OpenAI API defaults are by the server. Consult with the OpenAI documentation for more details.
The parameters are mapped 1:1 with those that OpenAI offers and so we do not explain them in detail here.
@type generate_params() :: {:n, integer()} | {:size, dimensions()} | {:response_format, response_format()} | {:user, binary()}
The parameters allowed for generate/2
.
We make no effort to assign defaults, and so if params are left blank they will be set to whatever the OpenAI API defaults are by the server. Consult with the OpenAI documentation for more details.
The parameters are mapped 1:1 with those that OpenAI offers and so we do not explain them in detail here.
@type response_format() :: :url | :b64_json
The format in which generated images are returned.
@type variation_params() :: {:n, integer()} | {:size, dimensions()} | {:response_format, response_format()} | {:user, binary()}
The parameters allowed for variation/2
.
We make no effort to assign defaults, and so if params are left blank they will be set to whatever the OpenAI API defaults are by the server. Consult with the OpenAI documentation for more details.
The parameters are mapped 1:1 with those that OpenAI offers and so we do not explain them in detail here.
Link to this section Functions
@spec edit(binary(), binary(), [edit_params()]) :: {:ok, map()} | {:error, OpenAI.Error.t()}
Create an edited or extended image given an original image and a prompt. Maximum prompt lengh is 1000 characters.
@spec generate(binary(), [generate_params()]) :: {:ok, map()} | {:error, OpenAI.Error.t()}
Generate an image given a prompt. Maximum prompt length is 1000 characters.
@spec variation(binary(), [variation_params()]) :: {:ok, map()}
Creates a variation of a given image.