pub struct StructuredPart {
pub value: Value,
pub schema: Option<Value>,
pub metadata: MetadataMap,
}Expand description
Structured JSON content, optionally paired with a JSON Schema for validation.
Providers that support structured output (e.g. function-calling mode) may
return a StructuredPart instead of free-form text.
Fields§
§value: ValueThe structured data as a JSON Value.
schema: Option<Value>An optional JSON Schema that value conforms to.
metadata: MetadataMapArbitrary key-value metadata.
Implementations§
Source§impl StructuredPart
impl StructuredPart
Sourcepub fn with_schema(self, schema: Value) -> Self
pub fn with_schema(self, schema: Value) -> Self
Sets the optional schema.
Sourcepub fn with_metadata(self, metadata: MetadataMap) -> Self
pub fn with_metadata(self, metadata: MetadataMap) -> Self
Replaces the structured-part metadata.
Trait Implementations§
Source§impl Clone for StructuredPart
impl Clone for StructuredPart
Source§fn clone(&self) -> StructuredPart
fn clone(&self) -> StructuredPart
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 StructuredPart
impl Debug for StructuredPart
Source§impl<'de> Deserialize<'de> for StructuredPart
impl<'de> Deserialize<'de> for StructuredPart
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
Source§impl PartialEq for StructuredPart
impl PartialEq for StructuredPart
Source§impl Serialize for StructuredPart
impl Serialize for StructuredPart
impl StructuralPartialEq for StructuredPart
Auto Trait Implementations§
impl Freeze for StructuredPart
impl RefUnwindSafe for StructuredPart
impl Send for StructuredPart
impl Sync for StructuredPart
impl Unpin for StructuredPart
impl UnsafeUnpin for StructuredPart
impl UnwindSafe for StructuredPart
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