Skip to content

Commit 106b51c

Browse files
committed
docs: adding field descriptions to predefined audio document
1 parent 189ff63 commit 106b51c

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

docarray/documents/audio.py

Lines changed: 23 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,27 @@ 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 of the audio file.',
101+
example='https://github.com/docarray/docarray/blob/main/tests/toydata/hello.mp3?raw=true',
102+
)
103+
tensor: Optional[AudioTensor] = Field(
104+
description='''Tensor object of the audio which be specified to one of
105+
`AudioNdArray`, `AudioTorchTensor`, `AudioTensorFlowTensor`''',
106+
)
107+
embedding: Optional[AnyEmbedding] = Field(
108+
description='''Embedding field is used to store tensor objects of type
109+
Tensorflow, PyTorch, NumPy and Jax''',
110+
example='np.zeros((3, 32, 32))',
111+
)
112+
bytes_: Optional[AudioBytes] = Field(
113+
description='''Bytes object of the image which is an instance of
114+
`AudioBytes.''',
115+
)
116+
frame_rate: Optional[int] = Field(
117+
description='''An integer representing the frame rate of the audio.''',
118+
example=24,
119+
)
102120

103121
@classmethod
104122
def validate(

0 commit comments

Comments
 (0)