|
2 | 2 |
|
3 | 3 | import numpy as np |
4 | 4 |
|
| 5 | +from pydantic import Field |
| 6 | + |
5 | 7 | from docarray.base_doc import BaseDoc |
6 | 8 | from docarray.typing import AnyEmbedding, AudioUrl |
7 | 9 | from docarray.typing.bytes.audio_bytes import AudioBytes |
@@ -94,11 +96,27 @@ class MultiModalDoc(BaseDoc): |
94 | 96 | ``` |
95 | 97 | """ |
96 | 98 |
|
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 | + ) |
102 | 120 |
|
103 | 121 | @classmethod |
104 | 122 | def validate( |
|
0 commit comments