ChatMessage
One message in a conversation with a model: who wrote it and what it says, sent {"role": "user", "content": "..."}.
AI; not ordered; since Jadpo 0.1.0.
Make one
Build one from its fields, ChatMessage { role: ... content: ... }.
Fields
| Field | Type |
|---|---|
role |
ChatRole |
content |
Text |
Text, JSON and storage
It has no single text form, so text.from and text.parse don't take it. JSON sends an object of its parts.
| JSON |
|---|
{"role":"system","content":"Answer in British English."} |
{"role":"user","content":"Summarise this page.\nThanks"} |
{"role":"assistant","content":""} |
It is stored in 2 columns, each named for the field, _ and its suffix. This is {"role":"user","content":"Summarise this page.\nThanks"}:
| Column | Type | Holds |
|---|---|---|
<field>_role |
text |
'user' |
<field>_content |
text |
E'Summarise this page.\nThanks' |
Shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
{"role":"system","content":"Answer in British English."} |
system: Answer in British English. |
{"role":"user","content":"Summarise this page.\nThanks"} |
"user: Summarise this page.\nThanks" |
{"role":"assistant","content":""} |
assistant: |
Operations
It has the contract's own operations: text.format, json.read, json.write and ==. It isn't ordered, so < and sorting don't take it. Every standard type meets one contract says how they work.
Markdown for agents: /docs/types/type-chat-message.md.Built from Jadpo main at e00e61f.