🔧 chore(constants.py): clean up import statements and remove unnecessary whitespace to improve code readability

🐛 fix(custom_component.py): set the type of argument to "Data" if it is not specified to ensure consistency and prevent errors
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-10-12 19:23:45 -03:00
commit 7bdf564170
2 changed files with 24 additions and 4 deletions

View file

@ -1,15 +1,33 @@
DEFAULT_CUSTOM_COMPONENT_CODE = """from langflow import CustomComponent
from langflow.field_typing import *
from langflow.field_typing import (
Tool,
PromptTemplate,
Chain,
BaseChatMemory,
BaseLLM,
BaseLoader,
BaseMemory,
BaseOutputParser,
BaseRetriever,
VectorStore,
Embeddings,
TextSplitter,
Document,
AgentExecutor,
NestedDict,
Data,
)
class Component(CustomComponent):
display_name: str = "Custom Component"
description: str = "Create any custom component you want!"
def build_config(self):
return { "param": { "display_name": "Parameter" } }
return {"param": {"display_name": "Parameter"}}
def build(self, param: Data) -> Data:
return params
return param
"""

View file

@ -108,7 +108,9 @@ class CustomComponent(Component, extra=Extra.allow):
),
},
)
# TODO arg type should be Data if it is None
elif not arg.get("type"):
# Set the type to Data
arg["type"] = "Data"
return args
@property