The protocol a host stores responses with (prompt.md, section 7): the
program wrapped in ]]>openui:content, ]]>openui:context and
]]>openui:end marker lines. The model never writes or sees these lines.
raw = OpenUI.Message.build(content: program, context: [state], end: true)
%OpenUI.Message{content: program} = OpenUI.Message.parse(raw)When a response was regenerated, the last content wins.
Summary
Functions
Writes a stored message. context is written as is when it is a string,
else as JSON, and is left out when nil. attributes are key-value pairs,
such as [{"library", "support@1.2.0"}].
The stored turn for an action that continues the conversation, in the
reference format: the message, and as context
["User clicked: <message>", formState, context] (the context only when
the action has one).
What the model reads of a stored message, with every marker line removed:
the program for an assistant turn; for a user turn, the message and, when
there is a context, context and form values = <its JSON>.
Reads a stored message. With streaming: true, a last line that may be a
marker cut mid-stream is held back.
Types
Functions
Writes a stored message. context is written as is when it is a string,
else as JSON, and is left out when nil. attributes are key-value pairs,
such as [{"library", "support@1.2.0"}].
@spec from_event(OpenUI.Event.t()) :: String.t()
The stored turn for an action that continues the conversation, in the
reference format: the message, and as context
["User clicked: <message>", formState, context] (the context only when
the action has one).
What the model reads of a stored message, with every marker line removed:
the program for an assistant turn; for a user turn, the message and, when
there is a context, context and form values = <its JSON>.
Reads a stored message. With streaming: true, a last line that may be a
marker cut mid-stream is held back.