In investigating ways to address this I realized it's possible to see the prompts used by other existing integrations - here's the prompt for Wolfram Alpha for example: https://www.wolframalpha.com/.well-known/ai-plugin.json
I think it hallucinates when the response returned from a query is too long - if it exceeds the token limit, ChatGPT appears to invisibly truncate it and then hallucinate to make up for the missing data.