hi @Logan M - I wonder if you or anyone can help with a problem.
I load data from airtable - i end up with records that look like this (like 100s of pages).
{'id': 'recaLU8tMlV72bae8', 'createdTime': '2023-01-04T13:53:52.000Z', 'fields': {'Lesson': 'Blow your own glass', 'Areas of improvement': ['Executing a plan'], 'Source': 'http://www.paulgraham.com/marginal.html\', 'Industry': ['Technology'], 'Quotes': "So if you want to beat those eminent enough to delegate, one way to do it is to take advantage of direct contact with the medium. In the arts it's obvious how: blow your own glass, edit your own films, stage your own plays. And in the process pay close attention to accidents and to new ideas you have on the fly.\n", 'People': 'Paul Graham', 'Tool Type': 'Technique', 'Collection': 'Paul Graham Essays'}},
The aim is to split each quote into a node.
& then also to be able to extract the author and the URL when returning sources, so that I can display it in my app.
I was splitting the docs up like this -
nodes = []
for document in documents:
text = document.text
matches1 = re.findall(pattern1, text)
matches2 = re.findall(pattern2, text)
matches3 = re.findall(pattern3, text)
# takes quotes & people from matches & puts them into list of nodes
for quote, person, url in zip(matches1, matches2, matches3):
node_name = f"node{len(nodes) + 1}"
node_text = f"{quote}"
extra_info = {"Person": person, "url": url}
exec(f"{node_name} = Node(text=node_text, extra_info=extra_info)")
nodes.append(eval(node_name))
then the person & url were appearing in the response source nodes metadata & I was displaying in the app.
But I think there is now a different way to do this, as I am being told: NameError: name 'Node' is not defined. Did you mean: 'nodes'?