You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Modernize field!/sign!/hashmap! macros to emit typed SignatureSchema #73
hashmap! (lines 178-187) — convenience HashMap literal. Used in tests/examples.
These are ergonomic features for the untyped path. field! and sign! use schemars::schema_for!() to generate JSON schemas, which is the pre-V1 approach. The typed path uses #[derive(Signature)] + SignatureSchema::of::<S>().
What's needed
field! macro
Should emit typed FieldSchema values instead of serde_json::Value maps
Or consider if #[derive(Signature)] makes this macro redundant
sign! macro
Should work with the typed Signature derive and produce a Predict<__InlineSignature> that's fully wired (accessor registration, etc.)
Currently generates a derive but doesn't call register_predict_accessor or build()
hashmap! macro
Low priority. HashMap::from([...]) is standard Rust. Keep or kill, doesn't matter much.
schemars dependency
__macro_support re-exports schemars solely for field!
Once field! is modernized, schemars can be dropped from Cargo.toml (also requires specials.rs migration, see related issue)
Currently works since it does #[derive(Signature)] — but it doesn't call register_predict_accessor or wire up the builder pattern
Should produce a fully functional Predict that works with optimizers
Consider if this needs to produce a named type (for optimizer walker to find) or if anonymous is fine for non-optimized use
schemars removal: once field! uses BamlType::baml_type_ir() instead of schemars::schema_for!(), the schemars dep in __macro_support and Cargo.toml can be dropped (assuming #72 is also done).
Activity
darinkishore commentedon Feb 12, 2026
Codebase audit — current macro state
field!(lib.rs:148-236):serde_json::Valueobjects viaschemars::schema_for!()tests/test_field_macro.rs#[derive(Signature)]structsign!(lib.rs:238-274):__InlineSignaturestruct with#[derive(Signature)]and returnsPredict::<__InlineSignature>::new()let p = sign!((question: String) -> answer: String);hashmap!(lib.rs:276-290):Modernization path for
field!:FieldSchema(fromcore/schema.rs) instead ofserde_json::Valuefacet::ShapeorBamlType::baml_type_ir()instead ofschemars::schema_for!()Modernization path for
sign!:#[derive(Signature)]— but it doesn't callregister_predict_accessoror wire up the builder patternPredictthat works with optimizersschemars removal: once
field!usesBamlType::baml_type_ir()instead ofschemars::schema_for!(), theschemarsdep in__macro_supportandCargo.tomlcan be dropped (assuming #72 is also done).