The contract for a typed Tune program.
A program is either a Tune.Predictor or a struct whose module implements
this behaviour. Composition stays in ordinary Elixir functions.
Summary
Functions
Returns the program's declared parameters.
Replaces named parameters and returns the updated program.
Returns true when two signatures have the same field names and schemas.
Returns the program's signature.
Types
@type parameters() :: %{ required(String.t()) => Tune.Predictor.t() | Tune.Parameter.t() }
@type t() :: Tune.Predictor.t() | struct()
Callbacks
@callback call(program :: struct(), inputs :: map(), Tune.Execution.t()) :: {:ok, map(), Tune.Execution.t()} | {:error, term(), Tune.Execution.t()}
@callback parameters(program :: struct()) :: parameters()
@callback put_parameters(program :: struct(), parameters()) :: struct()
@callback signature(program :: struct()) :: Tune.Signature.t()
Functions
@spec parameters(t()) :: {:ok, parameters()} | {:error, Exception.t()}
Returns the program's declared parameters.
@spec replace_parameters(t(), parameters()) :: {:ok, t()} | {:error, Exception.t()}
Replaces named parameters and returns the updated program.
Every name must exist. Each replacement must keep its kind and schema.
@spec same_fields?(Tune.Signature.t(), Tune.Signature.t()) :: boolean()
Returns true when two signatures have the same field names and schemas.
@spec signature(t()) :: {:ok, Tune.Signature.t()} | {:error, Exception.t()}
Returns the program's signature.