Document
is Jina's primitive data type. It can contain text, image, array, embedding, URI, and accompanied by rich meta information. It can be recurred both vertically and horizontally to have nested documents and matched documents. To construct a Document, one can use:
For a text document:
#Start by installing Jina in colab
!pip install jina
from jina import Document
doc1 = Document(content='hello world')
For a ndarray
document:
import numpy
doc2 = Document(content=numpy.random.random([10, 10]))
To make doc2
as a sub-document of doc1
doc1.chunks.append(doc2) # doc2 is now a sub-document of doc1