-
Notifications
You must be signed in to change notification settings - Fork 26
SIML guidelines
When writing SIML for our AI brain, it's a good idea to stick with some common guidelines and best practices to write clean, efficient and properly working code. Those guidelines are general tips that you should take into account when writing SIML.
If given <Pattern>
is not expected to be called by user, it should be prefixed with {Name}_
of the <Concept>
.
For example, instead of:
<Concept Name="_bob">
<Model>
<Pattern>GET_RANDOM_CAT</Pattern>
</Model>
</Concept>
You can write:
<Concept Name="_bob">
<Model>
<Pattern>_bob_GET_RANDOM_CAT</Pattern>
</Model>
</Concept>
Thanks to that we won't need to fight with potential conflicts if the same pattern is declared twice in two different files.
For example, instead of:
<Concept Name="_bob">
<Model>
<Pattern>WHO IS KALEITH</Pattern>
<Pattern>WHO IS THIELAK</Pattern>
</Model>
</Concept>
You can write:
<Concept Name="_bob">
<Model>
<Pattern>WHO IS (KALEITH|THIELAK)</Pattern>
</Model>
</Concept>
At the same time you should still stick with multiple patterns if they're entirely different or they do not differ only by a few words.
<Concept Name="_bob">
<Model>
<Pattern>WHO ARE YOU</Pattern>
<Pattern>WHAT DO YOU DO</Pattern>
</Model>
</Concept>
This approach makes it easier for us, humans, to read the code.
Responses generated by the <Late>
tag are by default sent to the last chat source the user interacted through with the bot (ChannelID
). This might not be appropriate, for example because user could ask for something that generated <Late>
task in private, then write something on group chat - in this case <Late>
response will arrive also on the group chat and not to the original private user message (because ChannelID
was set to group chat in the last message).
To help prevent this you can set a destination ID before the <Late>
message in the usual ChannelID
format:
<Concept Name="_bob">
<Model>
<Pattern>SEND ME A PROPER LATE TASK</Pattern>
<Response>
<Bind Key="{LateSource}"><User Get="ChannelID" /></Bind>
<Text>I'll send you in 5 seconds a proper late task regardless of your last chat interaction!</Text>
<Late Second="5"><Text>{LateSource}</Text> I'm proper late task, hooray!</Late>
</Response>
</Model>
</Concept>
This will properly set {LateSource}
to user's ChannelID
, then include that original {LateSource}
in the response itself.