Sake.Prompt behaviour (Sake v0.1.0)

Copy Markdown View Source

A prompt template: arg lines (strings only) and get/2, which returns messages as {:user | :assistant, text | %Sake.Content{}}.

Summary

Callbacks

complete(arg, partial, ctx)

(optional)
@callback complete(arg :: String.t(), partial :: String.t(), ctx :: Sake.Context.t()) ::
  {:ok, [String.t()]} | {:ok, [String.t()], keyword()}

get(args, ctx)

@callback get(args :: map(), ctx :: Sake.Context.t()) ::
  {:ok, [{atom(), term()}]}
  | {:ok, [{atom(), term()}], keyword()}
  | {:error, String.t()}

spec()

@callback spec() :: Sake.Prompt.Spec.t()

Functions

arg(name, type, opts \\ [])

(macro)