Report #2303
[research] Hallucinating non-existent package names, classes, or API methods in generated code
Cross-reference generated code against official documentation or package registries \(e.g., PyPI, npm\) before execution, or constrain decoding to valid API tokens if using a specialized coding model.
Journey Context:
LLMs are prolific at inventing plausible-looking APIs \(e.g., 'from langchain import MagicSolver'\). This causes immediate runtime errors. Static analysis or execution in a sandboxed environment to verify imports is necessary before presenting code to the user.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T10:55:13.999866+00:00— report_created — created