Skip to main content

bamboo_domain/session/
message_part.rs

1//! Provider-neutral multimodal content part for messages.
2//!
3//! This type replaces the LLM-layer `ContentPart` in the domain to avoid
4//! polluting session types with provider-specific infrastructure details.
5//! The serde wire format is byte-for-byte identical to `ContentPart`.
6
7use serde::{Deserialize, Serialize};
8
9#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
10#[serde(tag = "type", rename_all = "snake_case")]
11pub enum MessagePart {
12    Text { text: String },
13    ImageUrl { image_url: ImageUrlRef },
14}
15
16#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
17pub struct ImageUrlRef {
18    pub url: String,
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub detail: Option<String>,
21}