Baton.Flow.PromptResolver behaviour (Baton v0.27.4)

Copy Markdown View Source

Host contract for resolving and rendering a portable prompt specification.

A resolver returns the rendered text, or a list of content parts where the host's wire wants structure the text cannot carry — an Anthropic cache_control breakpoint, say. Baton.Flow.RequestAssembly passes either through untouched; the parts are the host's own vocabulary, never baton's.

Summary

Types

resolved_prompt()

@type resolved_prompt() :: %{
  :body => String.t() | [term()],
  optional(:provenance) => map()
}

Callbacks

resolve(prompt_spec, assigns, runtime)

@callback resolve(prompt_spec :: map(), assigns :: map(), runtime :: map()) ::
  {:ok, resolved_prompt()} | {:error, term()}