v0.2.1

NandhaKishorM/layav0.2.1Sep 19, 2026by NandhaKishorM

Upgrading?

Key Highlights

  • Fixed crashes for `noul` questions with structured criteria.
  • Fixed dictionary/list criteria being rendered as Python reprs instead of JSON.
  • Fixed criteria values of `0` or `False` being treated as missing.
  • Added regression tests for criteria handling.

New Features

  • Added regression tests for criteria handling

Full Release Notes

Patch release. Fixes a crash on criteria values that are not plain strings.

## Fixed

**`noul` questions with structured criteria crashed.**

```python
agent.predict(state, {"is_phishing": {
    "type": "noul",
    "instructions": "Is this phishing?",
    "criteria": {"true": {"desc": "phishing, scam or fraud"},
                 "false": {"desc": "legitimate"}}}})
# 0.2.0: TypeError: can only concatenate str (not "dict") to str
# 0.2.1: works, criteria render as JSON
```

`choice` and `score` did not crash but stringified dicts as **Python reprs** — `billing: {'desc': 'payments'}` went into the prompt instead of `billing: {"desc": "payments"}`.

**A criterion whose value was `0` or `False` was treated as missing.** The `choice` branch tested `if not v`, so those fell back to a bare key. Only `None` and `""` mean "no description" now.

Reported and originally fixed by **@trocker** in #2 — this release takes the `render_criterion` approach from that PR on its own, since #2 also carries a large amount of unrelated work.

## Added

`tests/test_criteria.py` — 29 regression tests: the reported crash, JSON rather than repr for dict/list/number criteria, `0`/`False` as real values, non-ASCII, unserialisable objects, and that plain-string criteria are untouched. Both suites now gate CI and releases.

No API changes. Safe upgrade from 0.2.0.

Related Repositories