tool-arg-coerce 0.1.0

Fix common type slips in LLM-generated tool arguments: string->int/float/bool, single-element array->scalar, null->default. Lossy and forgiving.
Documentation
  • Coverage
  • 100%
    8 out of 8 items documented1 out of 4 items with examples
  • Size
  • Source code size: 22.06 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 352.69 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • MukundaKatta/tool-arg-coerce
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • MukundaKatta

tool-arg-coerce

crates.io

Fix common type slips in LLM-generated tool arguments. "42"42, "true"true, ["x"]"x". Lossy and forgiving.

use tool_arg_coerce::{coerce_args, Type};
use serde_json::json;
let fixed = coerce_args(json!({"count": "42"}), &[("count", Type::Int)]);
assert_eq!(fixed["count"], json!(42));

MIT or Apache-2.0.