-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Description
Hey,
I've been loving kor so far (especially how it returns dicts with raw, errrors and validated data).
But is there some way to create your own "types" with validators with pydantic 2 e.g.:
PhoneNumber = Annotated[
str,
AfterValidator(lambda num: ''.join(x for x in num if x.isdigit())),
Field(
description="Phone number in E.164 format",
examples=["505505505"],
min_length=9,
max_length=9,
),
]
It would be quite useful for extraction tasks.
For now I've been kinda creating 2 models - 1 for kor which just gets strings, and 2nd to create more strict that validates the previous model, which is not ideal, but gets the job done.
Metadata
Metadata
Assignees
Labels
No labels