Skip to main content

ToolSpecExt

Trait ToolSpecExt 

pub trait ToolSpecExt {
    // Required method
    fn for_args<A>(
        name: impl Into<String>,
        description: impl Into<String>,
    ) -> ToolSpec
       where A: JsonSchema;
}
Expand description

ToolSpec::for_args::<A>(name, description): spec_for as an associated function. ToolSpec belongs to adam-model, so this is an extension trait: import it to call it.

use adam_llm_agent::ToolSpecExt as _;
use adam_model::ToolSpec;
use schemars::JsonSchema;
use serde::Deserialize;

#[derive(Deserialize, JsonSchema)]
struct Args { key: String }

let spec = ToolSpec::for_args::<Args>("lookup", "Look a key up.");
assert_eq!(spec.parameters["type"], "object");

Required Methods§

fn for_args<A>( name: impl Into<String>, description: impl Into<String>, ) -> ToolSpec
where A: JsonSchema,

See spec_for.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl ToolSpecExt for ToolSpec

§

fn for_args<A>( name: impl Into<String>, description: impl Into<String>, ) -> ToolSpec
where A: JsonSchema,

Implementors§