Skip to content

Commit 51582e1

Browse files
committed
docs: adding field descriptions to predefined text document
Signed-off-by: punndcoder28 <puneethk.2899@gmail.com>
1 parent 3dc525f commit 51582e1

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

docarray/documents/text.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from typing import Any, Optional, Type, TypeVar, Union
22

3+
from pydantic import Field
4+
35
from docarray.base_doc import BaseDoc
46
from docarray.typing import TextUrl
57
from docarray.typing.tensor.embedding import AnyEmbedding
@@ -102,10 +104,26 @@ class MultiModalDoc(BaseDoc):
102104
103105
"""
104106

105-
text: Optional[str]
106-
url: Optional[TextUrl]
107-
embedding: Optional[AnyEmbedding]
108-
bytes_: Optional[bytes]
107+
text: Optional[str] = Field(
108+
description='The text content stored in the document',
109+
example='This is an example text content of the document',
110+
)
111+
url: Optional[TextUrl] = Field(
112+
description='''The url of the text content. When text content is too long
113+
to be stored inline or in a file, the remote url can be used to load the
114+
text content''',
115+
example='https://www.w3.org/History/19921103-hypertext/hypertext/README.html',
116+
)
117+
embedding: Optional[AnyEmbedding] = Field(
118+
description='''Embedding field is used to store tensor objects of type
119+
Tensorflow, PyTorch, and NumPy''',
120+
example='''np.zeros((3, 64, 64))''',
121+
)
122+
bytes_: Optional[bytes] = Field(
123+
description='''The bytes of image or video content that can be loaded
124+
into an image or video tensor object''',
125+
example='',
126+
)
109127

110128
def __init__(self, text: Optional[str] = None, **kwargs):
111129
if 'text' not in kwargs:

0 commit comments

Comments
 (0)