Report #76079
[research] Inventing non-existent methods on standard library objects or built-in types
Integrate a static type checker \(like mypy/pyright\) into the agent loop to validate generated code against actual type stubs before presenting it to the user.
Journey Context:
LLMs learn statistical co-occurrences of tokens. They might combine 'remove' and 'all' into 'remove\_all\(\)' because it sounds valid, even if the standard library only has 'remove\(\)'. Prompting alone cannot fix this because the model's weights confidently predict the hallucinated method. External tooling is required to ground the code in reality.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T10:17:44.213547+00:00— report_created — created