@Logan M I think you might be the best person to point me to where I can look in the code base to fix this. I implemented the Kùzu Property Graph Index, and there's one thing that's been bugging me regarding the output of the
.retrieve
method of a graph retriever object. I'm trying to display all Llama nodes obtained as a result for a given retriever query string.
nodes = kg_index.as_retriever(include_text=False).retrieve("Marie Curie")
for node in nodes:
print(node.text)
Here's what I'd expect to get (based on the outputs for other graph DBs):
Marie Curie -> DISCOVERED -> radium
But what I actually get is below. Note how the information is buried in there - it's just that a lot of other JSON fields are converted to a string and concatenated with the
(src)-[rel]->(target)
string output.
Marie Curie ({'id': 'Marie Curie', 'text': None, 'label': 'PERSON', 'embedding': None, 'creation_date': datetime.date(2024, 9, 13), 'last_modified_date': datetime.date(2024, 9, 13), 'file_name': 'curie.txt', 'file_path': '/code/data/curie/curie.txt', 'file_size': 1830, 'file_type': 'text/plain', 'ref_doc_id': None, 'triplet_source_id': '4014e554-016d-4f90-b743-f093c7677fa5'}) -> DISCOVERED -> radium ({'id': 'Marie Curie', 'text': None, 'label': 'PERSON', 'embedding': None, 'creation_date': datetime.date(2024, 9, 13), 'last_modified_date': datetime.date(2024, 9, 13), 'file_name': 'curie.txt', 'file_path': '/code/data/curie/curie.txt', 'file_size': 1830, 'file_type': 'text/plain', 'ref_doc_id': None, 'triplet_source_id': '4014e554-016d-4f90-b743-f093c7677fa5'})
Is there somewhere I should be implementing a custom
__str__
or
__repr__
method so that my retriever outputs the string correctly? I know I'm missing something.