-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86100db
commit 37d5582
Showing
69 changed files
with
574 additions
and
557 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,26 @@ | ||
from __future__ import annotations | ||
|
||
from attrs import define | ||
from attrs import define, field | ||
|
||
from griptape.artifacts import MediaArtifact | ||
from griptape.artifacts import BlobArtifact | ||
|
||
|
||
@define | ||
class AudioArtifact(MediaArtifact): | ||
"""AudioArtifact is a type of MediaArtifact representing audio.""" | ||
class AudioArtifact(BlobArtifact): | ||
"""Stores audio data. | ||
media_type: str = "audio" | ||
Attributes: | ||
format: The audio format, e.g. "wav" or "mp3". | ||
""" | ||
|
||
format: str = field(kw_only=True, metadata={"serializable": True}) | ||
|
||
@property | ||
def mime_type(self) -> str: | ||
return f"audio/{self.format}" | ||
|
||
def to_bytes(self) -> bytes: | ||
return self.value | ||
|
||
def to_text(self) -> str: | ||
return f"Audio, format: {self.format}, size: {len(self.value)} bytes" |
Oops, something went wrong.