🛠️ Commands
class CommandProvider(Protocol):
def get_commands(self) -> Iterator[Command]:
...Command Decorator
Command DecoratorExample Usage of Command Decorator¶
Command Decorator¶# Assuming this is inside some component class
@command(
parameters={
"a": JSONSchema(
type=JSONSchema.Type.INTEGER,
description="The first number",
required=True,
),
"b": JSONSchema(
type=JSONSchema.Type.INTEGER,
description="The second number",
required=True,
)})
def multiply(self, a: int, b: int) -> str:
"""
Multiplies two numbers.
Args:
a: First number
b: Second number
Returns:
Result of multiplication
"""
return str(a * b)Creating Command Directly¶
Command Directly¶Last updated
Was this helpful?