When dict hasmax_length or dim{'name': 'error_message', 'type': <DataType.VARCHAR: 21>, 'max_length': 1024}a_dict={'name': 'error_msg_vector', 'type': <DataType.FLOAT_VECTOR: 101>, 'dim': 768}
When I new FieldSchema.construct_from_dict(a_dict), got
TypeError: pymilvus.orm.schema.FieldSchema() got multiple values for keyword argument 'max_length'
and
pymilvus.exceptions.MilvusException: <MilvusException: (code=65535, message=dimension is not defined in field type params, check type paramdimfor vector field)>
Expected Behavior
When I new FieldSchema.construct_from_dict(a_dict) no error.
add below code at pymilvus/orm/schema.py can fix it.
within def construct_from_dict(cls, raw: Dict):
371 if raw.get("max_length") is not None:
372 kwargs["max_length"] = raw.get("max_length")
373 if raw.get("dim") is not None:
374 kwargs["dim"] = raw.get("dim")
Is there an existing issue for this?
Describe the bug
When dict has
max_length
ordim
{'name': 'error_message', 'type': <DataType.VARCHAR: 21>, 'max_length': 1024}
a_dict={'name': 'error_msg_vector', 'type': <DataType.FLOAT_VECTOR: 101>, 'dim': 768}
When I newFieldSchema.construct_from_dict(a_dict)
, gotTypeError: pymilvus.orm.schema.FieldSchema() got multiple values for keyword argument 'max_length'
and
pymilvus.exceptions.MilvusException: <MilvusException: (code=65535, message=dimension is not defined in field type params, check type param
dimfor vector field)>
Expected Behavior
When I new
FieldSchema.construct_from_dict(a_dict)
no error.Steps/Code To Reproduce behavior
Environment details
Anything else?
add below code at pymilvus/orm/schema.py can fix it. within def construct_from_dict(cls, raw: Dict):