Skip to content

Commit

Permalink
docs: adding field descriptions to predefined audio document (#1774)
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 14, 2023
1 parent 715252a commit 35d2138
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 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,29 @@ class MultiModalDoc(BaseDoc):
```
"""

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

@classmethod
def validate(
Expand Down

0 comments on commit 35d2138

Please sign in to comment.