New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(pydantic): add oneof validations for correct document creation #2146
Conversation
555ddf7
to
e3f8983
Compare
e3f8983
to
68be775
Compare
Latency summaryCurrent PR yields:
Breakdown
Backed by latency-tracking. Further commits will update this comment. |
Codecov Report
@@ Coverage Diff @@
## master #2146 +/- ##
==========================================
+ Coverage 90.38% 90.48% +0.10%
==========================================
Files 211 211
Lines 11199 11216 +17
==========================================
+ Hits 10122 10149 +27
+ Misses 1077 1067 -10
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Still missing scenario:
d = Document({'id': '123', 'hello': 'world', 'tags': {'good': 'bye'}})
assert d.id == '123' # true
assert d.tags['hello'] == 'world' # true
assert d.tags['good'] == 'bye' # true Pydantic model skips these key-value pairs, which means if the client's (frontend) json payload has additional key-value pairs, they wouldn't get passed to PROTO_TO_PYDANTIC_MODELS.DocumentProto(hello='world')
# DocumentProto(id='', content_hash='', granularity=0, adjacency=0, level_name='', parent_id='', chunks=[], weight=0.0, length=0, matches=[], mime_type='', uri='', tags={}, location=[], offset=0, embedding=None, score=None, modality='', evaluations=[]) |
This is done. |
Fixes #2132
Note: pydantic/pydantic#2504