Documentation / guides
UserMessage
Add a human-authored turn to an AgenticMessages thread.
UserMessage is a human-authored conversation turn. It embeds Message, so its role and ordered blocks are directly accessible.
API surface
type UserMessage struct{ Message }
The embedded value should normally use RoleUser:
message := &content.UserMessage{Message: content.Message{
Role: content.RoleUser,
Blocks: []content.Block{
&content.TextBlock{Text: "Summarize this."},
&content.DocumentBlock{
MediaType: content.MediaTypeDocumentText,
Name: "notes.txt", Text: "A short note.",
},
},
}}
Blocks may contain multimodal input when the selected model advertises the capability. UserMessage has no usage or tool-correlation fields; those belong to assistant and tool-result turns.
Proof
- Source:
core/content/message.go - Tests:
core/content/message_test.go,core/content/message_json_test.go - Example:
core/examples/content/example_test.go
Related: SystemMessage, Conversation input.