The constructor you will type most often. It builds the shape that covers the overwhelming majority of user turns.
Reference#
func UserText(text string) Message
Returns
Message{Role: RoleUser, Parts: []Part{Text{Text: text}}}.
Caveats
- An empty string produces a valid message with one empty
Textpart — only a message with no parts at all is rejected. - For anything richer than one run of text, build the
Messagedirectly.
Usage#
A single turn
resp, err := client.Complete(ctx, &skyl.Request{
Model: "gpt-5.6",
MaxTokens: 512,
Messages: []skyl.Message{skyl.UserText("Explain Go channels.")},
})resp, err := client.Complete(ctx, &skyl.Request{
Model: "gpt-5.6",
MaxTokens: 512,
Messages: []skyl.Message{skyl.UserText("Explain Go channels.")},
})Growing a conversation
req.Messages = append(req.Messages, skyl.UserText(input))
resp, err := client.Complete(ctx, req)
if err != nil {
return err
}
req.Messages = append(req.Messages, resp.Message)req.Messages = append(req.Messages, skyl.UserText(input))
resp, err := client.Complete(ctx, req)
if err != nil {
return err
}
req.Messages = append(req.Messages, resp.Message)Troubleshooting#
I need an image alongside the text
Use UserImage, or build the message directly
with both parts in the order you want.