langflow/tests/data/component_multiple_outputs.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

20 lines
728 B
Python

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) -> str:
return f"This is my string input: {self.input}"
def other_output(self) -> int:
return f"This is my int input multiplied by 2: {self.number * 2}"