We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Duplicate tests for WhisperTranscriber
`test_whisper_api_transcribe` and `test_whisper_api_transcribe_with_params` in `test/nodes/test_whisper.py` have the exact same code.
We should remove `test_whisper_api_transcribe_with_params`.

**Alternatives considered**
Change `transcribe_test_helper(w)` to `transcribe_test_helper(w, language="en")` in `test_whisper_api_transcribe_with_params`. This is probably how it was intended. However, we're only testing the API then and don't check the output taking into account that parameter.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `haystack/nodes/audio/whisper_transcriber.py`
Content:
```
1 import json
2 
3 from typing import List, Optional, Dict, Any, Union, BinaryIO, Literal
4 
5 import requests
6 import torch
7 from requests import PreparedRequest
8 
9 from haystack import MultiLabel, Document
10 from haystack.errors import OpenAIError, OpenAIRateLimitError
11 from haystack.nodes.base import BaseComponent
12 from haystack.utils.import_utils import is_whisper_available
13 
14 WhisperModel = Literal["tiny", "small", "medium", "large", "large-v2"]
15 
16 
17 class WhisperTranscriber(BaseComponent):
18     """
19     Transcribes audio files using OpenAI's Whisper. This class supports two underlying implementations:
20 
21     - API (default): Uses the OpenAI API and requires an API key. See blog
22     [post](https://beta.openai.com/docs/api-reference/whisper for more details.) for more details.
23     - Local (requires installation of whisper): Uses the local installation
24     of [whisper](https://github.com/openai/whisper).
25 
26     If you are using local installation of whisper, install whisper following the instructions available on
27     the Whisper [github repo](https://github.com/openai/whisper) and omit the api_key parameter.
28 
29     If you are using the API implementation, you need to provide an api_key. You can get one by signing up
30     for an OpenAI account [here](https://beta.openai.com/).
31 
32     For the supported audio formats, languages and other parameters, see the Whisper API
33     [documentation](https://platform.openai.com/docs/guides/speech-to-text) and the official Whisper
34     [github repo](https://github.com/openai/whisper).
35     """
36 
37     # If it's not a decision component, there is only one outgoing edge
38     outgoing_edges = 1
39 
40     def __init__(
41         self,
42         api_key: Optional[str] = None,
43         model_name_or_path: WhisperModel = "medium",
44         device: Optional[Union[str, torch.device]] = None,
45     ) -> None:
46         """
47         Creates a WhisperTranscriber instance.
48 
49         :param api_key: OpenAI API key. If None, local installation of whisper is used.
50         :param model_name_or_path: Name of the model to use. If using local installation of whisper, this
51         value has to be one of the following: "tiny", "small", "medium", "large", "large-v2". If using
52         the API, this value has to be "whisper-1" (default).
53         :param device: Device to use for inference. This parameter is only used if you are using local
54         installation of whisper. If None, the device is automatically selected.
55         """
56         super().__init__()
57         self.api_key = api_key
58 
59         self.use_local_whisper = is_whisper_available() and self.api_key is None
60 
61         if self.use_local_whisper:
62             import whisper
63 
64             self._model = whisper.load_model(model_name_or_path, device=device)
65         else:
66             if api_key is None:
67                 raise ValueError(
68                     "Please provide a valid api_key for OpenAI API. Alternatively, "
69                     "install OpenAI whisper (see https://github.com/openai/whisper for more details)."
70                 )
71 
72     def transcribe(
73         self,
74         audio_file: Union[str, BinaryIO],
75         language: Optional[str] = None,
76         return_segments: bool = False,
77         translate: bool = False,
78         **kwargs,
79     ) -> Dict[str, Any]:
80         """
81         Transcribe audio file.
82 
83         :param audio_file: Path to audio file or a binary file-like object.
84         :param language: Language of the audio file. If None, the language is automatically detected.
85         :param return_segments: If True, returns the transcription for each segment of the audio file.
86         :param translate: If True, translates the transcription to English.
87 
88         """
89         transcript: Dict[str, Any] = {}
90 
91         new_kwargs = {k: v for k, v in kwargs.items() if v is not None}
92         if language is not None:
93             new_kwargs["language"] = language
94 
95         if self.use_local_whisper:
96             new_kwargs["return_segments"] = return_segments
97             transcript = self._invoke_local(audio_file, translate, **new_kwargs)
98         elif self.api_key:
99             transcript = self._invoke_api(audio_file, translate, **new_kwargs)
100         return transcript
101 
102     def _invoke_api(
103         self, audio_file: Union[str, BinaryIO], translate: Optional[bool] = False, **kwargs
104     ) -> Dict[str, Any]:
105         if isinstance(audio_file, str):
106             with open(audio_file, "rb") as f:
107                 return self._invoke_api(f, translate, **kwargs)
108         else:
109             headers = {"Authorization": f"Bearer {self.api_key}"}
110             request = PreparedRequest()
111             url: str = (
112                 "https://api.openai.com/v1/audio/transcriptions"
113                 if not translate
114                 else "https://api.openai.com/v1/audio/translations"
115             )
116 
117             request.prepare(
118                 method="POST",
119                 url=url,
120                 headers=headers,
121                 data={"model": "whisper-1", **kwargs},
122                 files=[("file", (audio_file.name, audio_file, "application/octet-stream"))],
123             )
124             response = requests.post(url, data=request.body, headers=request.headers, timeout=600)
125 
126             if response.status_code != 200:
127                 openai_error: OpenAIError
128                 if response.status_code == 429:
129                     openai_error = OpenAIRateLimitError(f"API rate limit exceeded: {response.text}")
130                 else:
131                     openai_error = OpenAIError(
132                         f"OpenAI returned an error.\n"
133                         f"Status code: {response.status_code}\n"
134                         f"Response body: {response.text}",
135                         status_code=response.status_code,
136                     )
137                 raise openai_error
138 
139             return json.loads(response.content)
140 
141     def _invoke_local(
142         self, audio_file: Union[str, BinaryIO], translate: Optional[bool] = False, **kwargs
143     ) -> Dict[str, Any]:
144         if isinstance(audio_file, str):
145             with open(audio_file, "rb") as f:
146                 return self._invoke_local(f, translate, **kwargs)
147         else:
148             return_segments = kwargs.pop("return_segments", None)
149             kwargs["task"] = "translate" if translate else "transcribe"
150             transcription = self._model.transcribe(audio_file.name, **kwargs)
151             if not return_segments:
152                 transcription.pop("segments", None)
153 
154             return transcription
155 
156     def run(
157         self,
158         query: Optional[str] = None,
159         file_paths: Optional[List[str]] = None,
160         labels: Optional[MultiLabel] = None,
161         documents: Optional[List[Document]] = None,
162         meta: Optional[dict] = None,
163     ):  # type: ignore
164         """
165         Transcribe audio files.
166 
167         :param query: Ignored
168         :param file_paths: List of paths to audio files.
169         :param labels: Ignored
170         :param documents: Ignored
171         :param meta: Ignored
172         """
173         transcribed_documents: List[Document] = []
174         if file_paths:
175             for file_path in file_paths:
176                 transcription = self.transcribe(file_path)
177                 d = Document.from_dict(transcription, field_map={"text": "content"})
178                 transcribed_documents.append(d)
179 
180         output = {"documents": transcribed_documents}
181         return output, "output_1"
182 
183     def run_batch(
184         self,
185         queries: Optional[Union[str, List[str]]] = None,
186         file_paths: Optional[List[str]] = None,
187         labels: Optional[Union[MultiLabel, List[MultiLabel]]] = None,
188         documents: Optional[Union[List[Document], List[List[Document]]]] = None,
189         meta: Optional[Union[Dict[str, Any], List[Dict[str, Any]]]] = None,
190         params: Optional[dict] = None,
191         debug: Optional[bool] = None,
192     ):  # type: ignore
193         """
194         Transcribe audio files.
195 
196         :param queries: Ignored
197         :param file_paths: List of paths to audio files.
198         :param labels: Ignored
199         :param documents: Ignored
200         :param meta: Ignored
201         :param params: Ignored
202         :param debug: Ignored
203         """
204         if file_paths and isinstance(file_paths[0], list):
205             all_files = []
206             for files_list in file_paths:
207                 all_files += files_list
208             return self.run(file_paths=all_files)
209         return self.run(file_paths=file_paths)
210
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/haystack/nodes/audio/whisper_transcriber.py b/haystack/nodes/audio/whisper_transcriber.py
--- a/haystack/nodes/audio/whisper_transcriber.py
+++ b/haystack/nodes/audio/whisper_transcriber.py
@@ -82,7 +82,8 @@
 
         :param audio_file: Path to audio file or a binary file-like object.
         :param language: Language of the audio file. If None, the language is automatically detected.
-        :param return_segments: If True, returns the transcription for each segment of the audio file.
+        :param return_segments: If True, returns the transcription for each segment of the audio file. Supported with
+        local installation of whisper only.
         :param translate: If True, translates the transcription to English.
 
         """

{"golden_diff": "diff --git a/haystack/nodes/audio/whisper_transcriber.py b/haystack/nodes/audio/whisper_transcriber.py\n--- a/haystack/nodes/audio/whisper_transcriber.py\n+++ b/haystack/nodes/audio/whisper_transcriber.py\n@@ -82,7 +82,8 @@\n \n         :param audio_file: Path to audio file or a binary file-like object.\n         :param language: Language of the audio file. If None, the language is automatically detected.\n-        :param return_segments: If True, returns the transcription for each segment of the audio file.\n+        :param return_segments: If True, returns the transcription for each segment of the audio file. Supported with\n+        local installation of whisper only.\n         :param translate: If True, translates the transcription to English.\n \n         \"\"\"\n", "issue": "Duplicate tests for WhisperTranscriber\n`test_whisper_api_transcribe` and `test_whisper_api_transcribe_with_params` in `test/nodes/test_whisper.py` have the exact same code.\r\nWe should remove `test_whisper_api_transcribe_with_params`.\r\n\r\n**Alternatives considered**\r\nChange `transcribe_test_helper(w)` to `transcribe_test_helper(w, language=\"en\")` in `test_whisper_api_transcribe_with_params`. This is probably how it was intended. However, we're only testing the API then and don't check the output taking into account that parameter.\r\n\n", "before_files": [{"content": "import json\n\nfrom typing import List, Optional, Dict, Any, Union, BinaryIO, Literal\n\nimport requests\nimport torch\nfrom requests import PreparedRequest\n\nfrom haystack import MultiLabel, Document\nfrom haystack.errors import OpenAIError, OpenAIRateLimitError\nfrom haystack.nodes.base import BaseComponent\nfrom haystack.utils.import_utils import is_whisper_available\n\nWhisperModel = Literal[\"tiny\", \"small\", \"medium\", \"large\", \"large-v2\"]\n\n\nclass WhisperTranscriber(BaseComponent):\n    \"\"\"\n    Transcribes audio files using OpenAI's Whisper. This class supports two underlying implementations:\n\n    - API (default): Uses the OpenAI API and requires an API key. See blog\n    [post](https://beta.openai.com/docs/api-reference/whisper for more details.) for more details.\n    - Local (requires installation of whisper): Uses the local installation\n    of [whisper](https://github.com/openai/whisper).\n\n    If you are using local installation of whisper, install whisper following the instructions available on\n    the Whisper [github repo](https://github.com/openai/whisper) and omit the api_key parameter.\n\n    If you are using the API implementation, you need to provide an api_key. You can get one by signing up\n    for an OpenAI account [here](https://beta.openai.com/).\n\n    For the supported audio formats, languages and other parameters, see the Whisper API\n    [documentation](https://platform.openai.com/docs/guides/speech-to-text) and the official Whisper\n    [github repo](https://github.com/openai/whisper).\n    \"\"\"\n\n    # If it's not a decision component, there is only one outgoing edge\n    outgoing_edges = 1\n\n    def __init__(\n        self,\n        api_key: Optional[str] = None,\n        model_name_or_path: WhisperModel = \"medium\",\n        device: Optional[Union[str, torch.device]] = None,\n    ) -> None:\n        \"\"\"\n        Creates a WhisperTranscriber instance.\n\n        :param api_key: OpenAI API key. If None, local installation of whisper is used.\n        :param model_name_or_path: Name of the model to use. If using local installation of whisper, this\n        value has to be one of the following: \"tiny\", \"small\", \"medium\", \"large\", \"large-v2\". If using\n        the API, this value has to be \"whisper-1\" (default).\n        :param device: Device to use for inference. This parameter is only used if you are using local\n        installation of whisper. If None, the device is automatically selected.\n        \"\"\"\n        super().__init__()\n        self.api_key = api_key\n\n        self.use_local_whisper = is_whisper_available() and self.api_key is None\n\n        if self.use_local_whisper:\n            import whisper\n\n            self._model = whisper.load_model(model_name_or_path, device=device)\n        else:\n            if api_key is None:\n                raise ValueError(\n                    \"Please provide a valid api_key for OpenAI API. Alternatively, \"\n                    \"install OpenAI whisper (see https://github.com/openai/whisper for more details).\"\n                )\n\n    def transcribe(\n        self,\n        audio_file: Union[str, BinaryIO],\n        language: Optional[str] = None,\n        return_segments: bool = False,\n        translate: bool = False,\n        **kwargs,\n    ) -> Dict[str, Any]:\n        \"\"\"\n        Transcribe audio file.\n\n        :param audio_file: Path to audio file or a binary file-like object.\n        :param language: Language of the audio file. If None, the language is automatically detected.\n        :param return_segments: If True, returns the transcription for each segment of the audio file.\n        :param translate: If True, translates the transcription to English.\n\n        \"\"\"\n        transcript: Dict[str, Any] = {}\n\n        new_kwargs = {k: v for k, v in kwargs.items() if v is not None}\n        if language is not None:\n            new_kwargs[\"language\"] = language\n\n        if self.use_local_whisper:\n            new_kwargs[\"return_segments\"] = return_segments\n            transcript = self._invoke_local(audio_file, translate, **new_kwargs)\n        elif self.api_key:\n            transcript = self._invoke_api(audio_file, translate, **new_kwargs)\n        return transcript\n\n    def _invoke_api(\n        self, audio_file: Union[str, BinaryIO], translate: Optional[bool] = False, **kwargs\n    ) -> Dict[str, Any]:\n        if isinstance(audio_file, str):\n            with open(audio_file, \"rb\") as f:\n                return self._invoke_api(f, translate, **kwargs)\n        else:\n            headers = {\"Authorization\": f\"Bearer {self.api_key}\"}\n            request = PreparedRequest()\n            url: str = (\n                \"https://api.openai.com/v1/audio/transcriptions\"\n                if not translate\n                else \"https://api.openai.com/v1/audio/translations\"\n            )\n\n            request.prepare(\n                method=\"POST\",\n                url=url,\n                headers=headers,\n                data={\"model\": \"whisper-1\", **kwargs},\n                files=[(\"file\", (audio_file.name, audio_file, \"application/octet-stream\"))],\n            )\n            response = requests.post(url, data=request.body, headers=request.headers, timeout=600)\n\n            if response.status_code != 200:\n                openai_error: OpenAIError\n                if response.status_code == 429:\n                    openai_error = OpenAIRateLimitError(f\"API rate limit exceeded: {response.text}\")\n                else:\n                    openai_error = OpenAIError(\n                        f\"OpenAI returned an error.\\n\"\n                        f\"Status code: {response.status_code}\\n\"\n                        f\"Response body: {response.text}\",\n                        status_code=response.status_code,\n                    )\n                raise openai_error\n\n            return json.loads(response.content)\n\n    def _invoke_local(\n        self, audio_file: Union[str, BinaryIO], translate: Optional[bool] = False, **kwargs\n    ) -> Dict[str, Any]:\n        if isinstance(audio_file, str):\n            with open(audio_file, \"rb\") as f:\n                return self._invoke_local(f, translate, **kwargs)\n        else:\n            return_segments = kwargs.pop(\"return_segments\", None)\n            kwargs[\"task\"] = \"translate\" if translate else \"transcribe\"\n            transcription = self._model.transcribe(audio_file.name, **kwargs)\n            if not return_segments:\n                transcription.pop(\"segments\", None)\n\n            return transcription\n\n    def run(\n        self,\n        query: Optional[str] = None,\n        file_paths: Optional[List[str]] = None,\n        labels: Optional[MultiLabel] = None,\n        documents: Optional[List[Document]] = None,\n        meta: Optional[dict] = None,\n    ):  # type: ignore\n        \"\"\"\n        Transcribe audio files.\n\n        :param query: Ignored\n        :param file_paths: List of paths to audio files.\n        :param labels: Ignored\n        :param documents: Ignored\n        :param meta: Ignored\n        \"\"\"\n        transcribed_documents: List[Document] = []\n        if file_paths:\n            for file_path in file_paths:\n                transcription = self.transcribe(file_path)\n                d = Document.from_dict(transcription, field_map={\"text\": \"content\"})\n                transcribed_documents.append(d)\n\n        output = {\"documents\": transcribed_documents}\n        return output, \"output_1\"\n\n    def run_batch(\n        self,\n        queries: Optional[Union[str, List[str]]] = None,\n        file_paths: Optional[List[str]] = None,\n        labels: Optional[Union[MultiLabel, List[MultiLabel]]] = None,\n        documents: Optional[Union[List[Document], List[List[Document]]]] = None,\n        meta: Optional[Union[Dict[str, Any], List[Dict[str, Any]]]] = None,\n        params: Optional[dict] = None,\n        debug: Optional[bool] = None,\n    ):  # type: ignore\n        \"\"\"\n        Transcribe audio files.\n\n        :param queries: Ignored\n        :param file_paths: List of paths to audio files.\n        :param labels: Ignored\n        :param documents: Ignored\n        :param meta: Ignored\n        :param params: Ignored\n        :param debug: Ignored\n        \"\"\"\n        if file_paths and isinstance(file_paths[0], list):\n            all_files = []\n            for files_list in file_paths:\n                all_files += files_list\n            return self.run(file_paths=all_files)\n        return self.run(file_paths=file_paths)\n", "path": "haystack/nodes/audio/whisper_transcriber.py"}], "after_files": [{"content": "import json\n\nfrom typing import List, Optional, Dict, Any, Union, BinaryIO, Literal\n\nimport requests\nimport torch\nfrom requests import PreparedRequest\n\nfrom haystack import MultiLabel, Document\nfrom haystack.errors import OpenAIError, OpenAIRateLimitError\nfrom haystack.nodes.base import BaseComponent\nfrom haystack.utils.import_utils import is_whisper_available\n\nWhisperModel = Literal[\"tiny\", \"small\", \"medium\", \"large\", \"large-v2\"]\n\n\nclass WhisperTranscriber(BaseComponent):\n    \"\"\"\n    Transcribes audio files using OpenAI's Whisper. This class supports two underlying implementations:\n\n    - API (default): Uses the OpenAI API and requires an API key. See blog\n    [post](https://beta.openai.com/docs/api-reference/whisper for more details.) for more details.\n    - Local (requires installation of whisper): Uses the local installation\n    of [whisper](https://github.com/openai/whisper).\n\n    If you are using local installation of whisper, install whisper following the instructions available on\n    the Whisper [github repo](https://github.com/openai/whisper) and omit the api_key parameter.\n\n    If you are using the API implementation, you need to provide an api_key. You can get one by signing up\n    for an OpenAI account [here](https://beta.openai.com/).\n\n    For the supported audio formats, languages and other parameters, see the Whisper API\n    [documentation](https://platform.openai.com/docs/guides/speech-to-text) and the official Whisper\n    [github repo](https://github.com/openai/whisper).\n    \"\"\"\n\n    # If it's not a decision component, there is only one outgoing edge\n    outgoing_edges = 1\n\n    def __init__(\n        self,\n        api_key: Optional[str] = None,\n        model_name_or_path: WhisperModel = \"medium\",\n        device: Optional[Union[str, torch.device]] = None,\n    ) -> None:\n        \"\"\"\n        Creates a WhisperTranscriber instance.\n\n        :param api_key: OpenAI API key. If None, local installation of whisper is used.\n        :param model_name_or_path: Name of the model to use. If using local installation of whisper, this\n        value has to be one of the following: \"tiny\", \"small\", \"medium\", \"large\", \"large-v2\". If using\n        the API, this value has to be \"whisper-1\" (default).\n        :param device: Device to use for inference. This parameter is only used if you are using local\n        installation of whisper. If None, the device is automatically selected.\n        \"\"\"\n        super().__init__()\n        self.api_key = api_key\n\n        self.use_local_whisper = is_whisper_available() and self.api_key is None\n\n        if self.use_local_whisper:\n            import whisper\n\n            self._model = whisper.load_model(model_name_or_path, device=device)\n        else:\n            if api_key is None:\n                raise ValueError(\n                    \"Please provide a valid api_key for OpenAI API. Alternatively, \"\n                    \"install OpenAI whisper (see https://github.com/openai/whisper for more details).\"\n                )\n\n    def transcribe(\n        self,\n        audio_file: Union[str, BinaryIO],\n        language: Optional[str] = None,\n        return_segments: bool = False,\n        translate: bool = False,\n        **kwargs,\n    ) -> Dict[str, Any]:\n        \"\"\"\n        Transcribe audio file.\n\n        :param audio_file: Path to audio file or a binary file-like object.\n        :param language: Language of the audio file. If None, the language is automatically detected.\n        :param return_segments: If True, returns the transcription for each segment of the audio file. Supported with\n        local installation of whisper only.\n        :param translate: If True, translates the transcription to English.\n\n        \"\"\"\n        transcript: Dict[str, Any] = {}\n\n        new_kwargs = {k: v for k, v in kwargs.items() if v is not None}\n        if language is not None:\n            new_kwargs[\"language\"] = language\n\n        if self.use_local_whisper:\n            new_kwargs[\"return_segments\"] = return_segments\n            transcript = self._invoke_local(audio_file, translate, **new_kwargs)\n        elif self.api_key:\n            transcript = self._invoke_api(audio_file, translate, **new_kwargs)\n        return transcript\n\n    def _invoke_api(\n        self, audio_file: Union[str, BinaryIO], translate: Optional[bool] = False, **kwargs\n    ) -> Dict[str, Any]:\n        if isinstance(audio_file, str):\n            with open(audio_file, \"rb\") as f:\n                return self._invoke_api(f, translate, **kwargs)\n        else:\n            headers = {\"Authorization\": f\"Bearer {self.api_key}\"}\n            request = PreparedRequest()\n            url: str = (\n                \"https://api.openai.com/v1/audio/transcriptions\"\n                if not translate\n                else \"https://api.openai.com/v1/audio/translations\"\n            )\n\n            request.prepare(\n                method=\"POST\",\n                url=url,\n                headers=headers,\n                data={\"model\": \"whisper-1\", **kwargs},\n                files=[(\"file\", (audio_file.name, audio_file, \"application/octet-stream\"))],\n            )\n            response = requests.post(url, data=request.body, headers=request.headers, timeout=600)\n\n            if response.status_code != 200:\n                openai_error: OpenAIError\n                if response.status_code == 429:\n                    openai_error = OpenAIRateLimitError(f\"API rate limit exceeded: {response.text}\")\n                else:\n                    openai_error = OpenAIError(\n                        f\"OpenAI returned an error.\\n\"\n                        f\"Status code: {response.status_code}\\n\"\n                        f\"Response body: {response.text}\",\n                        status_code=response.status_code,\n                    )\n                raise openai_error\n\n            return json.loads(response.content)\n\n    def _invoke_local(\n        self, audio_file: Union[str, BinaryIO], translate: Optional[bool] = False, **kwargs\n    ) -> Dict[str, Any]:\n        if isinstance(audio_file, str):\n            with open(audio_file, \"rb\") as f:\n                return self._invoke_local(f, translate, **kwargs)\n        else:\n            return_segments = kwargs.pop(\"return_segments\", None)\n            kwargs[\"task\"] = \"translate\" if translate else \"transcribe\"\n            transcription = self._model.transcribe(audio_file.name, **kwargs)\n            if not return_segments:\n                transcription.pop(\"segments\", None)\n\n            return transcription\n\n    def run(\n        self,\n        query: Optional[str] = None,\n        file_paths: Optional[List[str]] = None,\n        labels: Optional[MultiLabel] = None,\n        documents: Optional[List[Document]] = None,\n        meta: Optional[dict] = None,\n    ):  # type: ignore\n        \"\"\"\n        Transcribe audio files.\n\n        :param query: Ignored\n        :param file_paths: List of paths to audio files.\n        :param labels: Ignored\n        :param documents: Ignored\n        :param meta: Ignored\n        \"\"\"\n        transcribed_documents: List[Document] = []\n        if file_paths:\n            for file_path in file_paths:\n                transcription = self.transcribe(file_path)\n                d = Document.from_dict(transcription, field_map={\"text\": \"content\"})\n                transcribed_documents.append(d)\n\n        output = {\"documents\": transcribed_documents}\n        return output, \"output_1\"\n\n    def run_batch(\n        self,\n        queries: Optional[Union[str, List[str]]] = None,\n        file_paths: Optional[List[str]] = None,\n        labels: Optional[Union[MultiLabel, List[MultiLabel]]] = None,\n        documents: Optional[Union[List[Document], List[List[Document]]]] = None,\n        meta: Optional[Union[Dict[str, Any], List[Dict[str, Any]]]] = None,\n        params: Optional[dict] = None,\n        debug: Optional[bool] = None,\n    ):  # type: ignore\n        \"\"\"\n        Transcribe audio files.\n\n        :param queries: Ignored\n        :param file_paths: List of paths to audio files.\n        :param labels: Ignored\n        :param documents: Ignored\n        :param meta: Ignored\n        :param params: Ignored\n        :param debug: Ignored\n        \"\"\"\n        if file_paths and isinstance(file_paths[0], list):\n            all_files = []\n            for files_list in file_paths:\n                all_files += files_list\n            return self.run(file_paths=all_files)\n        return self.run(file_paths=file_paths)\n", "path": "haystack/nodes/audio/whisper_transcriber.py"}]}