Developers

Message content

Preserve text, files, and provider metadata when processing chat message parts.

Chat messages contain an ordered list of parts. A part's type identifies its content. Keep the order and preserve providerMetadata when storing or replaying messages: providers can use that metadata to continue a conversation.

Files and reasoning

  • file is an output attachment with a mediaType and url.
  • reasoning-file has the same mediaType and url fields, but belongs to the model's reasoning. Keep it separate from output attachments.
  • custom carries provider-specific content. Its kind uses a qualified name such as openai.compaction. Preserve the part and its providerMetadata even when your client has no display component for it.

A file URL may be an HTTPS address or a data URL. Do not treat an HTTPS address as base64 data. Reasoning visibility is separate from output attachment visibility: hiding reasoning should also hide its reasoning files.

Existing text, tool, and output-file parts retain their meanings. Clients that only render selected part types should preserve the other parts when saving or replaying a message.