Description
Observed vs expected
Both functions in `mellea/stdlib/components/intrinsic/guardian.py` carry `-> float` return type annotations but return `str` values:
| Function | Annotated | Actual return |
|---|---|---|
| `factuality_detection()` | `-> float` | `"yes"` or `"no"` (string label) |
| `factuality_correction()` | `-> float` | corrected response text, or `"none"` |
The docstrings are also inconsistent: `factuality_detection` says "Factuality score as a 'yes/no' label" and `factuality_correction` says "Correct assistant response", but both are annotated as `float`.
Evidence
Tests confirm the actual types:
```python
test/stdlib/components/intrinsic/test_guardian.py
assert result == "yes" or result == "no" # factuality_detection
assert isinstance(result, str) # factuality_correction
```
The return value comes from `result_json["score"]` and `result_json["correction"]` respectively — both strings from the adapter JSON response.
Fix
Change both annotations to `-> str` and fix the `factuality_detection` docstring typo ("Determine is the last response" → "Determine if the last response").
Files
- `mellea/stdlib/components/intrinsic/guardian.py` lines 162–208
Activity
fix: address review findings from PR generative-computing#935 code re…
fix: address second-pass review findings
fix: address review findings from PR generative-computing#935 code re…
fix: address second-pass review findings
fix: address review findings from PR generative-computing#935 code re…
fix: address second-pass review findings
psschwei commentedon May 19, 2026
believe that @jakelorocco fixed this in the great intrinsics push of may 2026
fix: address review findings from PR generative-computing#935 code re…
fix: address second-pass review findings
fix: address review findings from PR generative-computing#935 code re…
fix: address second-pass review findings
docs: migrate Guardian documentation from deprecated GuardianCheck to…