From c39230552fab795a310c394dba8393d567fe1062 Mon Sep 17 00:00:00 2001 From: BigBlackWolf Date: Tue, 2 Apr 2024 11:33:30 +0200 Subject: [PATCH 1/2] fix: moving imports inside functions --- dialogflow/participant_management.py | 14 ++++++++++---- dialogflow/requirements.txt | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/dialogflow/participant_management.py b/dialogflow/participant_management.py index 57801b072e8..59f772131c3 100644 --- a/dialogflow/participant_management.py +++ b/dialogflow/participant_management.py @@ -16,14 +16,13 @@ """Dialogflow API Python sample showing how to manage Participants. """ -import google.auth -from google.cloud import dialogflow_v2beta1 as dialogflow - ROLES = ["HUMAN_AGENT", "AUTOMATED_AGENT", "END_USER"] # [START dialogflow_create_participant] def create_participant(project_id: str, conversation_id: str, role: str): + from google.cloud import dialogflow_v2beta1 as dialogflow + """Creates a participant in a given conversation. Args: @@ -53,6 +52,8 @@ def create_participant(project_id: str, conversation_id: str, role: str): def analyze_content_text( project_id: str, conversation_id: str, participant_id: str, text: str ): + from google.cloud import dialogflow_v2beta1 as dialogflow + """Analyze text message content from a participant. Args: @@ -118,6 +119,9 @@ def analyze_content_text( def analyze_content_audio( conversation_id: str, participant_id: str, audio_file_path: str ): + import google.auth + from google.cloud import dialogflow_v2beta1 as dialogflow + """Analyze audio content for END_USER with audio files. Args: @@ -193,6 +197,9 @@ def analyze_content_audio_stream( language_code: str, single_utterance=False, ): + import google.auth + from google.cloud import dialogflow_v2beta1 as dialogflow + """Stream audio streams to Dialogflow and receive transcripts and suggestions. @@ -235,5 +242,4 @@ def gen_requests(participant_name, audio_config, stream): gen_requests(participant_name, audio_config, stream), timeout=timeout ) - # [END dialogflow_analyze_content_audio_stream] diff --git a/dialogflow/requirements.txt b/dialogflow/requirements.txt index 82640e4675a..1f724ffbbc2 100644 --- a/dialogflow/requirements.txt +++ b/dialogflow/requirements.txt @@ -1,6 +1,6 @@ google-cloud-dialogflow==2.22.0 Flask==2.2.5 -pyaudio==0.2.13 +pyaudio==0.2.14 termcolor==2.4.0 functions-framework==3.5.0 Werkzeug==3.0.1 From fd50fe796d3f307093e395e448c57c95477940e4 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 25 Apr 2024 12:22:42 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- dialogflow/participant_management.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dialogflow/participant_management.py b/dialogflow/participant_management.py index 59f772131c3..e2f9a486c1a 100644 --- a/dialogflow/participant_management.py +++ b/dialogflow/participant_management.py @@ -242,4 +242,5 @@ def gen_requests(participant_name, audio_config, stream): gen_requests(participant_name, audio_config, stream), timeout=timeout ) + # [END dialogflow_analyze_content_audio_stream]