morpheus_llm.service.vdb.milvus_vector_db_service.FieldSchemaEncoder#

class FieldSchemaEncoder(
*,
skipkeys=False,
ensure_ascii=True,
check_circular=True,
allow_nan=True,
sort_keys=False,
indent=None,
separators=None,
default=None,
)[source]#

Bases: JSONEncoder

Methods

default(o)

Serialize objects to a JSON-compatible string format.

dump(field, f)

Serialize a FieldSchema object to a JSON file.

dumps(field)

Serialize a FieldSchema object to a JSON-compatible string format.

encode(o)

Return a JSON string representation of a Python data structure.

from_dict(field)

Convert a dictionary to a FieldSchema object.

iterencode(o[, _one_shot])

Encode the given object and yield each string representation as available.

load(f_obj)

Deserialize a JSON file to a FieldSchema object.

loads(field)

Deserialize a JSON-compatible string to a FieldSchema object.

object_hook(obj)

Updated dictionary with pymilvus datatype.

default(o)[source]#

Serialize objects to a JSON-compatible string format.

Parameters:
otyping.Any

Object to be serialized.

Returns:
str

JSON-compatible string format of the object.

static dump(field, f)[source]#

Serialize a FieldSchema object to a JSON file.

Parameters:
fieldpymilvus.FieldSchema

FieldSchema object to be serialized.

ftyping.IO

File-like object to which the data is serialized.

Returns:
str

JSON string.

static dumps(field)[source]#

Serialize a FieldSchema object to a JSON-compatible string format.

Parameters:
fieldpymilvus.FieldSchema

FieldSchema object to be serialized.

Returns:
str

JSON-compatible string format of the FieldSchema object.

encode(o)[source]#

Return a JSON string representation of a Python data structure.

>>> from json.encoder import JSONEncoder
>>> JSONEncoder().encode({"foo": ["bar", "baz"]})
'{"foo": ["bar", "baz"]}'
static from_dict(field)[source]#

Convert a dictionary to a FieldSchema object.

Parameters:
fielddict

Dictionary to be converted to a FieldSchema object.

Returns:
pymilvus.FieldSchema

Converted FieldSchema object.

iterencode(o, _one_shot=False)[source]#

Encode the given object and yield each string representation as available.

For example:

for chunk in JSONEncoder().iterencode(bigobject):
    mysocket.write(chunk)
static load(f_obj)[source]#

Deserialize a JSON file to a FieldSchema object.

Parameters:
f_objtyping.IO

File-like object from which the data is deserialized.

Returns:
pymilvus.FieldSchema

Deserialized FieldSchema object.

static loads(field)[source]#

Deserialize a JSON-compatible string to a FieldSchema object.

Parameters:
fieldstr

JSON-compatible string to be deserialized.

Returns:
pymilvus.FieldSchema

Deserialized FieldSchema object.

static object_hook(obj)[source]#

Updated dictionary with pymilvus datatype.

Parameters:
objdict

Dictionary to be converted.

Returns:
dict

Dictionary with changes to its original format.