Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions docarray/documents/text.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from typing import Any, Optional, Type, TypeVar, Union

from pydantic import Field

from docarray.base_doc import BaseDoc
from docarray.typing import TextUrl
from docarray.typing.tensor.embedding import AnyEmbedding
Expand Down Expand Up @@ -102,10 +104,25 @@ class MultiModalDoc(BaseDoc):

"""

text: Optional[str] = None
url: Optional[TextUrl] = None
embedding: Optional[AnyEmbedding] = None
bytes_: Optional[bytes] = None
text: Optional[str] = Field(
description='The text content stored in the document',
example='This is an example text content of the document',
default=None,
)
url: Optional[TextUrl] = Field(
description='URL to a (potentially remote) text file that can be loaded',
example='https://www.w3.org/History/19921103-hypertext/hypertext/README.html',
default=None,
)
embedding: Optional[AnyEmbedding] = Field(
description='Store an embedding: a vector representation of the text',
example=[1, 0, 1],
default=None,
)
bytes_: Optional[bytes] = Field(
description='Bytes representation of the text',
default=None,
)

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