Skip to content

Commit 68cc142

Browse files
authored
docs: adding field descriptions to predefined text document (docarray#1770)
Signed-off-by: punndcoder28 <puneethk.2899@gmail.com>
1 parent 441db26 commit 68cc142

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

docarray/documents/text.py

Lines changed: 21 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,25 @@ class MultiModalDoc(BaseDoc):
102104
103105
"""
104106

105-
text: Optional[str] = None
106-
url: Optional[TextUrl] = None
107-
embedding: Optional[AnyEmbedding] = None
108-
bytes_: Optional[bytes] = None
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+
default=None,
111+
)
112+
url: Optional[TextUrl] = Field(
113+
description='URL to a (potentially remote) text file that can be loaded',
114+
example='https://www.w3.org/History/19921103-hypertext/hypertext/README.html',
115+
default=None,
116+
)
117+
embedding: Optional[AnyEmbedding] = Field(
118+
description='Store an embedding: a vector representation of the text',
119+
example=[1, 0, 1],
120+
default=None,
121+
)
122+
bytes_: Optional[bytes] = Field(
123+
description='Bytes representation of the text',
124+
default=None,
125+
)
109126

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

0 commit comments

Comments
 (0)