diff --git a/dialogflow/analyze_content_stream_test.py b/dialogflow/analyze_content_stream_test.py index 29aa40b0fa1..9857863933f 100644 --- a/dialogflow/analyze_content_stream_test.py +++ b/dialogflow/analyze_content_stream_test.py @@ -77,7 +77,6 @@ def participant_id(conversation_id): def test_analyze_content_audio_stream(capsys, conversation_id, participant_id): # Call StreamingAnalyzeContent to transcribe the audio. participant_management.analyze_content_audio_stream( - project_id=PROJECT_ID, conversation_id=conversation_id, participant_id=participant_id, audio_file_path=AUDIO_FILE_PATH, diff --git a/dialogflow/participant_management.py b/dialogflow/participant_management.py index e2bf6169f43..8df9e4e45de 100644 --- a/dialogflow/participant_management.py +++ b/dialogflow/participant_management.py @@ -16,6 +16,7 @@ """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"] @@ -112,12 +113,11 @@ def analyze_content_text(project_id, conversation_id, participant_id, text): # [START dialogflow_analyze_content_audio_stream] def analyze_content_audio_stream( - project_id, conversation_id, participant_id, audio_file_path + conversation_id, participant_id, audio_file_path ): """Analyze audio content for END_USER Args: - project_id: The GCP project linked with the conversation profile. conversation_id: Id of the conversation. participant_id: Id of the participant. audio_file_path: audio file in wav/mp3 format contains utterances of END_USER.""" @@ -127,7 +127,8 @@ def analyze_content_audio_stream( # After completing all of your requests, call the "__exit__()" method to safely # clean up any remaining background resources. Alternatively, use the client as # a context manager. - client = dialogflow.ParticipantsClient() + credentials, project_id = google.auth.default() + client = dialogflow.ParticipantsClient(credentials=credentials) participant_path = client.participant_path( project_id, conversation_id, participant_id