Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: adding field descriptions to predefined audio document #1774

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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(
punndcoder28 marked this conversation as resolved.
Show resolved Hide 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(
punndcoder28 marked this conversation as resolved.
Show resolved Hide 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