user
Adds a user message to the prompt with optional media attachments.
User messages represent input from the user to the language model. This method supports adding text content along with a list of media attachments such as images, audio, or documents.
Parameters
The content of the user message.
The list of media attachments associated with the user message. Defaults to an empty list if no attachments are provided.
Adds a user message to the prompt with media attachments.
User messages represent input from the user to the language model. This method allows attaching media content like images, audio, or documents.
Example:
// Simple text message
user("What is the capital of France?")
// Message with attachments using a lambda
user("Please analyze this image") {
image("photo.jpg")
}
Parameters
The content of the user message
Optional lambda to configure attachments using AttachmentBuilder
Adds a user message to the prompt using a ContentBuilderWithAttachment.
This allows for more complex message construction with both text and attachments.
Example:
user {
text("I have a question about programming.")
text("How do I implement a binary search in Kotlin?")
attachments {
image("screenshot.png")
}
}
Parameters
The initialization block for the ContentBuilderWithAttachment