langflow/tests/data/component_nested_call.py
ogabrielluiz 98e3f4bdaa refactor: Update langflow custom components to use specific input classes
The code changes update the langflow custom components to use specific input classes, such as IntInput and TextInput, instead of the generic field types. This refactor improves the clarity and type safety of the code.
2024-06-18 22:41:10 -03:00

22 lines
702 B
Python

from random import randint
from langflow.custom import Component
from langflow.inputs.inputs import IntInput, TextInput
from langflow.template.field.base import Output
class MultipleOutputsComponent(Component):
inputs = [
TextInput(display_name="Input", name="input"),
IntInput(display_name="Number", name="number"),
]
outputs = [
Output(display_name="Certain Output", name="certain_output", method="certain_output"),
Output(display_name="Other Output", name="other_output", method="other_output"),
]
def certain_output(self) -> int:
return randint(0, self.number)
def other_output(self) -> int:
return self.certain_output()