View Source LangChain.Images.GeneratedImage (LangChain v0.3.0-rc.0)

Represents a generated image where we have either the base64 encoded contents or a temporary URL to it.

Example

Created when an image generation request completes and we have an image.

GeneratedImage.new!(%{
  image_type: :png,
  type: :url,
  content: "https://example.com/my_image.png",
  prompt: "The prompt used for image generation"
})

Summary

Functions

Build a new GeneratedImage and return an :ok/:error tuple with the result.

Build a new GeneratedImage and return it or raise an error if invalid.

Types

@type t() :: %LangChain.Images.GeneratedImage{
  content: term(),
  created_at: term(),
  image_type: term(),
  metadata: term(),
  prompt: term(),
  type: term()
}

Functions

@spec new(attrs :: map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}

Build a new GeneratedImage and return an :ok/:error tuple with the result.

@spec new!(attrs :: map()) :: t() | no_return()

Build a new GeneratedImage and return it or raise an error if invalid.