View Source Replicate.Models (Replicate v0.7.0)

Documentation for Models.

Link to this section Summary

Functions

Gets a model from a owner/name string. Returns {:error, "Not found"} if the model doesn't exist.

Gets a model from a owner/name string. Raises an error if the model doesn't exist.

Gets the latest version of a model. Raises an error if the version doesn't exist.

Gets a version of a model. Raises an error if the version doesn't exist.

Returns a list of all versions for a model.

Link to this section Functions

Gets a model from a owner/name string. Returns {:error, "Not found"} if the model doesn't exist.

examples

Examples

iex> {:ok, %Model{owner: owner, name: name}} = Replicate.Models.get("replicate/hello-world")
iex> owner
"replicate"
iex> name
"hello-world"

Gets a model from a owner/name string. Raises an error if the model doesn't exist.

examples

Examples

iex> %Model{owner: owner, name: name} = Replicate.Models.get!("replicate/hello-world")
iex> owner
"replicate"
iex> name
"hello-world"
Link to this function

get_latest_version!(model)

View Source

Gets the latest version of a model. Raises an error if the version doesn't exist.

examples

Examples

iex> model = Replicate.Models.get!("replicate/hello-world")
iex> version = Replicate.Models.get_latest_version!(model)
iex> version.id
"v2"
Link to this function

get_version!(model, version)

View Source

Gets a version of a model. Raises an error if the version doesn't exist.

examples

Examples

iex> model = Replicate.Models.get!("replicate/hello-world")
iex> version = Replicate.Models.get_version!(model, "v2")
iex> version.id
"v2"

Returns a list of all versions for a model.

examples

Examples

iex> model = Replicate.Models.get!("replicate/hello-world")
iex> versions = Replicate.Models.list_versions(model)
iex> %Replicate.Models.Version{id: id, cog_version: cog_version} = List.first(versions)
iex> id
"v1"
iex> cog_version
"0.3.0"