|
1 | 1 | from typing import Any, Optional, Type, TypeVar, Union
|
2 | 2 |
|
| 3 | +from pydantic import Field |
| 4 | + |
3 | 5 | from docarray.base_doc import BaseDoc
|
4 | 6 | from docarray.typing import TextUrl
|
5 | 7 | from docarray.typing.tensor.embedding import AnyEmbedding
|
@@ -102,10 +104,26 @@ class MultiModalDoc(BaseDoc):
|
102 | 104 |
|
103 | 105 | """
|
104 | 106 |
|
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 | + ) |
109 | 127 |
|
110 | 128 | def __init__(self, text: Optional[str] = None, **kwargs):
|
111 | 129 | if 'text' not in kwargs:
|
|
0 commit comments