Where there is an empty parameter the code will try to look back to the last recent commands for context (e.g. I may have just said "turn on the living room light"). If there's an issue it just asks for the missing info.
Translating the parameters from the json is done with good old fashion brute force (i.e. mostly regex).
It's still not 100% perfect but its faster and more accurate than the cloud assistants and private.
With a proper grammar, you can require the "subject" field to be one of several valid entity names. In the prompt, you would tell the LLM what the valid entity names are, which room each entity is in, and a brief description of each entity. Then it would be able to infer which entity you meant if there is one that reasonably matches your request.
If you're speaking through the kitchen microphone (which should be provided as context in the LLM prompt as well) and there are no controllable lights in that room, you could leave room in the grammar for the LLM to respond with a clarifying question or an error, so it isn't forced to choose an entity at random.
Llama: { "subject": "lamp", "action": "switch off", "time": "3:45", "location": "" }
Where there is an empty parameter the code will try to look back to the last recent commands for context (e.g. I may have just said "turn on the living room light"). If there's an issue it just asks for the missing info.
Translating the parameters from the json is done with good old fashion brute force (i.e. mostly regex).
It's still not 100% perfect but its faster and more accurate than the cloud assistants and private.