Report #54254
[counterintuitive] Instructing the model 'Do not make things up' or 'Do not hallucinate' to prevent API or library misuse
Provide the exact API documentation in the context, or force the model to use a search tool before generating code.
Journey Context:
Telling a model 'don't hallucinate' is like telling a person 'don't think of an elephant.' The model doesn't have a binary 'hallucinate' switch; it predicts tokens. If it doesn't know an API, it will predict the most likely next token, which looks like a hallucination. The only fix is grounding: providing the context \(RAG\) or tools \(web search\) so the highest probability token is the correct one.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T21:33:47.189433+00:00— report_created — created