caikit.interfaces.common.data_model =================================== .. py:module:: caikit.interfaces.common.data_model .. autoapi-nested-parse:: Domain agnostic data model objects Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/caikit/interfaces/common/data_model/file/index /autoapi/caikit/interfaces/common/data_model/primitive_sequences/index /autoapi/caikit/interfaces/common/data_model/producer/index /autoapi/caikit/interfaces/common/data_model/remote/index /autoapi/caikit/interfaces/common/data_model/stream_sources/index /autoapi/caikit/interfaces/common/data_model/vectors/index Classes ------- .. autoapisummary:: caikit.interfaces.common.data_model.File caikit.interfaces.common.data_model.BoolSequence caikit.interfaces.common.data_model.FloatSequence caikit.interfaces.common.data_model.IntSequence caikit.interfaces.common.data_model.Sequence caikit.interfaces.common.data_model.StrSequence caikit.interfaces.common.data_model.ProducerId caikit.interfaces.common.data_model.ConnectionInfo caikit.interfaces.common.data_model.ConnectionTlsInfo caikit.interfaces.common.data_model.FileReference caikit.interfaces.common.data_model.ListOfFileReferences caikit.interfaces.common.data_model.ListOfVector1D caikit.interfaces.common.data_model.NpFloat32Sequence caikit.interfaces.common.data_model.NpFloat64Sequence caikit.interfaces.common.data_model.PyFloatSequence caikit.interfaces.common.data_model.Vector1D Package Contents ---------------- .. py:class:: File Bases: :py:obj:`caikit.core.data_model.DataObjectBase` A DataObject is a data model class that is backed by a @dataclass. Data model classes that use the @dataobject decorator must derive from this base class. .. py:attribute:: data :type: py_to_proto.dataclass_to_proto.Annotated[bytes, FieldNumber(1)] .. py:attribute:: filename :type: py_to_proto.dataclass_to_proto.Annotated[Optional[str], FieldNumber(2)] .. py:attribute:: type :type: py_to_proto.dataclass_to_proto.Annotated[Optional[str], FieldNumber(3)] .. py:class:: BoolSequence Bases: :py:obj:`Sequence` Base class for all Sequences to enable type checking e.g. isinstance(<>, Sequence) .. py:attribute:: values :type: py_to_proto.dataclass_to_proto.Annotated[List[bool], FieldNumber(1)] .. py:class:: FloatSequence Bases: :py:obj:`Sequence` Base class for all Sequences to enable type checking e.g. isinstance(<>, Sequence) .. py:attribute:: values :type: py_to_proto.dataclass_to_proto.Annotated[List[float], FieldNumber(1)] .. py:class:: IntSequence Bases: :py:obj:`Sequence` Base class for all Sequences to enable type checking e.g. isinstance(<>, Sequence) .. py:attribute:: values :type: py_to_proto.dataclass_to_proto.Annotated[List[int], FieldNumber(1)] .. py:class:: Sequence Bases: :py:obj:`caikit.core.data_model.DataObjectBase` Base class for all Sequences to enable type checking e.g. isinstance(<>, Sequence) .. py:attribute:: values :type: List[Any] .. py:class:: StrSequence Bases: :py:obj:`Sequence` Base class for all Sequences to enable type checking e.g. isinstance(<>, Sequence) .. py:attribute:: values :type: py_to_proto.dataclass_to_proto.Annotated[List[str], FieldNumber(1)] .. py:class:: ProducerId Bases: :py:obj:`caikit.core.data_model.dataobject.DataObjectBase` Information about a data structure and the module that produced it. .. py:attribute:: name :type: str .. py:attribute:: version :type: str .. py:method:: __add__(other) Add two producer ids. .. py:method:: from_proto(proto) :classmethod: Overloaded implementation for efficiency vs base introspection .. py:method:: fill_proto(proto) Overloaded implementation for efficiency vs base introspection .. py:class:: ConnectionInfo Bases: :py:obj:`caikit.core.data_model.DataObjectBase` DataClass to store information regarding an external connection. This includes the hostname, port, tls, and timeout settings .. py:attribute:: hostname :type: str .. py:attribute:: port :type: Optional[int] :value: None .. py:attribute:: tls :type: Optional[ConnectionTlsInfo] .. py:attribute:: timeout :type: Optional[int] :value: 60 .. py:attribute:: options :type: Optional[caikit.core.data_model.json_dict.JsonDict] .. py:attribute:: retries :type: Optional[int] :value: 1 .. py:attribute:: retry_options :type: Optional[caikit.core.data_model.json_dict.JsonDict] .. py:attribute:: max_session_age :type: Union[float, int] :value: -1 .. py:method:: __post_init__() Post init function to verify field types and set defaults .. py:class:: ConnectionTlsInfo Bases: :py:obj:`caikit.core.data_model.DataObjectBase` Helper dataclass to store information regarding TLS information. .. py:attribute:: enabled :type: bool :value: False .. py:attribute:: insecure_verify :type: bool :value: False .. py:attribute:: ca_file :type: Optional[str] .. py:attribute:: cert_file :type: Optional[str] .. py:attribute:: key_file :type: Optional[str] .. py:property:: mtls_enabled :type: bool Helper property to identify if mtls is enabled .. py:attribute:: _private_slots :value: ('_ca_data', '_cert_data', '_key_data') .. py:property:: ca_data :type: Optional[bytes] .. py:property:: key_data :type: Optional[bytes] .. py:property:: cert_data :type: Optional[bytes] .. py:method:: __post_init__() Post init function to verify field types and arguments .. py:method:: verify_ssl_data() Helper function to verify all TLS data was read correctly. Raises: FileNotFoundError: If any of the tls files were provided but could not be found .. py:class:: FileReference Bases: :py:obj:`caikit.core.data_model.DataObjectBase` A DataObject is a data model class that is backed by a @dataclass. Data model classes that use the @dataobject decorator must derive from this base class. .. py:attribute:: filename :type: py_to_proto.dataclass_to_proto.Annotated[str, FieldNumber(1)] .. py:class:: ListOfFileReferences Bases: :py:obj:`caikit.core.data_model.DataObjectBase` A DataObject is a data model class that is backed by a @dataclass. Data model classes that use the @dataobject decorator must derive from this base class. .. py:attribute:: files :type: py_to_proto.dataclass_to_proto.Annotated[List[str], FieldNumber(1)] .. py:class:: ListOfVector1D Bases: :py:obj:`caikit.core.DataObjectBase` Data representation for an embedding matrix holding 2D vectors .. py:attribute:: vectors :type: py_to_proto.dataclass_to_proto.Annotated[List[Vector1D], FieldNumber(1)] .. py:method:: __post_init__() .. py:method:: from_json(json_str: Union[Dict[str, Any], str]) -> ListOfVector1D :classmethod: Fill in the vector data in an appropriate data_ .. py:class:: NpFloat32Sequence Bases: :py:obj:`caikit.core.DataObjectBase` A DataObject is a data model class that is backed by a @dataclass. Data model classes that use the @dataobject decorator must derive from this base class. .. py:attribute:: values :type: py_to_proto.dataclass_to_proto.Annotated[List[numpy.float32], FieldNumber(1)] .. py:method:: from_proto(proto) :classmethod: Build a DataBase from protobufs. Args: proto: A protocol buffer to serialize from. Returns: protobufs: A DataBase object. .. py:class:: NpFloat64Sequence Bases: :py:obj:`caikit.core.DataObjectBase` A DataObject is a data model class that is backed by a @dataclass. Data model classes that use the @dataobject decorator must derive from this base class. .. py:attribute:: values :type: py_to_proto.dataclass_to_proto.Annotated[List[numpy.float64], FieldNumber(1)] .. py:method:: from_proto(proto) :classmethod: Build a DataBase from protobufs. Args: proto: A protocol buffer to serialize from. Returns: protobufs: A DataBase object. .. py:class:: PyFloatSequence Bases: :py:obj:`caikit.core.DataObjectBase` A DataObject is a data model class that is backed by a @dataclass. Data model classes that use the @dataobject decorator must derive from this base class. .. py:attribute:: values :type: py_to_proto.dataclass_to_proto.Annotated[List[float], FieldNumber(1)] :value: [] .. py:class:: Vector1D Bases: :py:obj:`caikit.core.DataObjectBase` Data representation for a 1 dimension vector of float-type data. .. py:attribute:: data :type: py_to_proto.dataclass_to_proto.Annotated[Union[PyFloatSequence, NpFloat32Sequence, NpFloat64Sequence], FieldNumber(1)] .. py:method:: __post_init__() .. py:method:: from_vector(vector) :classmethod: .. py:method:: from_json(json_str: Union[Dict[str, Any], str]) -> Vector1D :classmethod: JSON does not have different float types. Move data into data_pyfloatsequence .. py:method:: to_dict() -> dict to_dict is needed to make things serializable .. py:method:: from_proto(proto) :classmethod: Wrap the data in an appropriate float sequence, wrapped by this class .. py:method:: fill_proto(proto) Fill in the data in an appropriate data_