Find answers from the community

Updated last year

Node

whats the easiest way to convert a dict -> node? TextNode(node_dict) doesn't seem to work..

my nodedict = ` { {'id': 'acc2e3b8-54ec-4c99-a53f-a775b2d1c348', 'embedding': None, 'extra_info': {'input': 'hello', 'system_note': ''}, 'excluded_embed_metadata_keys': ['input', 'ideal', 'system_note', 'example_number', 'output', 'tasks', 'destinations', 'responses'], 'excluded_llm_metadata_keys': ['ideal', 'system_note', 'example_number', 'output', 'tasks', 'destinations', 'responses'], 'hash': '099bcbea79bed957b17408251ea5667f497148faa1e238045f9ae6cc896e9070', 'text': 'hello, 'start_char_idx': 0, 'end_char_idx': 25, 'text_template': '{metadata_str}\n\n{content}', 'metadata_template': '{key}: {value}', 'metadata_seperator': '\n'}
} `
L
2 comments
To create a dict

node.dict()

To create a node

TextNode.parse_obj(node_dict)
They are pydantic objects, so this is using pydantic methods πŸ’ͺ
Add a reply
Sign up and join the conversation on Discord