|
16 | 16 | """Dialogflow API Python sample showing how to manage Participants. |
17 | 17 | """ |
18 | 18 |
|
19 | | -import google.auth |
20 | | -from google.cloud import dialogflow_v2beta1 as dialogflow |
21 | | - |
22 | 19 | ROLES = ["HUMAN_AGENT", "AUTOMATED_AGENT", "END_USER"] |
23 | 20 |
|
24 | 21 |
|
25 | 22 | # [START dialogflow_create_participant] |
26 | 23 | def create_participant(project_id: str, conversation_id: str, role: str): |
| 24 | + from google.cloud import dialogflow_v2beta1 as dialogflow |
| 25 | + |
27 | 26 | """Creates a participant in a given conversation. |
28 | 27 |
|
29 | 28 | Args: |
@@ -53,6 +52,8 @@ def create_participant(project_id: str, conversation_id: str, role: str): |
53 | 52 | def analyze_content_text( |
54 | 53 | project_id: str, conversation_id: str, participant_id: str, text: str |
55 | 54 | ): |
| 55 | + from google.cloud import dialogflow_v2beta1 as dialogflow |
| 56 | + |
56 | 57 | """Analyze text message content from a participant. |
57 | 58 |
|
58 | 59 | Args: |
@@ -118,6 +119,9 @@ def analyze_content_text( |
118 | 119 | def analyze_content_audio( |
119 | 120 | conversation_id: str, participant_id: str, audio_file_path: str |
120 | 121 | ): |
| 122 | + import google.auth |
| 123 | + from google.cloud import dialogflow_v2beta1 as dialogflow |
| 124 | + |
121 | 125 | """Analyze audio content for END_USER with audio files. |
122 | 126 |
|
123 | 127 | Args: |
@@ -193,6 +197,9 @@ def analyze_content_audio_stream( |
193 | 197 | language_code: str, |
194 | 198 | single_utterance=False, |
195 | 199 | ): |
| 200 | + import google.auth |
| 201 | + from google.cloud import dialogflow_v2beta1 as dialogflow |
| 202 | + |
196 | 203 | """Stream audio streams to Dialogflow and receive transcripts and |
197 | 204 | suggestions. |
198 | 205 |
|
@@ -235,5 +242,4 @@ def gen_requests(participant_name, audio_config, stream): |
235 | 242 | gen_requests(participant_name, audio_config, stream), timeout=timeout |
236 | 243 | ) |
237 | 244 |
|
238 | | - |
239 | 245 | # [END dialogflow_analyze_content_audio_stream] |
0 commit comments