jina.types.request.data module

class jina.types.request.data.DataRequest(request=None)[source]

Bases: jina.types.request.Request

Represents a DataRequest used for exchanging DocumentArrays to and within a Flow

  • property is_decompressed: bool

    Checks if the underlying proto object was already deserialized

    • Return type

      bool

      Returns

      True if the proto was deserialized before

  • property proto: jina_pb2.DataRequestProto

    Cast self to a jina_pb2.DataRequestProto. Laziness will be broken and serialization will be recomputed when calling SerializeToString(). :rtype: DataRequestProto :return: protobuf instance

  • to_dict()[source]

    Return the object in Python dictionary.

    Note

    Array like object such as numpy.ndarray (i.e. anything described as jina_pb2.NdArrayProto) will be converted to Python list.

    • Return type

      Dict

      Returns

      dict representation of the object

  • property docs: docarray.array.document.DocumentArray

    Get the :class: DocumentArray with sequence data.docs as content.

  • data

    The decorator to cache property of a class.

  • property parameters: Dict

    Return the parameters field of this DataRequest as a Python dict :rtype: Dict :return: a Python dict view of the parameters.

  • property response

    Returns the response of this request.

    • Returns

      the response of this request (self) as an instance of Response

  • property status

    Returns the status from the header field

    • Returns

      the status object of this request

  • classmethod from_proto(request)[source]

    Creates a new DataRequest object from a given DataRequestProto object. :type request: DataRequestProto :param request: the to-be-copied data request :return: the new message object

class jina.types.request.data.Response(request=None)[source]

Bases: jina.types.request.data.DataRequest

Response is the Request object returns from the flow. Right now it shares the same representation as Request. At 0.8.12, Response is a simple alias. But it does give a more consistent semantic on the client API: send a Request and receive a Response.

Note

For now it only exposes Docs and GroundTruth. Users should very rarely access Control commands, so preferably not confuse the user by adding CommandMixin.