Skip to content

Commit 35d2138

Browse files
authored
docs: adding field descriptions to predefined audio document (docarray#1774)
Signed-off-by: punndcoder28 <[email protected]>
1 parent 715252a commit 35d2138

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

docarray/documents/audio.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import numpy as np
44

5+
from pydantic import Field
6+
57
from docarray.base_doc import BaseDoc
68
from docarray.typing import AnyEmbedding, AudioUrl
79
from docarray.typing.bytes.audio_bytes import AudioBytes
@@ -94,11 +96,29 @@ class MultiModalDoc(BaseDoc):
9496
```
9597
"""
9698

97-
url: Optional[AudioUrl] = None
98-
tensor: Optional[AudioTensor] = None
99-
embedding: Optional[AnyEmbedding] = None
100-
bytes_: Optional[AudioBytes] = None
101-
frame_rate: Optional[int] = None
99+
url: Optional[AudioUrl] = Field(
100+
description='The url to a (potentially remote) audio file that can be loaded',
101+
example='https://github.com/docarray/docarray/blob/main/tests/toydata/hello.mp3?raw=true',
102+
default=None,
103+
)
104+
tensor: Optional[AudioTensor] = Field(
105+
description='Tensor object of the audio which can be specified to one of `AudioNdArray`, `AudioTorchTensor`, `AudioTensorFlowTensor`',
106+
default=None,
107+
)
108+
embedding: Optional[AnyEmbedding] = Field(
109+
description='Store an embedding: a vector representation of the audio.',
110+
example=[0, 1, 0],
111+
default=None,
112+
)
113+
bytes_: Optional[AudioBytes] = Field(
114+
description='Bytes representation pf the audio',
115+
default=None,
116+
)
117+
frame_rate: Optional[int] = Field(
118+
description='An integer representing the frame rate of the audio.',
119+
example=24,
120+
default=None,
121+
)
102122

103123
@classmethod
104124
def validate(

0 commit comments

Comments
 (0)