How can I effectively implement AI for context tagging using an existing database of tags before creating new ones?
I’m working on a project to explore if AI can contextualise text by tagging it with relevant metadata. My goal is for the AI to first search an existing database of tags and use them, only creating new tags if no relevant ones are found.
Example Workflow:
- Input Text:
House bed-rm temp window C
- Database Structure:
Key | Value | Description |
---|---|---|
locationType |
House |
Specifies the type of location. |
RoomType |
Bedroom |
Specifies the type of room. |
Equipment |
Window |
Specifies the equipment or object. |
Measure |
Temperature |
The type of measurement. |
Unit |
Celsius |
The unit for the measurement. |
- AI Goal: Match existing tags first. If none fit, create a new tag with proper key-value mapping.
Example Tagging Process:
- The AI parses the input text:
House
maps tolocationType: House
.bed-rm
maps toRoomType: Bedroom
.temp
maps toMeasure: Temperature
.window
maps toEquipment: Window
.C
maps toUnit: Celsius
.
- The output tags from the database are:
locationType: House
RoomType: Bedroom
Equipment: Window
Measure: Temperature
Unit: Celsius
Case with New Tag Creation:
-
Input Text:
Office conf-room humidity sensor %
-
AI Process:
Office
doesn’t exist → CreateslocationType: Office
.conf-room
doesn’t exist → CreatesRoomType: Conference Room
.humidity
exists →Measure: Humidity
.sensor
doesn’t exist → CreatesEquipment: Sensor
.%
exists →Unit: Percentage
.
-
Updated Database After Tag Creation:
Key | Value | Description |
---|---|---|
locationType |
House |
Specifies the type of location. |
locationType |
Office |
Specifies the type of location. |
RoomType |
Bedroom |
Specifies the type of room. |
RoomType |
Conference Room |
Specifies the type of room. |
Equipment |
Window |
Specifies the equipment or object. |
Equipment |
Sensor |
Specifies the equipment or object. |
Measure |
Temperature |
The type of measurement. |
Measure |
Humidity |
The type of measurement. |
Unit |
Celsius |
The unit for the measurement. |
Unit |
Percentage |
The unit for the measurement. |
Questions:
- AI Implementation: How can I configure an AI model to prioritise using the tags from the database and only create new ones when no relevant match exists?
- Using n8n: How can I use n8n ( Version 1.72.1)to orchestrate this workflow (e.g., querying the database, passing text to the AI, managing tag creation)?
- Best Practices: Are there any best practices or tools to ensure consistency and avoid redundant tag creation?
Any advice, suggestions, or examples of similar workflows would be greatly appreciated! Thank you!