From 6fe2536c5a417a96534e8a15cff242c87a56dcc1 Mon Sep 17 00:00:00 2001 From: gbaian10 <34255899+gbaian10@users.noreply.github.com> Date: Wed, 18 Sep 2024 06:18:57 +0800 Subject: [PATCH] docs: fix the `ImportError` in `google_speech_to_text.ipynb` (#26522) fix #26370 - #26370 `GoogleSpeechToTextLoader` is a deprecated method in `langchain_community.document_loaders.google_speech_to_text`. The new recommended usage is to use `SpeechToTextLoader` from `langchain_google_community`. When importing from `langchain_google_community`, use the name `SpeechToTextLoader` instead of the old `GoogleSpeechToTextLoader`. ![image](https://github.com/user-attachments/assets/3a8bd309-9858-4938-b7db-872f51b9542e) Co-authored-by: Erick Friis --- .../document_loaders/google_speech_to_text.ipynb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/docs/integrations/document_loaders/google_speech_to_text.ipynb b/docs/docs/integrations/document_loaders/google_speech_to_text.ipynb index fd17cea4fd1..7b23a064133 100644 --- a/docs/docs/integrations/document_loaders/google_speech_to_text.ipynb +++ b/docs/docs/integrations/document_loaders/google_speech_to_text.ipynb @@ -6,7 +6,7 @@ "source": [ "# Google Speech-to-Text Audio Transcripts\n", "\n", - "The `GoogleSpeechToTextLoader` allows to transcribe audio files with the [Google Cloud Speech-to-Text API](https://cloud.google.com/speech-to-text) and loads the transcribed text into documents.\n", + "The `SpeechToTextLoader` allows to transcribe audio files with the [Google Cloud Speech-to-Text API](https://cloud.google.com/speech-to-text) and loads the transcribed text into documents.\n", "\n", "To use it, you should have the `google-cloud-speech` python package installed, and a Google Cloud project with the [Speech-to-Text API enabled](https://cloud.google.com/speech-to-text/v2/docs/transcribe-client-libraries#before_you_begin).\n", "\n", @@ -41,7 +41,7 @@ "source": [ "## Example\n", "\n", - "The `GoogleSpeechToTextLoader` must include the `project_id` and `file_path` arguments. Audio files can be specified as a Google Cloud Storage URI (`gs://...`) or a local file path.\n", + "The `SpeechToTextLoader` must include the `project_id` and `file_path` arguments. Audio files can be specified as a Google Cloud Storage URI (`gs://...`) or a local file path.\n", "\n", "Only synchronous requests are supported by the loader, which has a [limit of 60 seconds or 10MB](https://cloud.google.com/speech-to-text/v2/docs/sync-recognize#:~:text=60%20seconds%20and/or%2010%20MB) per audio file." ] @@ -52,13 +52,13 @@ "metadata": {}, "outputs": [], "source": [ - "from langchain_google_community import GoogleSpeechToTextLoader\n", + "from langchain_google_community import SpeechToTextLoader\n", "\n", "project_id = \"\"\n", "file_path = \"gs://cloud-samples-data/speech/audio.flac\"\n", "# or a local file path: file_path = \"./audio.wav\"\n", "\n", - "loader = GoogleSpeechToTextLoader(project_id=project_id, file_path=file_path)\n", + "loader = SpeechToTextLoader(project_id=project_id, file_path=file_path)\n", "\n", "docs = loader.load()" ] @@ -152,7 +152,7 @@ " RecognitionConfig,\n", " RecognitionFeatures,\n", ")\n", - "from langchain_google_community import GoogleSpeechToTextLoader\n", + "from langchain_google_community import SpeechToTextLoader\n", "\n", "project_id = \"\"\n", "location = \"global\"\n", @@ -171,7 +171,7 @@ " ),\n", ")\n", "\n", - "loader = GoogleSpeechToTextLoader(\n", + "loader = SpeechToTextLoader(\n", " project_id=project_id,\n", " location=location,\n", " recognizer_id=recognizer_id,\n",