pub enum OpenAIContentPart {
Text {
text: String,
},
ImageUrl {
image_url: OpenAIImageUrl,
},
}Expand description
A single content part in an OpenAI message.
Can be either text or an image URL. This is a tagged enum that prevents invalid states (e.g., having both text and image_url, or neither).
Variants§
Text
Text content part
ImageUrl
Image URL content part
Fields
§
image_url: OpenAIImageUrlThe image URL details
Implementations§
Source§impl OpenAIContentPart
impl OpenAIContentPart
Sourcepub fn from_image(image: &ImageBlock) -> Self
pub fn from_image(image: &ImageBlock) -> Self
Converts a validated ImageBlock while preserving its URL and detail hint.
Sourcepub fn image_url(url: impl Into<String>, detail: ImageDetail) -> Self
👎Deprecated since 0.6.0: Use from_image() instead to ensure proper validation
pub fn image_url(url: impl Into<String>, detail: ImageDetail) -> Self
Use from_image() instead to ensure proper validation
Creates an unvalidated image part. Prefer from_image
with a validated ImageBlock.
Trait Implementations§
Source§impl Clone for OpenAIContentPart
impl Clone for OpenAIContentPart
Source§impl Debug for OpenAIContentPart
impl Debug for OpenAIContentPart
Source§impl<'de> Deserialize<'de> for OpenAIContentPart
impl<'de> Deserialize<'de> for OpenAIContentPart
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 OpenAIContentPart
impl RefUnwindSafe for OpenAIContentPart
impl Send for OpenAIContentPart
impl Sync for OpenAIContentPart
impl Unpin for OpenAIContentPart
impl UnsafeUnpin for OpenAIContentPart
impl UnwindSafe for OpenAIContentPart
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