pub struct Sanitized<T>(pub T);Expand description
Value wrapper neutralizing LLM control delimiters and breakout tags on serialization.
Neutralizes all known LLM control/turn/tool delimiters
(DELIMITER_RULES) and <tool_output_quarantine>
breakout tags when converted into ToolOutput or serialized via serde::Serialize.
Unlike Untrusted<T>, Sanitized<T> does not wrap strings in an outer
<tool_output_quarantine> XML envelope.
Tuple Fields§
§0: TImplementations§
Trait Implementations§
impl<T: Copy> Copy for Sanitized<T>
Source§impl<'de, T> Deserialize<'de> for Sanitized<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Sanitized<T>where
T: Deserialize<'de>,
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
impl<T: Eq> Eq for Sanitized<T>
Source§impl From<Sanitized<ToolOutput>> for ToolOutput
impl From<Sanitized<ToolOutput>> for ToolOutput
Source§impl<T> JsonSchema for Sanitized<T>where
T: JsonSchema,
impl<T> JsonSchema for Sanitized<T>where
T: JsonSchema,
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl<T: Ord> Ord for Sanitized<T>
impl<T: Ord> Ord for Sanitized<T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl<T: PartialOrd> PartialOrd for Sanitized<T>
impl<T: PartialOrd> PartialOrd for Sanitized<T>
impl<T: PartialEq> StructuralPartialEq for Sanitized<T>
Auto Trait Implementations§
impl<T> Freeze for Sanitized<T>where
T: Freeze,
impl<T> RefUnwindSafe for Sanitized<T>where
T: RefUnwindSafe,
impl<T> Send for Sanitized<T>where
T: Send,
impl<T> Sync for Sanitized<T>where
T: Sync,
impl<T> Unpin for Sanitized<T>where
T: Unpin,
impl<T> UnsafeUnpin for Sanitized<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Sanitized<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.