Normalized inbound user turn.
Host applications can pass strings, atom-key maps, or string-key maps at the public boundary. Spectre immediately converts them into this struct so router checks, prompt rendering, and action execution do not depend on external payload shapes.
input = Spectre.Input.new(%{"text" => "Hello", "meta" => %{"locale" => "en"}})
input = Spectre.Input.put_meta(input, :channel, :web)
Summary
Functions
Fetches enriched metadata.
Merges enriched metadata onto the input.
Normalizes raw inbound input into a Spectre input struct.
Stores enriched metadata on the input.
Types
@type t() :: %Spectre.Input{ meta: map(), raw: term(), source: Spectre.Input.Source.t() | nil, text: String.t() }
Functions
Fetches enriched metadata.
{:ok, "en"} = Spectre.Input.fetch_meta(input, :locale)
Merges enriched metadata onto the input.
input = Spectre.Input.merge_meta(input, locale: "en", channel: :web)
Normalizes raw inbound input into a Spectre input struct.
Spectre.Input.new("hello")
Spectre.Input.new(%{text: "hello", meta: %{tenant_id: 123}})
Stores enriched metadata on the input.
input = Spectre.Input.put_meta(input, :locale, "en")