UserMessage#

Choose message roles and distinguish model input from stored history. See the guide.

class zett_agent.messages.UserMessage(*, attributes=<factory>, persist=True, include_in_messages=True, content)[源代码]#

User text or ordered text/image blocks.

示例

Compose a multimodal request:

message = UserMessage(content=[
    TextContent("Describe this image."),
    ImageContent(ImageUrlSource("https://example.com/photo.png")),
])

备注

Image support depends on the selected model. The text property excludes image payloads; parts preserves their original order.

参见

TextContent, ImageContent, and ImageSource define supported content parts.

参数:
  • attributes (dict[str, Any])

  • persist (bool)

  • include_in_messages (bool)

  • content (UserContent)

property parts: list[UserContentPart]#

Expand the text shorthand into content blocks.

property text: str#

Extract text without including image payloads.