🚀 feat(base.py): add pydantic BaseModel as a base class for FieldFormatter to enable data validation and serialization

The FieldFormatter class now inherits from pydantic.BaseModel in addition to ABC (Abstract Base Class). This change allows FieldFormatter instances to benefit from the data validation and serialization capabilities provided by pydantic, improving the reliability and maintainability of the code.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-07-06 17:11:05 -03:00
commit ee2278c37e

View file

@ -2,9 +2,10 @@ from abc import ABC, abstractmethod
from typing import Optional
from langflow.template.field.base import TemplateField
from pydantic import BaseModel
class FieldFormatter(ABC):
class FieldFormatter(BaseModel, ABC):
@abstractmethod
def format(self, field: TemplateField, name: Optional[str]) -> None:
pass