🔥 refactor(base.py): remove unnecessary deepcopy in Node class

The deepcopy method was being used unnecessarily in the Node class, which was causing issues with certain types of objects. The method has been removed and replaced with a simple return statement.
This commit is contained in:
Gabriel Almeida 2023-05-30 16:09:13 -03:00
commit 588f0da625

View file

@ -212,19 +212,7 @@ class Node:
if not self._built or force:
self._build()
#! Deepcopy is breaking for vectorstores
if self.base_type in [
"vectorstores",
"VectorStoreRouterAgent",
"VectorStoreAgent",
"VectorStoreInfo",
] or self.node_type in [
"VectorStoreInfo",
"VectorStoreRouterToolkit",
"SQLDatabase",
]:
return self._built_object
return deepcopy(self._built_object)
return self._built_object
def add_edge(self, edge: "Edge") -> None:
self.edges.append(edge)