pub struct StructuredOutput;Expand description
Structured output extractor.
Implementations§
Source§impl StructuredOutput
impl StructuredOutput
Sourcepub fn extract(
content: &str,
mode: &OutputMode,
) -> Result<Value, StructuredOutputError>
pub fn extract( content: &str, mode: &OutputMode, ) -> Result<Value, StructuredOutputError>
Extract structured output from agent response content.
OutputMode::Text→ returns the content as a JSON string.OutputMode::Json→ extracts JSON from the content.OutputMode::ValidatedJson→ extracts and validates JSON.
Sourcepub fn extract_json(content: &str) -> Result<Value, StructuredOutputError>
pub fn extract_json(content: &str) -> Result<Value, StructuredOutputError>
Extract JSON from text content.
Tries, in order:
- Parse the entire content as JSON.
- Extract from a
```json ... ```code block. - Find a matching
{ ... }or[ ... ]bracket pair.
Auto Trait Implementations§
impl Freeze for StructuredOutput
impl RefUnwindSafe for StructuredOutput
impl Send for StructuredOutput
impl Sync for StructuredOutput
impl Unpin for StructuredOutput
impl UnsafeUnpin for StructuredOutput
impl UnwindSafe for StructuredOutput
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