|
| 1 | + |
| 2 | +.. This file is automatically generated. Do not edit this file directly. |
| 3 | +
|
| 4 | +Dialogflow CX API Python Samples |
| 5 | +=============================================================================== |
| 6 | + |
| 7 | +.. image:: https://gstatic.com/cloudssh/images/open-btn.png |
| 8 | + :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=/README.rst |
| 9 | + |
| 10 | + |
| 11 | +This directory contains samples for Dialogflow CX API. The `Dialogflow CX API`_ enables you to create conversational experiences across devices and platforms. |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +.. _Dialogflow CX API: https://cloud.google.com/dialogflow/cx/docs/ |
| 17 | + |
| 18 | + |
| 19 | +Setup |
| 20 | +------------------------------------------------------------------------------- |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | +Authentication |
| 25 | +++++++++++++++ |
| 26 | + |
| 27 | +This sample requires you to have authentication setup. Refer to the |
| 28 | +`Authentication Getting Started Guide`_ for instructions on setting up |
| 29 | +credentials for applications. |
| 30 | + |
| 31 | +.. _Authentication Getting Started Guide: |
| 32 | + https://cloud.google.com/docs/authentication/getting-started |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | +Install Dependencies |
| 38 | +++++++++++++++++++++ |
| 39 | + |
| 40 | +#. Clone python-docs-samples and change directory to the sample directory you want to use. |
| 41 | + |
| 42 | + .. code-block:: bash |
| 43 | +
|
| 44 | + $ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git |
| 45 | +
|
| 46 | +#. Install `pip`_ and `virtualenv`_ if you do not already have them. You may want to refer to the `Python Development Environment Setup Guide`_ for Google Cloud Platform for instructions. |
| 47 | + |
| 48 | + .. _Python Development Environment Setup Guide: |
| 49 | + https://cloud.google.com/python/setup |
| 50 | + |
| 51 | +#. Create a virtualenv. Samples are compatible with Python 3.6+. |
| 52 | + |
| 53 | + .. code-block:: bash |
| 54 | +
|
| 55 | + $ virtualenv env |
| 56 | + $ source env/bin/activate |
| 57 | +
|
| 58 | +#. Install the dependencies needed to run the samples. |
| 59 | + |
| 60 | + .. code-block:: bash |
| 61 | +
|
| 62 | + $ pip install -r requirements.txt |
| 63 | +
|
| 64 | +.. _pip: https://pip.pypa.io/ |
| 65 | +.. _virtualenv: https://virtualenv.pypa.io/ |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | +Samples |
| 73 | +------------------------------------------------------------------------------- |
| 74 | + |
| 75 | + |
| 76 | +Detect Intent Text |
| 77 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 78 | + |
| 79 | +.. image:: https://gstatic.com/cloudssh/images/open-btn.png |
| 80 | + :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=/detect_intent_texts.py,/README.rst |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | +To run this sample: |
| 86 | + |
| 87 | +.. code-block:: bash |
| 88 | +
|
| 89 | + $ python detect_intent_texts.py |
| 90 | +
|
| 91 | +
|
| 92 | + usage: detect_intent_texts.py [-h] --agent AGENT [--session-id SESSION_ID] |
| 93 | + [--language-code LANGUAGE_CODE] |
| 94 | + texts [texts ...] |
| 95 | +
|
| 96 | + DialogFlow API Detect Intent Python sample with text inputs. |
| 97 | +
|
| 98 | + Examples: |
| 99 | + python detect_intent_texts.py -h |
| 100 | + python detect_intent_texts.py --agent AGENT --session-id SESSION_ID "hello" "book a meeting room" "Mountain View" |
| 101 | + python detect_intent_texts.py --agent AGENT --session-id SESSION_ID "tomorrow" "10 AM" "2 hours" "10 people" "A" "yes" |
| 102 | +
|
| 103 | + positional arguments: |
| 104 | + texts Text inputs. |
| 105 | +
|
| 106 | + optional arguments: |
| 107 | + -h, --help show this help message and exit |
| 108 | + --agent AGENT Agent resource name. Required. |
| 109 | + --session-id SESSION_ID |
| 110 | + Identifier of the DetectIntent session. Defaults to a |
| 111 | + random UUID. |
| 112 | + --language-code LANGUAGE_CODE |
| 113 | + Language code of the query. Defaults to "en-US". |
| 114 | +
|
| 115 | +
|
| 116 | +
|
| 117 | +
|
| 118 | +
|
| 119 | +Detect Intent Audio |
| 120 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 121 | + |
| 122 | +.. image:: https://gstatic.com/cloudssh/images/open-btn.png |
| 123 | + :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=/detect_intent_audio.py,/README.rst |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | +To run this sample: |
| 129 | + |
| 130 | +.. code-block:: bash |
| 131 | +
|
| 132 | + $ python detect_intent_audio.py |
| 133 | +
|
| 134 | +
|
| 135 | + usage: detect_intent_audio.py [-h] --agent AGENT [--session-id SESSION_ID] |
| 136 | + [--language-code LANGUAGE_CODE] |
| 137 | + --audio-file-path AUDIO_FILE_PATH |
| 138 | +
|
| 139 | + DialogFlow API Detect Intent Python sample with audio file. |
| 140 | +
|
| 141 | + Examples: |
| 142 | + python detect_intent_audio.py -h |
| 143 | + python detect_intent_audio.py --agent AGENT --session-id SESSION_ID --audio-file-path resources/hello.wav |
| 144 | +
|
| 145 | + optional arguments: |
| 146 | + -h, --help show this help message and exit |
| 147 | + --agent AGENT Agent resource name. Required. |
| 148 | + --session-id SESSION_ID |
| 149 | + Identifier of the DetectIntent session. Defaults to a |
| 150 | + random UUID. |
| 151 | + --language-code LANGUAGE_CODE |
| 152 | + Language code of the query. Defaults to "en-US". |
| 153 | + --audio-file-path AUDIO_FILE_PATH |
| 154 | + Path to the audio file. |
| 155 | +
|
| 156 | +
|
| 157 | +
|
| 158 | +
|
| 159 | +
|
| 160 | +Detect Intent Stream |
| 161 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 162 | + |
| 163 | +.. image:: https://gstatic.com/cloudssh/images/open-btn.png |
| 164 | + :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=/detect_intent_stream.py,/README.rst |
| 165 | + |
| 166 | + |
| 167 | + |
| 168 | + |
| 169 | +To run this sample: |
| 170 | + |
| 171 | +.. code-block:: bash |
| 172 | +
|
| 173 | + $ python detect_intent_stream.py |
| 174 | +
|
| 175 | +
|
| 176 | + usage: detect_intent_stream.py [-h] --agent AGENT [--session-id SESSION_ID] |
| 177 | + [--language-code LANGUAGE_CODE] |
| 178 | + --audio-file-path AUDIO_FILE_PATH |
| 179 | +
|
| 180 | + DialogFlow API Detect Intent Python sample with audio files processed as an audio stream. |
| 181 | +
|
| 182 | + Examples: |
| 183 | + python detect_intent_stream.py -h |
| 184 | + python detect_intent_stream.py --agent AGENT --session-id SESSION_ID --audio-file-path resources/hello.wav |
| 185 | +
|
| 186 | + optional arguments: |
| 187 | + -h, --help show this help message and exit |
| 188 | + --agent AGENT Agent resource name. Required. |
| 189 | + --session-id SESSION_ID |
| 190 | + Identifier of the DetectIntent session. Defaults to a |
| 191 | + random UUID. |
| 192 | + --language-code LANGUAGE_CODE |
| 193 | + Language code of the query. Defaults to "en-US". |
| 194 | + --audio-file-path AUDIO_FILE_PATH |
| 195 | + Path to the audio file. |
| 196 | +
|
| 197 | +
|
| 198 | +
|
| 199 | +
|
| 200 | +
|
| 201 | +
|
| 202 | +
|
| 203 | +
|
| 204 | +
|
| 205 | +The client library |
| 206 | +------------------------------------------------------------------------------- |
| 207 | + |
| 208 | +This sample uses the `Google Cloud Client Library for Python`_. |
| 209 | +You can read the documentation for more details on API usage and use GitHub |
| 210 | +to `browse the source`_ and `report issues`_. |
| 211 | + |
| 212 | +.. _Google Cloud Client Library for Python: |
| 213 | + https://googlecloudplatform.github.io/google-cloud-python/ |
| 214 | +.. _browse the source: |
| 215 | + https://github.com/GoogleCloudPlatform/google-cloud-python |
| 216 | +.. _report issues: |
| 217 | + https://github.com/GoogleCloudPlatform/google-cloud-python/issues |
| 218 | + |
| 219 | + |
| 220 | + |
| 221 | +.. _Google Cloud SDK: https://cloud.google.com/sdk/ |
0 commit comments