now.utils.docarray.helpers module#
- now.utils.docarray.helpers.docarray_typing_to_modality_string(T)[source]#
E.g. docarray.typing.Image -> image
- Return type
str
- now.utils.docarray.helpers.modality_string_to_docarray_typing(s)[source]#
E.g. image -> docarray.typing.Image
- Return type
TypeVar
- now.utils.docarray.helpers.get_chunk_by_field_name(doc, field_name)[source]#
Gets a specific chunk by field name, using its position instead of getting the attribute directly. This solves the getattr problem when there are conflicting attributes with Document. :param doc: Document to get the chunk from. :param field_name: Field needed to extract the position. :return: Specific chunk by field.