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
i think it would be cool if we allow for per-field and per-signature validation with custom code as well (eg: tool_calls must conform to allowed tools schema) and allow returning help-text to the LLM for the things which it didn't exactly conform to on retries.
this could look like a fn validate() and maybe an arg auto_retry (or handle it like cot) with specified retry counts.
validate should return natural language feedback about what exactly was wrong.
ie: two return types, return one of either, if x -> j,k,l must be present and valid, if y -> w must be present, q/r are optional but if including one u must include the other.
this feels useful because we're giving ourselves much more expressiveness and flexibility by bringing in BAML's schema .
When constraints fail, the adapter should be able to re-prompt the LM with natural language feedback about what was wrong
This would look like: parse → constraints fail → format failure reasons as user message → re-send to LM → parse again
The ResponseCheck already has label and status — needs a feedback: String or the label itself used as feedback
The retry should be configurable: max_retries, and whether to retry on check failures (soft) vs only assert failures (hard)
Where this hooks in:
Predict::forward() in predictors/predict.rs is where the call + parse happens
The retry loop would wrap the existing adapter.format() → lm.call() → adapter.parse() sequence
ChatAdapter::parse() already returns Parsed<T> with constraint results — the information is there, just not fed back
Design question: should retry-with-feedback live in Predict (module-level) or in a separate ValidatedPredict wrapper module? The DSPy pattern would be module-level with a configurable retry policy.
Activity
darinkishore commentedon Feb 12, 2026
Codebase audit — what's done vs what's left
Done:
#[baml(check(label = "...", expr = "..."))]— per-field constraint checks, surfaced asResponseCheckinParsed<T>.checks#[baml(assert(label = "...", expr = "..."))]— hard constraints that fail parsing (BamlParseError::ConstraintAssertsFailed)Parsed<T>returns{ value, baml_value, flags, checks, explanations }— full diagnostic bundleNot done — the feedback-to-LM retry loop:
ResponseCheckalready haslabelandstatus— needs afeedback: Stringor the label itself used as feedbackmax_retries, and whether to retry oncheckfailures (soft) vs onlyassertfailures (hard)Where this hooks in:
Predict::forward()inpredictors/predict.rsis where the call + parse happensadapter.format() → lm.call() → adapter.parse()sequenceChatAdapter::parse()already returnsParsed<T>with constraint results — the information is there, just not fed backDesign question: should retry-with-feedback live in
Predict(module-level) or in a separateValidatedPredictwrapper module? The DSPy pattern would be module-level with a configurable retry policy.