Skip to content

Commit f9a1871

Browse files
committed
docs: adding field descriptions to predefined audio document
Signed-off-by: punndcoder28 <[email protected]>
1 parent 189ff63 commit f9a1871

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

docarray/documents/audio.py

Lines changed: 22 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,26 @@ class MultiModalDoc(BaseDoc):
9496
```
9597
"""
9698

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

103120
@classmethod
104121
def validate(

0 commit comments

Comments
 (0)