Trait ToSchema

Source
pub trait ToSchema: JsonSchema {
    // Required method
    fn to_schema() -> Value;
}
Expand description

For tool function. If you have a function that you want ChatGPT to call, you shall put all params into a struct and derive schemars::JsonSchema for it. Then you can use YourStruct::to_schema() to generate json schema for tools.

Required Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§