Repository: Significant-Gravitas/Auto-GPT
File: autogpt_platform/backend/backend/blocks/basic.py (Python)

Code before:
            id="c0a8e994-ebf1-4a9c-a4d8-89d09c86741b",
            description="This block is used to provide input to the graph.",
            input_schema=AgentInputBlock.Input,
            output_schema=AgentInputBlock.Output,
            test_input=[
                {
                    "value": "Hello, World!",
                    "name": "input_1",
                    "description": "This is a test input.",
                    "placeholder_values": [],
                    "limit_to_placeholder_values": False,
                },
                {
                    "value": "Hello, World!",
                    "name": "input_2",
                    "description": "This is a test input.",
                    "placeholder_values": ["Hello, World!"],
                    "limit_to_placeholder_values": True,
                },
            ],
            test_output=[
                ("result", "Hello, World!"),
                ("result", "Hello, World!"),
            ],
            categories={BlockCategory.INPUT, BlockCategory.BASIC},
            block_type=BlockType.INPUT,
        )

    def run(self, input_data: Input) -> BlockOutput:
        yield "result", input_data.value


class AgentOutputBlock(Block):
    """
    Records the output of the graph for users to see.

    Attributes:
        recorded_value: The value to be recorded as output.
        name: The name of the output.
        description: The description of the output.
        fmt_string: The format string to be used to format the recorded_value.

    Outputs:
        output: The formatted recorded_value if fmt_string is provided and the recorded_value
                can be formatted, otherwise the raw recorded_value.

    Behavior:
        If fmt_string is provided and the recorded_value is of a type that can be formatted,
        the block attempts to format the recorded_value using the fmt_string.
        If formatting fails or no fmt_string is provided, the raw recorded_value is output.
    """

Review comment (suggestion):
I'm repurposing `BlockUIType` to generic `BlockType`. So we can use it for other means not specific for UI on the backend.

Code after:
            id="c0a8e994-ebf1-4a9c-a4d8-89d09c86741b",
            description="This block is used to provide input to the graph.",
            input_schema=AgentInputBlock.Input,
            output_schema=AgentInputBlock.Output,
            test_input=[
                {
                    "value": "Hello, World!",
                    "name": "input_1",
                    "description": "This is a test input.",
                    "placeholder_values": [],
                    "limit_to_placeholder_values": False,
                },
                {
                    "value": "Hello, World!",
                    "name": "input_2",
                    "description": "This is a test input.",
                    "placeholder_values": ["Hello, World!"],
                    "limit_to_placeholder_values": True,
                },
            ],
            test_output=[
                ("result", "Hello, World!"),
                ("result", "Hello, World!"),
            ],
            categories={BlockCategory.INPUT, BlockCategory.BASIC},
            block_type=BlockType.INPUT,
        )

    def run(self, input_data: Input, **kwargs) -> BlockOutput:
        yield "result", input_data.value


class AgentOutputBlock(Block):
    """
    Records the output of the graph for users to see.

    Attributes:
        recorded_value: The value to be recorded as output.
        name: The name of the output.
        description: The description of the output.
        fmt_string: The format string to be used to format the recorded_value.

    Outputs:
        output: The formatted recorded_value if fmt_string is provided and the recorded_value
                can be formatted, otherwise the raw recorded_value.

    Behavior:
        If fmt_string is provided and the recorded_value is of a type that can be formatted,
        the block attempts to format the recorded_value using the fmt_string.
        If formatting fails or no fmt_string is provided, the raw recorded_value is output.
    """