Here’s the kind of approach I’ve been using:
https://github.com/williamcotton/empirical-philosophy/blob/m...
The initial call to the LLM will return a completion that includes JavaScript. There is no third-party data at this point. The JavaScript includes further calls to the LLM that returns JSON, but at this point no further calls are made to the LLM. This means that responses from remote queries are never sent to an LLM. The text presented to the user could be some instructions to talk like a pirate but all the user suffers from is a surprisingly incorrect result.
Even with LangChain the issue is the chatbot UX. LangChain can also be used in ways that make it not vulnerable to this problem.
Orthogonally, I don’t think that chatbots are a very good UX in general and that there are much better ways to interact with an LLM. If anything your work should accelerate this process!