🚀 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:
parent
86bbdb0c30
commit
ee2278c37e
1 changed files with 2 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue