🐛 fix(base.py): change variable names from source_handle and target_handle to _source_handle and _target_handle for better encapsulation and to avoid potential conflicts with class methods or properties

🔒 chore(base.py): add error logging for empty edge data to provide better debugging information
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-08-30 14:28:52 -03:00
commit af0ac6f2f6

View file

@ -39,11 +39,11 @@ class Edge:
else:
# Logging here because this is a breaking change
logger.error("Edge data is empty")
self.source_handle = edge.get("sourceHandle", "")
self.target_handle = edge.get("targetHandle", "")
self._source_handle = edge.get("sourceHandle", "")
self._target_handle = edge.get("targetHandle", "")
# 'BaseLoader;BaseOutputParser|documents|PromptTemplate-zmTlD'
# target_param is documents
self.target_param = self.target_handle.split("|")[1]
self.target_param = self._target_handle.split("|")[1]
# Validate in __init__ to fail fast
self.validate_edge()