pub struct SchemaOptimizer;Expand description
Schema optimizer for creating LLM-compatible JSON schemas
Implementations§
Source§impl SchemaOptimizer
impl SchemaOptimizer
Sourcepub fn optimize(schema: &Value) -> Value
pub fn optimize(schema: &Value) -> Value
Create an optimized JSON schema from a raw schema
This function:
- Flattens $ref and $defs
- Removes additionalProperties
- Ensures all properties are required
Sourcepub fn create_tool_definition(
name: impl Into<String>,
description: impl Into<String>,
schema: Value,
) -> ToolDefinition
pub fn create_tool_definition( name: impl Into<String>, description: impl Into<String>, schema: Value, ) -> ToolDefinition
Create a tool definition from a JSON schema
Sourcepub fn string_schema() -> Value
pub fn string_schema() -> Value
Create a minimal schema for a simple string parameter
Sourcepub fn string_params_schema(params: &[(&str, &str)]) -> Value
pub fn string_params_schema(params: &[(&str, &str)]) -> Value
Create a schema for multiple string parameters
Auto Trait Implementations§
impl Freeze for SchemaOptimizer
impl RefUnwindSafe for SchemaOptimizer
impl Send for SchemaOptimizer
impl Sync for SchemaOptimizer
impl Unpin for SchemaOptimizer
impl UnsafeUnpin for SchemaOptimizer
impl UnwindSafe for SchemaOptimizer
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