Skip to content

Commit 015f795

Browse files
fix audio attr name (#8241)
1 parent 60841e2 commit 015f795

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dspy/adapters/types/audio.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
class Audio(BaseType):
2121
data: str
22-
format: str
22+
audio_format: str
2323

2424
model_config = {
2525
"frozen": True,
2626
"extra": "forbid",
2727
}
2828

29-
def format(self) -> Union[list[dict[str, Any]], str]:
29+
def format(self) -> list[dict[str, Any]]:
3030
try:
3131
data = self.data
3232
except Exception as e:
@@ -35,7 +35,7 @@ def format(self) -> Union[list[dict[str, Any]], str]:
3535
"type": "input_audio",
3636
"input_audio": {
3737
"data": data,
38-
"format": self.format
38+
"format": self.audio_format
3939
}
4040
}]
4141

@@ -109,7 +109,7 @@ def __str__(self) -> str:
109109

110110
def __repr__(self) -> str:
111111
length = len(self.data)
112-
return f"Audio(data=<AUDIO_BASE_64_ENCODED({length})>, format='{self.format}')"
112+
return f"Audio(data=<AUDIO_BASE_64_ENCODED({length})>, format='{self.audio_format}')"
113113

114114
def encode_audio(audio: Union[str, bytes, dict, "Audio", Any], sampling_rate: int = 16000, format: str = "wav") -> dict:
115115
"""

0 commit comments

Comments
 (0)