This commit adds the `MultipleOutputsComponent` class to the `CustomComponent` module. The `MultipleOutputsComponent` class defines multiple inputs and outputs for the component. The `inputs` field includes an input for a string and an input for a number. The `outputs` field includes an output for a certain output and an output for another output. This change enhances the functionality and flexibility of the `CustomComponent` module.
19 lines
688 B
Python
19 lines
688 B
Python
from langflow.custom import CustomComponent
|
|
from langflow.template.field.base import Input, Output
|
|
|
|
|
|
class MultipleOutputsComponent(CustomComponent):
|
|
inputs = [
|
|
Input(display_name="Input", name="input", field_type=str),
|
|
Input(display_name="Number", name="number", field_type=int),
|
|
]
|
|
outputs = [
|
|
Output(display_name="Certain Output", method="certain_output", name="certain_output"),
|
|
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}"
|