PromptVault.Message behaviour (PromptVault v0.1.0)

View Source

Behaviour for message types in PromptVault.

All message types must implement this behaviour to provide consistent access to role, raw content, rendered output, and template engine information.

Summary

Callbacks

Returns the raw content of the message.

Renders the message with the given assigns, returning iodata.

Returns the role of the message as an atom.

Returns the template engine used by this message, or nil if none.

Types

t()

@type t() :: term()

Callbacks

raw(t)

@callback raw(t()) :: any()

Returns the raw content of the message.

rendered(t, assigns)

@callback rendered(t(), assigns :: map()) :: iodata()

Renders the message with the given assigns, returning iodata.

role(t)

@callback role(t()) :: atom()

Returns the role of the message as an atom.

template_engine(t)

@callback template_engine(t()) :: atom() | nil

Returns the template engine used by this message, or nil if none.