Check it out in action
How it works
Speculative fan-out
The chief pattern demonstrated here is speculative fan-out. Each user request is evaluated against a long list of questions, including many that will end up irrelevant for most requests. Let’s consider the following user request:“Turn off all of the lights in the house”This is a very simple request, and our code will only need to consider the answers to the following questions:
- “What category of request is this?” (smarthome command)
- “What domain is this request targeting?” (whole house)
- “What type of device is this request targeting?” (lights)
- “What action should be taken on the lights?” (turn off)
The wrong way: sequential API calls
The wrong way to do this would be to separate the questions in to multiple API calls, waiting to ask questions only once you are certain you need the answer:- “What category of request is this?” (smarthome command)
- “What domain is this request targeting?” (whole house)
- “What type of device is this request targeting?” (lights)
- “What action should be taken on the lights?” (turn off)

