from pydantic import BaseModel from enum import Enum from typing import Optional FunctionStatus = Enum("FunctionStatus", ["SUCCESS", "FAILED"]) class FunctionResponse(BaseModel): name: str status: FunctionStatus message: str = "" args: Optional[dict] = None def __init__(self, name: str, status: FunctionStatus, message: str = "", args: Optional[dict] = None): super().__init__(name=name, status=status, message=message, args=args) def to_dict(self): return self.model_dump() def to_json(self): return self.model_dump_json() def to_string(self): return self.model_dump_json()