Skip to content

Commit 8a7538d

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

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 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',
109+
example='[[1, 1, 2], [1, 1, 1]]',
110+
)
111+
bytes_: Optional[AudioBytes] = Field(
112+
description='''Bytes object of the image which is an instance of
113+
`AudioBytes.''',
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)