style: remove comments
This commit is contained in:
parent
a788d93682
commit
228c04280d
1 changed files with 6 additions and 7 deletions
|
|
@ -14,9 +14,6 @@ class Node:
|
||||||
|
|
||||||
def _parse_data(self) -> None:
|
def _parse_data(self) -> None:
|
||||||
self.data = self._data["data"]
|
self.data = self._data["data"]
|
||||||
# Data dict:
|
|
||||||
# {'type': 'LLMChain', 'node': {'template': {'_type': 'llm_chain', 'memory': {'type': 'BaseMemory', 'required': False, 'placeholder': '', 'list': False, 'show': True, 'password': False, 'multiline': False, 'value': None}, 'verbose': {'type': 'bool', 'required': False, 'placeholder': '', 'list': False, 'show': False, 'password': False, 'multiline': False, 'value': False}, 'prompt': {'type': 'BasePromptTemplate', 'required': True, 'placeholder': '', 'list': False, 'show': True, 'password': False, 'multiline': False}, 'llm': {'type': 'BaseLanguageModel', 'required': True, 'placeholder': '', 'list': False, 'show': True, 'password': False, 'multiline': False}, 'output_key': {'type': 'str', 'required': False, 'placeholder': '', 'list': False, 'show': False, 'password': True, 'multiline': False, 'value': 'text'}}, 'description': 'Chain to run queries against LLMs.', 'base_classes': ['Chain']}, 'id': 'dndnode_1', 'value': None}
|
|
||||||
# base_classes are the classes that the node can be cast to
|
|
||||||
self.output = self.data["node"]["base_classes"]
|
self.output = self.data["node"]["base_classes"]
|
||||||
template_dicts = {
|
template_dicts = {
|
||||||
key: value
|
key: value
|
||||||
|
|
@ -80,8 +77,9 @@ class Node:
|
||||||
# so we need to append to a list if it exists
|
# so we need to append to a list if it exists
|
||||||
# or create a new list if it doesn't
|
# or create a new list if it doesn't
|
||||||
if edge is None and value["required"]:
|
if edge is None and value["required"]:
|
||||||
|
# break line
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Required input {key} for module {self.node_type} is not connected"
|
f"Required input {key} for module {self.node_type} not found"
|
||||||
)
|
)
|
||||||
if value["list"]:
|
if value["list"]:
|
||||||
if key in params:
|
if key in params:
|
||||||
|
|
@ -159,11 +157,12 @@ class Edge:
|
||||||
self.validate_edge()
|
self.validate_edge()
|
||||||
|
|
||||||
def validate_edge(self) -> None:
|
def validate_edge(self) -> None:
|
||||||
# Validate that the outputs of the source node are valid inputs for the target node
|
# Validate that the outputs of the source node are valid inputs
|
||||||
|
# for the target node
|
||||||
self.source_types = self.source.output
|
self.source_types = self.source.output
|
||||||
self.target_reqs = self.target.required_inputs + self.target.optional_inputs
|
self.target_reqs = self.target.required_inputs + self.target.optional_inputs
|
||||||
# Both lists contain strings and sometimes a string contains the value we are looking for
|
# Both lists contain strings and sometimes a string contains the value we are
|
||||||
# e.g. comgin_out=["Chain"] and target_reqs=["LLMChain"]
|
# looking for e.g. comgin_out=["Chain"] and target_reqs=["LLMChain"]
|
||||||
# so we need to check if any of the strings in source_types is in target_reqs
|
# so we need to check if any of the strings in source_types is in target_reqs
|
||||||
self.valid = any(
|
self.valid = any(
|
||||||
output in target_req
|
output in target_req
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue