pub struct BinaryInputContent {
pub type_tag: String,
pub mime_type: String,
pub id: Option<String>,
pub url: Option<String>,
pub data: Option<String>,
pub filename: Option<String>,
}Expand description
Binary input content for multimodal messages.
Represents binary content such as images, files, or other media.
At least one of id, url, or data must be provided.
§Example
use ag_ui_core::BinaryInputContent;
let content = BinaryInputContent::new("image/png")
.with_url("https://example.com/image.png")
.with_filename("screenshot.png");
assert_eq!(content.mime_type, "image/png");
assert_eq!(content.url, Some("https://example.com/image.png".to_string()));Fields§
§type_tag: StringThe content type discriminator, always “binary”.
mime_type: StringThe MIME type of the binary content.
id: Option<String>Optional identifier for the content.
url: Option<String>Optional URL where the content can be fetched.
data: Option<String>Optional base64-encoded data.
filename: Option<String>Optional filename for the content.
Implementations§
Source§impl BinaryInputContent
impl BinaryInputContent
Sourcepub fn new(mime_type: impl Into<String>) -> BinaryInputContent
pub fn new(mime_type: impl Into<String>) -> BinaryInputContent
Creates a new binary input content with the given MIME type.
Sourcepub fn with_id(self, id: impl Into<String>) -> BinaryInputContent
pub fn with_id(self, id: impl Into<String>) -> BinaryInputContent
Sets the content identifier.
Sourcepub fn with_url(self, url: impl Into<String>) -> BinaryInputContent
pub fn with_url(self, url: impl Into<String>) -> BinaryInputContent
Sets the content URL.
Sourcepub fn with_data(self, data: impl Into<String>) -> BinaryInputContent
pub fn with_data(self, data: impl Into<String>) -> BinaryInputContent
Sets the base64-encoded data.
Sourcepub fn with_filename(self, filename: impl Into<String>) -> BinaryInputContent
pub fn with_filename(self, filename: impl Into<String>) -> BinaryInputContent
Sets the filename.
Sourcepub fn validate(&self) -> Result<(), ContentValidationError>
pub fn validate(&self) -> Result<(), ContentValidationError>
Validates that at least one of id, url, or data is present.
Trait Implementations§
Source§impl Clone for BinaryInputContent
impl Clone for BinaryInputContent
Source§fn clone(&self) -> BinaryInputContent
fn clone(&self) -> BinaryInputContent
Returns a duplicate of the value. Read more
1.0.0 · 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 BinaryInputContent
impl Debug for BinaryInputContent
Source§impl<'de> Deserialize<'de> for BinaryInputContent
impl<'de> Deserialize<'de> for BinaryInputContent
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<BinaryInputContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<BinaryInputContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for BinaryInputContent
impl PartialEq for BinaryInputContent
Source§impl Serialize for BinaryInputContent
impl Serialize for BinaryInputContent
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for BinaryInputContent
impl StructuralPartialEq for BinaryInputContent
Auto Trait Implementations§
impl Freeze for BinaryInputContent
impl RefUnwindSafe for BinaryInputContent
impl Send for BinaryInputContent
impl Sync for BinaryInputContent
impl Unpin for BinaryInputContent
impl UnsafeUnpin for BinaryInputContent
impl UnwindSafe for BinaryInputContent
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