diff --git a/mp_api/client/core/client.py b/mp_api/client/core/client.py index be864b6f..434a49e5 100644 --- a/mp_api/client/core/client.py +++ b/mp_api/client/core/client.py @@ -842,7 +842,7 @@ def _submit_request_and_process( data_model( **{ field: value - for field, value in raw_doc.model_dump().items() + for field, value in dict(raw_doc).items() if field in set_fields } ) @@ -876,9 +876,8 @@ def _submit_request_and_process( ) def _generate_returned_model(self, doc): - set_fields = [ - field for field, _ in doc if field in doc.model_dump(exclude_unset=True) - ] + set_fields = doc.model_fields_set + unset_fields = [field for field in doc.model_fields if field not in set_fields] data_model = create_model(