org.llm4s.llmconnect.model.ContentPart
See theContentPart companion object
@Stable
sealed trait ContentPart extends Product, Serializable
One part of a user or tool message's content: text, an image, or a document.
Text is built directly. An image or a document is built with ContentPart.image or ContentPart.document, which check its source and return a Result:
- '''Inline bytes are bounded''' by ContentPart.MaxInlineBytes (5 MiB), also when a part is read from JSON. An agent thread's every checkpoint is a full snapshot of its state, so each retained checkpoint keeps a copy of every inline part - base64-encoded, a third larger - for as long as the message stays in the thread. Larger media belongs at a org.llm4s.media.MediaSource.Url or in a org.llm4s.media.MediaSource.ProviderFile, which a message holds by reference.
- '''A URL is absolute''', and not a
data:URL: that is inline bytes by another name, and would escape the bound. Use org.llm4s.media.MediaSource.Inline. - '''A provider file''' names a provider and an id, neither blank.
Each provider sends the parts its API takes and fails the request with an org.llm4s.error.UnsupportedContentPartError for any other; nothing is dropped or turned into text. Which provider takes which parts is listed in docs/guide/multimodal.md.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass Any
- Known subtypes
Members list
In this article