From bb295d29ee84abb34d520e8985d05f6e985696cb Mon Sep 17 00:00:00 2001 From: Vladimir Blagojevic Date: Thu, 26 Oct 2023 17:22:24 +0200 Subject: [PATCH] Fix failing test (#6176) --- haystack/preview/components/audio/whisper_remote.py | 6 +----- test/preview/components/audio/test_whisper_remote.py | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/haystack/preview/components/audio/whisper_remote.py b/haystack/preview/components/audio/whisper_remote.py index 4ef4821b3..8af4c8f29 100644 --- a/haystack/preview/components/audio/whisper_remote.py +++ b/haystack/preview/components/audio/whisper_remote.py @@ -126,11 +126,7 @@ class RemoteWhisperTranscriber: for stream in streams: file = io.BytesIO(stream.data) - try: - file.name = stream.metadata["file_path"] - except KeyError: - file.name = "audio_input.wav" - + file.name = stream.metadata.get("file_path", "audio_input.wav") # default name if `file_path` not found content = openai.Audio.transcribe(file=file, model=self.model_name, **self.whisper_params) doc = Document(text=content["text"], metadata=stream.metadata) documents.append(doc) diff --git a/test/preview/components/audio/test_whisper_remote.py b/test/preview/components/audio/test_whisper_remote.py index 3fae7fc3e..53feb971a 100644 --- a/test/preview/components/audio/test_whisper_remote.py +++ b/test/preview/components/audio/test_whisper_remote.py @@ -210,7 +210,6 @@ class TestRemoteWhisperTranscriber: preview_samples_path / "audio" / "this is the content of the document.wav", preview_samples_path / "audio" / "the context for this answer is here.wav", preview_samples_path / "audio" / "answer.wav", - "rb", ] audio_files = []