-
Notifications
You must be signed in to change notification settings - Fork 140
docs(samples): add Agent Assist code samples #267
Conversation
Here is the summary of changes. You are about to add 16 region tags.
This comment is generated by snippet-bot.
|
This is a very big PR, well over 1000 lines of new code. It's going to be a while before I can get the time to review it. |
Sorry about that. We are actually just migrating private code samples to public for Agent Assist Public Preview Launch. If there is a better way to do this, please let me know. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pass lint and all tests.
Make sure all functions have tests.
Update copyright dates if anything has been written or first published this year.
Have white space before and after import statements and internally to break code into logical chunks for readability.
Use \n in print statements only when double spacing is needed, and use consistently.
@@ -0,0 +1,144 @@ | |||
# Copyright 2019 Google LLC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is newly published, use 2021 for copyright.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@@ -0,0 +1,46 @@ | |||
#!/usr/bin/env python | |||
|
|||
# Copyright 2019 Google LLC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same copyright note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
|
||
|
||
# [START dialogflow_update_answer_record] | ||
def update_anwer_record(project_id, answer_record_id, click): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a typo, or is there a reason not call this update_answer_record?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
def update_anwer_record(project_id, answer_record_id, click): | ||
"""Update the answer record. | ||
|
||
Args: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the "click" argument for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comments.
project_id: The GCP project linked with the conversation profile. | ||
answer_record_id: The answer record id returned along with the | ||
suggestion.""" | ||
from google.cloud import dialogflow_v2 as dialogflow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add leading whitespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
|
||
Also please contact Google to get credentials of this project and set up the | ||
credential file json locations by running: | ||
export GOOGLE_APPLICATION_CREDENTIALS=<cred_json_file_location> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are other environment variables the program expects. If we include these steps (above) we should include them, too.
@@ -0,0 +1,229 @@ | |||
# Copyright 2019 Google LLC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a test for this code? I don't see one.
""" | ||
|
||
import argparse | ||
|
||
|
||
# [START dialogflow_list_knowledge_base] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there tests for each method? Where are they?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this function.
print('Reply Text: {}'.format(response.reply_text)) | ||
|
||
for suggestion_result in response.human_agent_suggestion_results: | ||
if suggestion_result.error is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be is not None, instead of is None. Otherwise the next line will have an exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Args: | ||
participant_name: resource name of the participant. | ||
sample_rate_herz: herz rate of the sample. | ||
audio_generator: a sequence of audio data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't match the argument list above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Fixed the issue you mentioned and better organized the tests. Removed some unnecessary functions and samples. Ran I think I don't know how to update the readme.rst, it seems autogenerated by readme.in but I don't know how it works. Do you know? |
…E_CLOUD_PROJECT`.
🤖 I have created a release \*beep\* \*boop\* --- ### [2.1.1](https://www.github.com/googleapis/python-dialogflow/compare/v2.1.0...v2.1.1) (2021-04-12) ### Bug Fixes * remove `input_audio` field from AnalyzeContentRequest from v2/v2beta1 ([06381fc](https://www.github.com/googleapis/python-dialogflow/commit/06381fcc965669e1b3dc8bec22aa567dceb6f935)) * remove proto message CreateCallMatcherRequest, CreateCallMatcherResponse, ListCallMatchersRequest, ListCallMatchersResponse, DeleteCallMatcherRequest, DeleteCallMatcherResponse, CallMatcher, StreamingAnalyzeContentRequest, StreamingAnalyzeContentResponse, AudioInput from v2/v2beta1, TelephonyDtmfEvents, TelephonyDtmf from v2 ([06381fc](https://www.github.com/googleapis/python-dialogflow/commit/06381fcc965669e1b3dc8bec22aa567dceb6f935)) * remove resource_reference for invisible resources ([06381fc](https://www.github.com/googleapis/python-dialogflow/commit/06381fcc965669e1b3dc8bec22aa567dceb6f935)) * Remove resource_reference from UpdateAnswerRecord ([06381fc](https://www.github.com/googleapis/python-dialogflow/commit/06381fcc965669e1b3dc8bec22aa567dceb6f935)) * remove rpc or fields that are unintended to release ([#264](https://www.github.com/googleapis/python-dialogflow/issues/264)) ([06381fc](https://www.github.com/googleapis/python-dialogflow/commit/06381fcc965669e1b3dc8bec22aa567dceb6f935)) * remove StreamingAnalyzeContent, CreateCallMatcher, ListCallMatchers, DeleteCallMatcher rpc from v2/v2beta1 ([06381fc](https://www.github.com/googleapis/python-dialogflow/commit/06381fcc965669e1b3dc8bec22aa567dceb6f935)) ### Documentation * **samples:** add Agent Assist code samples ([#267](https://www.github.com/googleapis/python-dialogflow/issues/267)) ([0a8cfb9](https://www.github.com/googleapis/python-dialogflow/commit/0a8cfb9ac71870df9f69ae518e32a920d08bd170)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕