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

Code before:
                    "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},
            ui_type=BlockUIType.INPUT,
        )

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


class OutputBlock(InputOutputBlockBase[Any]):
    def __init__(self):
        super().__init__(
            categories={BlockCategory.OUTPUT, BlockCategory.BASIC},
            ui_type=BlockUIType.OUTPUT,
        )

    def block_id(self) -> str:
        return "363ae599-353e-4804-937e-b2ee3cef3da4"


class AddToDictionaryBlock(Block):
    class Input(BlockSchema):
        dictionary: dict | None = SchemaField(
            default=None,
            description="The dictionary to add the entry to. If not provided, a new dictionary will be created.",
            placeholder='{"key1": "value1", "key2": "value2"}',
        )
        key: str = SchemaField(
            description="The key for the new entry.", placeholder="new_key"
        )
        value: Any = SchemaField(
            description="The value for the new entry.", placeholder="new_value"
        )

    class Output(BlockSchema):
        updated_dictionary: dict = SchemaField(
            description="The dictionary with the new entry added."
        )
        error: str = SchemaField(description="Error message if the operation failed.")

    def __init__(self):
        super().__init__(

Review comment (suggestion):
This should not work, unless you are testing the exception catch.

Code after:
        fmt_string: str = SchemaField(
            description="The format string to be used to format the recorded_value."
        )

    class Output(BlockSchema):
        output: Any = SchemaField(description="The value recorded as output.")

    def __init__(self):
        super().__init__(
            id="363ae599-353e-4804-937e-b2ee3cef3da4",
            description=(
                "This block records the graph output. It takes a value to record, "
                "with a name, description, and optional format string. If a format "
                "string is given, it tries to format the recorded value. The "
                "formatted (or raw, if formatting fails) value is then output. "
                "This block is key for capturing and presenting final results or "
                "important intermediate outputs of the graph execution."
            ),
            input_schema=OutputBlock.Input,
            output_schema=OutputBlock.Output,
            test_input=[
                {
                    "recorded_value": "Hello, World!",
                    "name": "output_1",
                    "description": "This is a test output.",
                    "fmt_string": "{value}",
                },
                {
                    "recorded_value": 42,
                    "name": "output_2",
                    "description": "This is another test output.",
                    "fmt_string": "{value}",
                },
                {
                    "recorded_value": MockObject(value="!!", key="key"),
                    "name": "output_3",
                    "description": "This is a test output with a mock object.",
                    "fmt_string": "{value}",
                },
            ],
            test_output=[
                ("output", "Hello, World!"),
                ("output", 42),
                ("output", MockObject(value="!!", key="key")),
            ],
            categories={BlockCategory.OUTPUT, BlockCategory.BASIC},
            ui_type=BlockUIType.OUTPUT,
        )

    def run(self, input_data: Input) -> BlockOutput:
        """