docarray.document.mixins.pydantic module#

class docarray.document.mixins.pydantic.PydanticMixin[source]#

Bases: object

Provide helper functions to convert to/from a Pydantic model

classmethod get_json_schema(indent=2)[source]#

Return a JSON Schema of Document class.

Return type

str

to_pydantic_model()[source]#

Convert a Document object into a Pydantic model.

Return type

PydanticDocument

classmethod from_pydantic_model(model)[source]#

Build a Document object from a Pydantic model

Parameters

model (BaseModel) – the pydantic data model object that represents a Document

Return type

T

Returns

a Document object