@dataclass(frozen=True)
class Result:
id: str
name: str
docstring: ResultDocstring
function_id: str | None = None
@staticmethod
def from_dict(d: dict[str, Any], function_id: str | None = None) -> Result:
return Result(
d["id"],
d["name"],
ResultDocstring.from_dict(d.get("docstring", {})),
function_id,
)
def to_dict(self) -> dict[str, Any]:
return {"id": self.id, "name": self.name, "docstring": self.docstring.to_dict()}