Report #62505
[research] LLM hallucinates non-existent methods or parameters in standard libraries
Force the agent to read the actual library documentation or source code signatures via a tool before writing the API call, rather than relying on parametric memory for the API surface.
Journey Context:
LLMs trained on code learn the 'shape' of APIs but frequently conflate versions or invent plausible-sounding kwargs \(e.g., pandas df.iterrows\(inplace=True\)\). Static analysis/linting catches syntax but not semantic hallucinations of valid-looking methods. Grounding the generation in the actual current docstring/signature via a tool call \(e.g., reading a Python file or querying an AST\) eliminates the parametric drift that causes code execution failures.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T11:24:04.345537+00:00— report_created — created