ExOpenAI.Images (ex_openai.ex v0.2.0) View Source

Link to this section Summary

Functions

Endpoint /images/generations

Link to this section Types

Specs

create_image_opts() ::
  {:user, String.t()}
  | {:size, String.t()}
  | {:response_format, String.t()}
  | {:n, integer()}

Link to this section Functions

Link to this function

create_image(prompt, opts \\ [])

View Source

Specs

create_image(String.t(),
  user: String.t(),
  size: String.t(),
  response_format: String.t(),
  n: integer()
) :: {:ok, ExOpenAI.Components.ImagesResponse.t()} | {:error, any()}

Endpoint /images/generations

Creates an image given a prompt.


Required Arguments:

  • prompt: A text description of the desired image(s). The maximum length is 1000 characters.

Example: A cute baby sea otter

Optional Arguments:

  • n: The number of images to generate. Must be between 1 and 10.

Example: 1

  • response_format: The format in which the generated images are returned. Must be one of url or b64_json.

Example: "url"

  • size: The size of the generated images. Must be one of 256x256, 512x512, or 1024x1024.

Example: "1024x1024"

  • user: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.

Example: "user-1234"