fix(langflow): return None when a node is not loaded in LangChainTypeCreator classes
This commit is contained in:
parent
319ff6ab3a
commit
ce542e9337
12 changed files with 12 additions and 1 deletions
|
|
@ -34,6 +34,7 @@ class AgentCreator(LangChainTypeCreator):
|
|||
raise ValueError("Agent not found") from exc
|
||||
except AttributeError as exc:
|
||||
logger.error(f"Agent {name} not loaded: {exc}")
|
||||
return None
|
||||
|
||||
# Now this is a generator
|
||||
def to_list(self) -> List[str]:
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class LangChainTypeCreator(BaseModel, ABC):
|
|||
signature = self.get_signature(name)
|
||||
if signature is None:
|
||||
logger.error(f"Node {name} not loaded")
|
||||
return
|
||||
return None
|
||||
if isinstance(signature, FrontendNode):
|
||||
return signature
|
||||
fields = [
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ class ChainCreator(LangChainTypeCreator):
|
|||
raise ValueError("Chain not found") from exc
|
||||
except AttributeError as exc:
|
||||
logger.error(f"Chain {name} not loaded: {exc}")
|
||||
return None
|
||||
|
||||
def to_list(self) -> List[str]:
|
||||
custom_chains = list(get_custom_nodes("chains").keys())
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ class DocumentLoaderCreator(LangChainTypeCreator):
|
|||
raise ValueError(f"Documment Loader {name} not found") from exc
|
||||
except AttributeError as exc:
|
||||
logger.error(f"Documment Loader {name} not loaded: {exc}")
|
||||
return None
|
||||
|
||||
def to_list(self) -> List[str]:
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ class EmbeddingCreator(LangChainTypeCreator):
|
|||
|
||||
except AttributeError as exc:
|
||||
logger.error(f"Embedding {name} not loaded: {exc}")
|
||||
return None
|
||||
|
||||
def to_list(self) -> List[str]:
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ class LLMCreator(LangChainTypeCreator):
|
|||
|
||||
except AttributeError as exc:
|
||||
logger.error(f"LLM {name} not loaded: {exc}")
|
||||
return None
|
||||
|
||||
def to_list(self) -> List[str]:
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ class MemoryCreator(LangChainTypeCreator):
|
|||
raise ValueError("Memory not found") from exc
|
||||
except AttributeError as exc:
|
||||
logger.error(f"Memory {name} not loaded: {exc}")
|
||||
return None
|
||||
|
||||
def to_list(self) -> List[str]:
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ class PromptCreator(LangChainTypeCreator):
|
|||
logger.error(f"Prompt {name} not found: {exc}")
|
||||
except AttributeError as exc:
|
||||
logger.error(f"Prompt {name} not loaded: {exc}")
|
||||
return None
|
||||
|
||||
def to_list(self) -> List[str]:
|
||||
custom_prompts = get_custom_nodes("prompts")
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ class TextSplitterCreator(LangChainTypeCreator):
|
|||
raise ValueError(f"Text Splitter {name} not found") from exc
|
||||
except AttributeError as exc:
|
||||
logger.error(f"Text Splitter {name} not loaded: {exc}")
|
||||
return None
|
||||
|
||||
def to_list(self) -> List[str]:
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ class ToolkitCreator(LangChainTypeCreator):
|
|||
raise ValueError("Prompt not found") from exc
|
||||
except AttributeError as exc:
|
||||
logger.error(f"Prompt {name} not loaded: {exc}")
|
||||
return None
|
||||
|
||||
def to_list(self) -> List[str]:
|
||||
return list(self.type_to_loader_dict.keys())
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ class VectorstoreCreator(LangChainTypeCreator):
|
|||
raise ValueError(f"Vector Store {name} not found") from exc
|
||||
except AttributeError as exc:
|
||||
logger.error(f"Vector Store {name} not loaded: {exc}")
|
||||
return None
|
||||
|
||||
def to_list(self) -> List[str]:
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ class WrapperCreator(LangChainTypeCreator):
|
|||
raise ValueError("Wrapper not found") from exc
|
||||
except AttributeError as exc:
|
||||
logger.error(f"Wrapper {name} not loaded: {exc}")
|
||||
return None
|
||||
|
||||
def to_list(self) -> List[str]:
|
||||
return list(self.type_to_loader_dict.keys())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue