Skip to content
This repository was archived by the owner on Sep 9, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
docs: adding field descriptions to predefined audio document
Signed-off-by: punndcoder28 <puneethk.2899@gmail.com>
  • Loading branch information
punndcoder28 committed Sep 14, 2023
commit c3097df8142d9f13de791b7edf1bd3d042a803d4
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(
Comment thread
punndcoder28 marked this conversation as resolved.
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(
Comment thread
punndcoder28 marked this conversation as resolved.
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