Learn how to define messages in PromptL
Messages are the building blocks of PromptL prompts. They define the flow of conversations between the user, the assistant, and other entities like tools. Each message is associated with a role that determines its purpose in the conversation.
PromptL supports the following message roles:
System messages provide high-level instructions and context for the assistant.
User messages simulate user input in the conversation.
Assistant messages represent LLM responses or “fake” previous outputs to guide the conversation.
Tool messages represent the output of external tools or APIs called by the assistant during the conversation. They require a unique id
attribute to match the tool call.
<message>
TagMessages can be defined using the <message>
tag with a role
attribute:
For convenience, you can use specific tags for each role:
<system>
: Equivalent to <message role="system">
.<user>
: Equivalent to <message role="user">
.<assistant>
: Equivalent to <message role="assistant">
.<tool>
: Equivalent to <message role="tool">
.Messages can contain different types of content. By default, all plain text is considered text
content, but you can specify other types using the <content>
tag or its shorthand equivalents.
<content type="text">
or <content-text>
.<content type="image">
or <content-image>
. Add the image URL or base64-encoded string – depending on your provider’s requirements – as the content inside the tag.<content type="file">
or <content-file>
. Add the file URL or base64-encoded string – depending on your provider’s requirements – as the content inside the tag. Requires a MIME type mime
attribute to specify the file type.<content type="tool-call">
or <tool-call>
. Represents a tool invocation with attributes like id
, name
, and arguments
(optional). Only allowed inside assistant messages.Not all providers and all models will support all content types. Your provider may support files but not all types of files. Check your provider’s documentation for compatibility.
Here’s how multiple message roles and content types can work together: