-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question]: update _node_content when metadata are updated #17313
Comments
To update the Here's an example of how you might update the metadata: # Assuming `node` is an instance of BaseNode with updated metadata
metadata_dict = node_to_metadata_dict(node)
# Now `metadata_dict` contains the updated `_node_content` reflecting the changes For accessing the Here's how you can access the node from metadata: # Assuming `metadata` is the metadata dictionary retrieved from QDRANT
node = metadata_dict_to_node(metadata)
# Now `node` contains the content and metadata for filtering Additionally, when using QDRANT, you can apply filters directly using the from llama_index.core.vector_stores import MetadataFilter, MetadataFilters, FilterOperator
filters = MetadataFilters(
filters=[
MetadataFilter(key="theme", operator=FilterOperator.EQ, value="Mafia"),
]
)
retriever = index.as_retriever(filters=filters) This approach ensures that any changes in metadata are consistently reflected in the To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
in which class this function is written ( |
The To update the
Here's a simplified example: # Assuming `metadata` is your metadata dictionary
node = metadata_dict_to_node(metadata)
# Update the node's content or metadata
# For example, if you have a method to update content based on `file_id`
if node.metadata.get('file_id') == 'your_specific_file_id':
node.set_content('new content based on file_id')
# Regenerate the metadata dictionary with updated content
updated_metadata_dict = node_to_metadata_dict(node) This process ensures that any changes to the node are reflected in the To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
Question Validation
Question
When I update the metadata such as file_name, inside node_content, it is not updated. in my figure, the node_content should have the file_name now = costy ", I would like to update it as well so it is consistent to metadat file_name. I also don't understand if the retriever and openai agent would access the node_content to filter or the metadata rows . I am using QDRANt (see image )
PLEASE HELP @dosu
The text was updated successfully, but these errors were encountered: