pub enum ContentPart {
Text {
text: String,
},
ImageUrl {
url: String,
detail: Option<ImageDetail>,
},
ImageBase64 {
media_type: String,
data: String,
},
AudioBase64 {
media_type: String,
data: String,
},
File {
file_id: String,
filename: Option<String>,
},
Document {
source: DocumentSource,
title: Option<String>,
cache_control: Option<CacheControl>,
},
RedactedThinking {
data: String,
},
ToolReference {
tool_name: String,
cache_control: Option<CacheControl>,
},
}Expand description
多模态内容片段
Variants§
Text
ImageUrl
ImageBase64
AudioBase64
音频输入(GPT-4o-audio、Gemini Audio 等多模态音频模型)
File
文件/文档引用 — 轻量引用,仅携带 file_id 文件上传/管理由独立 crate(如 xz-upload)负责,不混入 provider 层
Document
文档内容(内嵌 base64 或 URL 引用)
RedactedThinking
思考过程(已脱敏,仅含 token 计数等元信息)
ToolReference
工具引用(多工具场景下标识正在调用的工具源)
Trait Implementations§
Source§impl Clone for ContentPart
impl Clone for ContentPart
Source§fn clone(&self) -> ContentPart
fn clone(&self) -> ContentPart
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContentPart
impl Debug for ContentPart
Source§impl<'de> Deserialize<'de> for ContentPart
impl<'de> Deserialize<'de> for ContentPart
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ContentPart
impl RefUnwindSafe for ContentPart
impl Send for ContentPart
impl Sync for ContentPart
impl Unpin for ContentPart
impl UnsafeUnpin for ContentPart
impl UnwindSafe for ContentPart
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more