feat: Add inputs and outputs to CustomComponent
This commit adds the `inputs` and `outputs` fields to the `CustomComponent` class in the `custom_component.py` file. The `inputs` field is of type `List[Input]` and the `outputs` field is of type `List[Output]`. This change allows for better organization and management of the component's input and output fields.
This commit is contained in:
parent
59126fa01a
commit
82fcdfb67a
1 changed files with 6 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ import yaml
|
||||||
from cachetools import TTLCache, cachedmethod
|
from cachetools import TTLCache, cachedmethod
|
||||||
from langchain_core.documents import Document
|
from langchain_core.documents import Document
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from langflow.custom.code_parser.utils import (
|
from langflow.custom.code_parser.utils import (
|
||||||
extract_inner_type_from_generic_alias,
|
extract_inner_type_from_generic_alias,
|
||||||
extract_union_types_from_generic_alias,
|
extract_union_types_from_generic_alias,
|
||||||
|
|
@ -17,6 +18,7 @@ from langflow.schema import Record
|
||||||
from langflow.schema.dotdict import dotdict
|
from langflow.schema.dotdict import dotdict
|
||||||
from langflow.services.deps import get_storage_service, get_variable_service, session_scope
|
from langflow.services.deps import get_storage_service, get_variable_service, session_scope
|
||||||
from langflow.services.storage.service import StorageService
|
from langflow.services.storage.service import StorageService
|
||||||
|
from langflow.template.field.base import Input, Output
|
||||||
from langflow.utils import validate
|
from langflow.utils import validate
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|
@ -78,6 +80,9 @@ class CustomComponent(Component):
|
||||||
"""The status of the component. This is displayed on the frontend. Defaults to None."""
|
"""The status of the component. This is displayed on the frontend. Defaults to None."""
|
||||||
_flows_records: Optional[List[Record]] = None
|
_flows_records: Optional[List[Record]] = None
|
||||||
|
|
||||||
|
inputs: Optional[List[Input]] = None
|
||||||
|
outputs: Optional[List[Output]] = None
|
||||||
|
|
||||||
def update_state(self, name: str, value: Any):
|
def update_state(self, name: str, value: Any):
|
||||||
if not self.vertex:
|
if not self.vertex:
|
||||||
raise ValueError("Vertex is not set")
|
raise ValueError("Vertex is not set")
|
||||||
|
|
@ -464,3 +469,4 @@ class CustomComponent(Component):
|
||||||
Any: The result of the build process.
|
Any: The result of the build process.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
raise NotImplementedError
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue