Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion dialogflow/analyze_content_stream_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 4 additions & 3 deletions dialogflow/participant_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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."""
Expand All @@ -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
Expand Down