How to Use Tags for Content Filtering in ai12z
To restrict or customize content in ai12z, you can use tags during ingestion or set up multiple agents based on user access levels. Below are the recommended approaches:
1. Using Meta Tags
When ingesting content from a URL, ensure the webpage includes a <meta>
tag with the name "tags"
. For example:
<meta name="tags" content="bronze, silver, gold" />
Example: The tag “bronze” can be used to indicate content accessible to all visitors. ai12z will automatically apply these tags to the vector documents associated with the URL.
2. Filtering Based on Tags in the Web Control
You can filter which content the bot uses by specifying tag filters when initializing the ai12z web control in JavaScript:
document.addEventListener("DOMContentLoaded", function () {
const ele = document.querySelector("ai12z-bot")
if (ele) {
ele.excludeTags = ["gold"] // Exclude documents tagged "gold"
ele.includeTags = [] // Include all documents except excluded
}
})
Customize the excludeTags
and includeTags
arrays as needed to control what content is shown to users.
For details, see the ai12z Bot Control documentation.
3. Alternative Approach: Separate Agents per User Group
Alternatively, you can create separate agents for each user group (e.g., Bronze, Silver, Gold). Each agent ingests only the content relevant to its group. When loading the bot, select or apply the appropriate agent key based on the user’s access level. This ensures users only see content intended for their group.