There are 3 concepts that apply when using a chatbot as an information retrieval tool.
1: Input Filtering: A chat bot can make a distinction between general chat and serious application usage. It can draw from a resource of conversation methods geared towards steering the chat back on topic.
2: Categorization: A chat bot can take an input and make decisions about which resource would best handle the response. If you are working with multiple knowledge sources, the chatbot can distinguish between a mathematical question, a database query, or a call to another bot.
3 Hierarchy: Chatbots can work in such a way as to go from most specific requests, down to keyword inquiries.
3a: The first layer takes specific stimuli like "get a lithium level on the patient in room 238." And, can learn these kinds of responses in a very specific trainer assisted way to give the most specific of replies or responses. The next level is the AIML level, or the condenser level, and is usually characterized by the * character. Get bloodwork on patient 238. might be represented by "Get bloodwork on patient *" This level of abstraction is less specific than the level above, but can give a correct result if leveraged with input filtering to make sure this is a command level query.
3b: Key Phrase results. "Give me the status of my patients" Might be characterized by the key phrase "Give me the status *" or in JFRED, a regex rule might be used to reach this level of specificity.
3c: Key word results. "What is the Lithium level?" might key on the word lithium and respond with "Which patient are you referring to?" with the expectation that a number will follow.
All of these may be learned on the fly by a trainer. Some of these may be learned by an untrained expert, given a few lessons in consistency. For a chatbot, data consistency, and redundancy are key allies to being able to decipher natural language commands, queries, or statements.