diff --git a/src/backend/langflow/components/toolkits/Metaphor.py b/src/backend/langflow/components/toolkits/Metaphor.py index aff949312..567071278 100644 --- a/src/backend/langflow/components/toolkits/Metaphor.py +++ b/src/backend/langflow/components/toolkits/Metaphor.py @@ -1,7 +1,7 @@ from typing import List, Union from langflow import CustomComponent -from metaphor_python import Metaphor +from metaphor_python import Metaphor # type: ignore from langchain.tools import Tool from langchain.agents import tool from langchain.agents.agent_toolkits.base import BaseToolkit @@ -48,4 +48,4 @@ class MetaphorToolkit(CustomComponent): """ return client.find_similar(url, num_results=5) - return [search, get_contents, find_similar] + return [search, get_contents, find_similar] # type: ignore diff --git a/src/backend/langflow/components/vectorstores/Vectara.py b/src/backend/langflow/components/vectorstores/Vectara.py index 6576d146d..6edc69822 100644 --- a/src/backend/langflow/components/vectorstores/Vectara.py +++ b/src/backend/langflow/components/vectorstores/Vectara.py @@ -34,9 +34,9 @@ class VectaraComponent(CustomComponent): documents: Optional[Document] = None, ) -> Union[VectorStore, BaseRetriever]: # If documents, then we need to create a Vectara instance using .from_documents - if documents: + if documents is not None and embedding is not None: return Vectara.from_documents( - documents=documents, + documents=documents, # type: ignore vectara_customer_id=vectara_customer_id, vectara_corpus_id=vectara_corpus_id, vectara_api_key=vectara_api_key, diff --git a/src/backend/langflow/interface/custom/custom_component.py b/src/backend/langflow/interface/custom/custom_component.py index 15a414050..d7dd280e6 100644 --- a/src/backend/langflow/interface/custom/custom_component.py +++ b/src/backend/langflow/interface/custom/custom_component.py @@ -92,9 +92,9 @@ class CustomComponent(Component, extra=Extra.allow): return build_method["args"] @property - def get_function_entrypoint_return_type(self) -> str: + def get_function_entrypoint_return_type(self) -> List[str]: if not self.code: - return "" + return [] tree = self.get_code_tree(self.code) component_classes = [ @@ -103,7 +103,7 @@ class CustomComponent(Component, extra=Extra.allow): if self.code_class_base_inheritance in cls["bases"] ] if not component_classes: - return "" + return [] # Assume the first Component class is the one we're interested in component_class = component_classes[0] @@ -114,7 +114,7 @@ class CustomComponent(Component, extra=Extra.allow): ] if not build_methods: - return "" + return [] build_method = build_methods[0] return_type = build_method["return_type"]