🔧 refactor(base.py): remove unnecessary condition in get_signature method
The condition `name in settings.<type>` is removed from the `get_signature` method in the `base.py` files of the `agents`, `chains`, `memories`, and `prompts` modules. This condition was unnecessary as it was already checked in the `get_custom_nodes` function. Removing this condition simplifies the code and improves readability.
This commit is contained in:
parent
116c600d95
commit
6675592737
4 changed files with 4 additions and 16 deletions
|
|
@ -32,10 +32,7 @@ class AgentCreator(LangChainTypeCreator):
|
|||
|
||||
def get_signature(self, name: str) -> Optional[Dict]:
|
||||
try:
|
||||
if (
|
||||
name in get_custom_nodes(self.type_name).keys()
|
||||
and name in settings.agents
|
||||
):
|
||||
if name in get_custom_nodes(self.type_name).keys():
|
||||
return get_custom_nodes(self.type_name)[name]
|
||||
elif name in self.from_method_nodes:
|
||||
return build_template_from_method(
|
||||
|
|
|
|||
|
|
@ -45,10 +45,7 @@ class ChainCreator(LangChainTypeCreator):
|
|||
|
||||
def get_signature(self, name: str) -> Optional[Dict]:
|
||||
try:
|
||||
if (
|
||||
name in get_custom_nodes(self.type_name).keys()
|
||||
and name in settings.chains
|
||||
):
|
||||
if name in get_custom_nodes(self.type_name).keys():
|
||||
return get_custom_nodes(self.type_name)[name]
|
||||
elif name in self.from_method_nodes.keys():
|
||||
return build_template_from_method(
|
||||
|
|
|
|||
|
|
@ -32,10 +32,7 @@ class MemoryCreator(LangChainTypeCreator):
|
|||
def get_signature(self, name: str) -> Optional[Dict]:
|
||||
"""Get the signature of a memory."""
|
||||
try:
|
||||
if (
|
||||
name in get_custom_nodes(self.type_name).keys()
|
||||
and name in settings.memories
|
||||
):
|
||||
if name in get_custom_nodes(self.type_name).keys():
|
||||
return get_custom_nodes(self.type_name)[name]
|
||||
elif name in self.from_method_nodes:
|
||||
return build_template_from_method(
|
||||
|
|
|
|||
|
|
@ -40,10 +40,7 @@ class PromptCreator(LangChainTypeCreator):
|
|||
|
||||
def get_signature(self, name: str) -> Optional[Dict]:
|
||||
try:
|
||||
if (
|
||||
name in get_custom_nodes(self.type_name).keys()
|
||||
and name in settings.prompts
|
||||
):
|
||||
if name in get_custom_nodes(self.type_name).keys():
|
||||
return get_custom_nodes(self.type_name)[name]
|
||||
return build_template_from_class(name, self.type_to_loader_dict)
|
||||
except ValueError as exc:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue