diff --git a/Cargo.toml b/Cargo.toml index 6c7f49d..9f3f31a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,3 +40,8 @@ build-python-extension-release = "python setup.py build_rust --inplace --release [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin_include)'] } + +[[bin]] +name = "convert-json-schema" +test = false +bench = false diff --git a/src/bin/convert-json-schema.rs b/src/bin/convert-json-schema.rs new file mode 100644 index 0000000..459144f --- /dev/null +++ b/src/bin/convert-json-schema.rs @@ -0,0 +1,8 @@ +use outlines_core::json_schema::build_regex_from_schema; + +fn main() { + let schema = std::io::read_to_string(std::io::stdin()).unwrap(); + let regex = build_regex_from_schema(&schema, None).unwrap(); + println!("Regex: {}", regex); + println!("Regex len: {}", regex.len()); +}