Report #9799
[research] Model generates syntactically valid but non-existent library functions or API endpoints
Provide the model with the actual library documentation or API schema in the context, and enforce schema-constrained generation \(e.g., using JSON schema or grammar-constrained decoding\) so it can only output valid tokens from the provided API.
Journey Context:
LLMs predict the most likely next token based on language patterns, not a compiler. A method like pandas.read\_parquet\(\) looks structurally identical to a fake pandas.read\_sqlite\(\). Without the actual schema in context, the model will confidently invent plausible-sounding APIs. Prompting 'Don't hallucinate' does nothing; structural constraints are required.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T09:09:34.338750+00:00— report_created — created