|
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,26 @@ 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 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 | + ) |
102 | 119 |
|
103 | 120 | @classmethod |
104 | 121 | def validate( |
|
0 commit comments