The Book of AI
- 1. Getting Started
- 2. Bot Settings
- 3. Expanding on Keyphrases
- Wildcards in Keyphrases
- The AI Engine
- 4. Keyphrase Macros
- 5. Writing Good Keyphrases
- 6. Plug-ins for Responses
- 7. Writing Good Responses
- 8. The Seek System
- 9. Keyphrase Rank
- 10. AIScript
- 11. Memories
- 12. AI Emotions
- 13. Conditional Responses
- 14. More Useful AIScript
- 15. Other Keyphrases
- 16. Robotics & The API
- 17. Future Advances
Seeks are Keyphrases that are active only after a certain Response comes up. The selected Seek's Responses can then have Seeks of their own. You can go as deep as you want. Seeks can do all the things Keyphrases can, but they are usually shorter and have a few additional powers.
When someone responds to a Response with Seeks, the Seeks are checked first. If one is matched, the conversation continues down that thread. If not, the message is then checked against all the normal Keyphrases.
To add Seeks to a Response, click "+ Seek" to the right of the Response.
yes, no, & haha
There are three Keyphrases that have extended matching power: "yes","no" and "haha". Each of these has an expanded reach in the AI Engine and cover every possible way of saying them. Seeks of "yes" and "no" are extremely useful and common.
If you add a Seek called #nomatch, it will be triggered if no other Seeks are found.
Let's say a chatbot asks "Do you love me?" and that Response has three Seeks: "yes", "no", and "#nomatch". If the person responds to the chatbot by saying "Yes, I sure do!" then the yes Seek will be triggered. If the person's response is "I need to get going", then #nomatch will trigger and the chatbot could say "Why are you avoiding the question?". If there was no #nomatch Seek, then the general list of Keyphrases would then be searched as usual.
As you know, whenever a Keyphrase or Seek is matched, Key Plug-ins such as (key1) and (key2) are generated. When you are writing Responses for Seeks, you can access the Key Plug-ins from the original Keyphrase match. This lets you access the original topics of conversation in Seek Responses. To access them, put "first" at the beginning of each: for example (firstkey1) or (firstpostkey)
Starting with this conversation:
Person: "Do you ride white horses?"
Bot: "I ride white horses every day."
Person: "Even on your birthday?"
When the Seek "even on" is matched, it has access to the following Keys:
Bot: "Yes, I especially like to ride white horses on my birthday."
Key Contents (firstprekey) - (firstkey1) ride (firstkey2) white horses (firstpostkey) - (prekey) - (postkey) your birthday
Let's say you've got a solid set of Responses for a particular Keyphrase, and you want to use that set somewhere else as well. Rather than copying those Responses, you can have a "Goto Response" that looks like this: "goto 12345", where 12345 is the ID of a Keyphrase (or Seek). When that Goto Response is selected, the AI Engine will instead choose a Response from that Keyphrase. There are three times when you should use gotos:
- Goto Responses really shine when you're writing Seeks. As Seeks can form complex structures, it's sometimes useful for one Seek to point into the structure of another, or end on another Keyphrase.
- When you want to sometimes use Responses from another Keyphrase, then you can write several normal Responses and then add one or more Goto Responses that point to the other Keyphrase whose Responses you want to sometimes use.
- When you want different Keyphrases to use the same Responses, use Keyphrase Lists. However, if there are too many variations to fit in one Keyphrase (this should be very rare), you can get more space by creating another Keyphrase List with a single Goto Response pointing to the first.
However, if you just want two different Keyphrases to have the same Responses, it's better to simply write them as a Keyphrase List: "keyphrase A, keyphrase B, keyphrase C". This is simpler and easier to read. Writing Goto Responses should be relatively uncommon in your chatbot.
Click the [go] box to the right of any Keyphrase in the Language Center, and you'll see a little popup that says "goto" followed by a number. That's the goto and ID that you can use as a Response to redirect to that Keyphrase's Responses. Linked Keyphrases from Bot Templates have gotos that start with the Template ID like this: "goto 1.15".
Be aware - if the new Responses you are pointing to require (key)s, make sure the Keyphrase with the goto Response is collecting the same (key)s. Otherwise the (key)s in the resulting Response will be blank. For similar reasons, you cannot goto #gossip, #favorite, or #math. All of these require a number of things from internal processing and must be triggered naturally.
There is an AIScript command called Continue that works similarly. By adding "continue 12345", where 12345 is a Keyphrase (or Seek) ID, the chatbot will use the current Response, and then add a Response from the given Keyphrase ID. For more, check out More Useful AIScript.