Hi, I'm looking to label nodes with keywords out of a specific set (up to 5). The keywords indicate whether a particular node contains a piece of information, like so:
Currently I'm doing with a
CustomExtractor
:
class CustomExtractor(MetadataFeatureExtractor):
def class_name():
return "CustomExtractor"
def extract(self, nodes):
metadata_list = [
{
"custom": (
node.metadata["contains_x"]
+ "\n"
+ node.metadata["contains_y"]
+ "\n"
+ node.metadata["contains_z"]
)
}
for node in nodes
]
return metadata_list
This yields good results, but I don't know how to combine this with querying. I'd like to convert (x,y,z) into keywords, and then filter out all nodes that don't match. So that's either;
- using a KeywordTableIndex, however I can't supply a custom list of keywords, I'd probably need to write some totally custom index implementation
- using a VectorIndex and filtering out by the metadata
What would be the best way forward to achieve this? Thanks a lot for your help