|
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,25 @@ class MultiModalDoc(BaseDoc): |
102 | 104 |
|
103 | 105 | """ |
104 | 106 |
|
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 | + ) |
109 | 126 |
|
110 | 127 | def __init__(self, text: Optional[str] = None, **kwargs): |
111 | 128 | if 'text' not in kwargs: |
|
0 commit comments