pub enum ContentBlock {
Text(String),
Image(ImageContent),
Wire(Value),
}Expand description
A content block within a message.
The structured entry point of the content model: text and image blocks,
plus vendor-shaped pass-through blocks (Wire).
§Example
use molo::{ContentBlock, ImageContent, Message};
let msg = Message::user_blocks(vec![
ContentBlock::Text("What is in this picture?".into()),
ContentBlock::Image(ImageContent::new("image/png", vec![0x89, b'P', b'N', b'G'])),
]);
assert_eq!(msg, Message::user_blocks(vec![
ContentBlock::Text("What is in this picture?".into()),
ContentBlock::Image(ImageContent::new("image/png", vec![0x89, b'P', b'N', b'G'])),
]));Variants§
Text(String)
A text block.
Image(ImageContent)
An image block (raw bytes + MIME type). Provider implementations
encode it for the wire format (e.g. the OpenAI-compatible
image_url content block with a base64 data URL); Memory counts it
as no tokens and summarizers render it as a placeholder.
Wire(Value)
A vendor-shaped content block passed through verbatim (e.g. the
input_audio / file parts of OpenAI-compatible endpoints, whose
shapes vary per vendor and keep evolving).
For any modality without a typed variant, build the wire block yourself and wrap it here; the provider inserts it into the content array as-is. Whatever your endpoint accepts, this block can carry it.
Trait Implementations§
Source§impl Clone for ContentBlock
impl Clone for ContentBlock
Source§fn clone(&self) -> ContentBlock
fn clone(&self) -> ContentBlock
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more