Skip to content

Commit

Permalink
bump pydantic to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
bukosabino committed Sep 29, 2023
1 parent 7143990 commit 02f9097
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
10 changes: 6 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
PyYAML==6.0

fastapi==0.97.0
fastapi==0.103.2
uvicorn==0.22.0

requests==2.31.0
beautifulsoup4==4.12.2
lxml==4.9.2
pydantic==1.10.10
pydantic==2.4.2

retry==0.9.2

langchain==0.0.285
qdrant-client==1.5.0
langchain==0.0.305
# langchainplus-sdk==0.0.20
langsmith==0.0.41
qdrant-client==1.5.4
supabase==1.0.2
pinecone-client==2.2.2
sentence_transformers==2.2.2
Expand Down
11 changes: 7 additions & 4 deletions src/etls/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from langchain.docstore.document import Document
from langchain.document_loaders.base import BaseLoader
from pydantic import BaseModel, validator
from pydantic import field_validator, BaseModel


@dataclass
Expand Down Expand Up @@ -65,15 +65,18 @@ class BOEMetadataDocument(BaseModel):

datetime_insert: str = datetime.utcnow().isoformat()

@validator("ref_posteriores")
@field_validator("ref_posteriores")
@classmethod
def ref_posteriores_to_json(cls, validators):
return [v.json() for v in validators]

@validator("ref_anteriores")
@field_validator("ref_anteriores")
@classmethod
def ref_anteriores_to_json(cls, validators):
return [v.json() for v in validators]

@validator("fecha_publicacion", "fecha_disposicion")
@field_validator("fecha_publicacion", "fecha_disposicion")
@classmethod
def isoformat(cls, v):
if v:
return datetime.strptime(v, '%Y%m%d').strftime('%Y-%m-%d')
Expand Down

0 comments on commit 02f9097

Please sign in to comment.