fix: handle missing __validators__ (#68)
https://github.com/jina-ai/vectordb/issues/67 Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
This commit is contained in:
parent
53cd4a54d8
commit
f0200e5872
|
@ -15,7 +15,8 @@ def create_output_doc_type(input_doc_type: Type['BaseDoc']):
|
||||||
return create_model(
|
return create_model(
|
||||||
input_doc_type.__name__ + 'WithMatchesAndScores',
|
input_doc_type.__name__ + 'WithMatchesAndScores',
|
||||||
__base__=input_doc_type,
|
__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], []),
|
matches=(DocList[input_doc_type], []),
|
||||||
scores=(List[float], [])
|
scores=(List[float], [])
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue