Skip to content

Commit

Permalink
fix: handle missing __validators__ (#68)
Browse files Browse the repository at this point in the history
#67

Signed-off-by: Gabe Goodhart <[email protected]>
  • Loading branch information
gabe-l-hart committed Mar 4, 2024
1 parent 53cd4a5 commit f0200e5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vectordb/utils/create_doc_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def create_output_doc_type(input_doc_type: Type['BaseDoc']):
return create_model(
input_doc_type.__name__ + 'WithMatchesAndScores',
__base__=input_doc_type,
__validators__=input_doc_type.__validators__,
# NOTE: With pydantic>=2, __validators__ does not exist
__validators__=getattr(input_doc_type, "__validators__", None),
matches=(DocList[input_doc_type], []),
scores=(List[float], [])
)

0 comments on commit f0200e5

Please sign in to comment.