Skip to content

Commit

Permalink
docs: adding field descriptions to predefined audio document
Browse files Browse the repository at this point in the history
Signed-off-by: punndcoder28 <puneethk.2899@gmail.com>
  • Loading branch information
punndcoder28 committed Sep 6, 2023
1 parent 189ff63 commit f47ba11
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions docarray/documents/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import numpy as np

from pydantic import Field

from docarray.base_doc import BaseDoc
from docarray.typing import AnyEmbedding, AudioUrl
from docarray.typing.bytes.audio_bytes import AudioBytes
Expand Down Expand Up @@ -94,11 +96,25 @@ class MultiModalDoc(BaseDoc):
```
"""

url: Optional[AudioUrl]
tensor: Optional[AudioTensor]
embedding: Optional[AnyEmbedding]
bytes_: Optional[AudioBytes]
frame_rate: Optional[int]
url: Optional[AudioUrl] = Field(
description='The url to a (potentially remote) audio file.',
example='https://github.com/docarray/docarray/blob/main/tests/toydata/hello.mp3?raw=true',
)
tensor: Optional[AudioTensor] = Field(
description='''Tensor object of the audio which be specified to one of
`AudioNdArray`, `AudioTorchTensor`, `AudioTensorFlowTensor`''',
)
embedding: Optional[AnyEmbedding] = Field(
description='Store an embedding: a vector representation of the audio.',
example='[[1, 1, 2], [1, 1, 1]]',
)
bytes_: Optional[AudioBytes] = Field(
description='Bytes representation pf the audio',
)
frame_rate: Optional[int] = Field(
description='''An integer representing the frame rate of the audio.''',
example=24,
)

@classmethod
def validate(
Expand Down

0 comments on commit f47ba11

Please sign in to comment.