Skip to content

Commit 28eb346

Browse files
feat: [google-cloud-dialogflow] add options of query_source, search_config, end_user_metadata and exact_search (#13279)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: add options of query_source, search_config, end_user_metadata and exact_search feat: expose metadata in AnswerSource END_COMMIT_OVERRIDE PiperOrigin-RevId: 696328328 Source-Link: googleapis/googleapis@6b5d85c Source-Link: googleapis/googleapis-gen@383f9bb Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRpYWxvZ2Zsb3cvLk93bEJvdC55YW1sIiwiaCI6IjM4M2Y5YmIwNWViZTAzNjYxZjMxNDA1ZjcyMzRmYWJjMzU0YzBmYTIifQ== --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent cef77c3 commit 28eb346

File tree

10 files changed

+433
-49
lines changed

10 files changed

+433
-49
lines changed

packages/google-cloud-dialogflow/google/cloud/dialogflow/gapic_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.35.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/gapic_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.35.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/gapic_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.35.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/services/conversations/async_client.py

+2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ class ConversationsAsyncClient:
9494
parse_cx_security_settings_path = staticmethod(
9595
ConversationsClient.parse_cx_security_settings_path
9696
)
97+
data_store_path = staticmethod(ConversationsClient.data_store_path)
98+
parse_data_store_path = staticmethod(ConversationsClient.parse_data_store_path)
9799
document_path = staticmethod(ConversationsClient.document_path)
98100
parse_document_path = staticmethod(ConversationsClient.parse_document_path)
99101
generator_path = staticmethod(ConversationsClient.generator_path)

packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/services/conversations/client.py

+24
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,30 @@ def parse_cx_security_settings_path(path: str) -> Dict[str, str]:
306306
)
307307
return m.groupdict() if m else {}
308308

309+
@staticmethod
310+
def data_store_path(
311+
project: str,
312+
location: str,
313+
collection: str,
314+
data_store: str,
315+
) -> str:
316+
"""Returns a fully-qualified data_store string."""
317+
return "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}".format(
318+
project=project,
319+
location=location,
320+
collection=collection,
321+
data_store=data_store,
322+
)
323+
324+
@staticmethod
325+
def parse_data_store_path(path: str) -> Dict[str, str]:
326+
"""Parses a data_store path into its component segments."""
327+
m = re.match(
328+
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/collections/(?P<collection>.+?)/dataStores/(?P<data_store>.+?)$",
329+
path,
330+
)
331+
return m.groupdict() if m else {}
332+
309333
@staticmethod
310334
def document_path(
311335
project: str,

packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/conversation.py

+330-3
Large diffs are not rendered by default.

packages/google-cloud-dialogflow/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-dialogflow",
11-
"version": "2.35.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

packages/google-cloud-dialogflow/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2beta1.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-dialogflow",
11-
"version": "2.35.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

packages/google-cloud-dialogflow/scripts/fixup_dialogflow_v2beta1_keywords.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class dialogflowCallTransformer(cst.CSTTransformer):
122122
'reload_document': ('name', 'gcs_source', 'import_gcs_custom_metadata', ),
123123
'restore_agent': ('parent', 'agent_uri', 'agent_content', ),
124124
'search_agents': ('parent', 'page_size', 'page_token', ),
125-
'search_knowledge': ('parent', 'query', 'conversation_profile', 'session_id', 'conversation', 'latest_message', ),
125+
'search_knowledge': ('parent', 'query', 'conversation_profile', 'session_id', 'conversation', 'latest_message', 'query_source', 'end_user_metadata', 'search_config', 'exact_search', ),
126126
'set_agent': ('agent', 'update_mask', ),
127127
'set_suggestion_feature_config': ('conversation_profile', 'participant_role', 'suggestion_feature_config', ),
128128
'streaming_analyze_content': ('participant', 'audio_config', 'text_config', 'reply_audio_config', 'input_audio', 'input_text', 'input_dtmf', 'input_intent', 'input_event', 'query_params', 'assist_query_params', 'cx_parameters', 'cx_current_page', 'enable_extended_streaming', 'enable_partial_automated_agent_reply', 'enable_debugging_info', ),

packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_conversations.py

+71-40
Original file line numberDiff line numberDiff line change
@@ -9624,10 +9624,41 @@ def test_parse_cx_security_settings_path():
96249624
assert expected == actual
96259625

96269626

9627-
def test_document_path():
9627+
def test_data_store_path():
96289628
project = "whelk"
9629-
knowledge_base = "octopus"
9630-
document = "oyster"
9629+
location = "octopus"
9630+
collection = "oyster"
9631+
data_store = "nudibranch"
9632+
expected = "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}".format(
9633+
project=project,
9634+
location=location,
9635+
collection=collection,
9636+
data_store=data_store,
9637+
)
9638+
actual = ConversationsClient.data_store_path(
9639+
project, location, collection, data_store
9640+
)
9641+
assert expected == actual
9642+
9643+
9644+
def test_parse_data_store_path():
9645+
expected = {
9646+
"project": "cuttlefish",
9647+
"location": "mussel",
9648+
"collection": "winkle",
9649+
"data_store": "nautilus",
9650+
}
9651+
path = ConversationsClient.data_store_path(**expected)
9652+
9653+
# Check that the path construction is reversible.
9654+
actual = ConversationsClient.parse_data_store_path(path)
9655+
assert expected == actual
9656+
9657+
9658+
def test_document_path():
9659+
project = "scallop"
9660+
knowledge_base = "abalone"
9661+
document = "squid"
96319662
expected = "projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}".format(
96329663
project=project,
96339664
knowledge_base=knowledge_base,
@@ -9639,9 +9670,9 @@ def test_document_path():
96399670

96409671
def test_parse_document_path():
96419672
expected = {
9642-
"project": "nudibranch",
9643-
"knowledge_base": "cuttlefish",
9644-
"document": "mussel",
9673+
"project": "clam",
9674+
"knowledge_base": "whelk",
9675+
"document": "octopus",
96459676
}
96469677
path = ConversationsClient.document_path(**expected)
96479678

@@ -9651,9 +9682,9 @@ def test_parse_document_path():
96519682

96529683

96539684
def test_generator_path():
9654-
project = "winkle"
9655-
location = "nautilus"
9656-
generator = "scallop"
9685+
project = "oyster"
9686+
location = "nudibranch"
9687+
generator = "cuttlefish"
96579688
expected = "projects/{project}/locations/{location}/generators/{generator}".format(
96589689
project=project,
96599690
location=location,
@@ -9665,9 +9696,9 @@ def test_generator_path():
96659696

96669697
def test_parse_generator_path():
96679698
expected = {
9668-
"project": "abalone",
9669-
"location": "squid",
9670-
"generator": "clam",
9699+
"project": "mussel",
9700+
"location": "winkle",
9701+
"generator": "nautilus",
96719702
}
96729703
path = ConversationsClient.generator_path(**expected)
96739704

@@ -9677,8 +9708,8 @@ def test_parse_generator_path():
96779708

96789709

96799710
def test_knowledge_base_path():
9680-
project = "whelk"
9681-
knowledge_base = "octopus"
9711+
project = "scallop"
9712+
knowledge_base = "abalone"
96829713
expected = "projects/{project}/knowledgeBases/{knowledge_base}".format(
96839714
project=project,
96849715
knowledge_base=knowledge_base,
@@ -9689,8 +9720,8 @@ def test_knowledge_base_path():
96899720

96909721
def test_parse_knowledge_base_path():
96919722
expected = {
9692-
"project": "oyster",
9693-
"knowledge_base": "nudibranch",
9723+
"project": "squid",
9724+
"knowledge_base": "clam",
96949725
}
96959726
path = ConversationsClient.knowledge_base_path(**expected)
96969727

@@ -9700,9 +9731,9 @@ def test_parse_knowledge_base_path():
97009731

97019732

97029733
def test_message_path():
9703-
project = "cuttlefish"
9704-
conversation = "mussel"
9705-
message = "winkle"
9734+
project = "whelk"
9735+
conversation = "octopus"
9736+
message = "oyster"
97069737
expected = (
97079738
"projects/{project}/conversations/{conversation}/messages/{message}".format(
97089739
project=project,
@@ -9716,9 +9747,9 @@ def test_message_path():
97169747

97179748
def test_parse_message_path():
97189749
expected = {
9719-
"project": "nautilus",
9720-
"conversation": "scallop",
9721-
"message": "abalone",
9750+
"project": "nudibranch",
9751+
"conversation": "cuttlefish",
9752+
"message": "mussel",
97229753
}
97239754
path = ConversationsClient.message_path(**expected)
97249755

@@ -9728,9 +9759,9 @@ def test_parse_message_path():
97289759

97299760

97309761
def test_phrase_set_path():
9731-
project = "squid"
9732-
location = "clam"
9733-
phrase_set = "whelk"
9762+
project = "winkle"
9763+
location = "nautilus"
9764+
phrase_set = "scallop"
97349765
expected = "projects/{project}/locations/{location}/phraseSets/{phrase_set}".format(
97359766
project=project,
97369767
location=location,
@@ -9742,9 +9773,9 @@ def test_phrase_set_path():
97429773

97439774
def test_parse_phrase_set_path():
97449775
expected = {
9745-
"project": "octopus",
9746-
"location": "oyster",
9747-
"phrase_set": "nudibranch",
9776+
"project": "abalone",
9777+
"location": "squid",
9778+
"phrase_set": "clam",
97489779
}
97499780
path = ConversationsClient.phrase_set_path(**expected)
97509781

@@ -9754,7 +9785,7 @@ def test_parse_phrase_set_path():
97549785

97559786

97569787
def test_common_billing_account_path():
9757-
billing_account = "cuttlefish"
9788+
billing_account = "whelk"
97589789
expected = "billingAccounts/{billing_account}".format(
97599790
billing_account=billing_account,
97609791
)
@@ -9764,7 +9795,7 @@ def test_common_billing_account_path():
97649795

97659796
def test_parse_common_billing_account_path():
97669797
expected = {
9767-
"billing_account": "mussel",
9798+
"billing_account": "octopus",
97689799
}
97699800
path = ConversationsClient.common_billing_account_path(**expected)
97709801

@@ -9774,7 +9805,7 @@ def test_parse_common_billing_account_path():
97749805

97759806

97769807
def test_common_folder_path():
9777-
folder = "winkle"
9808+
folder = "oyster"
97789809
expected = "folders/{folder}".format(
97799810
folder=folder,
97809811
)
@@ -9784,7 +9815,7 @@ def test_common_folder_path():
97849815

97859816
def test_parse_common_folder_path():
97869817
expected = {
9787-
"folder": "nautilus",
9818+
"folder": "nudibranch",
97889819
}
97899820
path = ConversationsClient.common_folder_path(**expected)
97909821

@@ -9794,7 +9825,7 @@ def test_parse_common_folder_path():
97949825

97959826

97969827
def test_common_organization_path():
9797-
organization = "scallop"
9828+
organization = "cuttlefish"
97989829
expected = "organizations/{organization}".format(
97999830
organization=organization,
98009831
)
@@ -9804,7 +9835,7 @@ def test_common_organization_path():
98049835

98059836
def test_parse_common_organization_path():
98069837
expected = {
9807-
"organization": "abalone",
9838+
"organization": "mussel",
98089839
}
98099840
path = ConversationsClient.common_organization_path(**expected)
98109841

@@ -9814,7 +9845,7 @@ def test_parse_common_organization_path():
98149845

98159846

98169847
def test_common_project_path():
9817-
project = "squid"
9848+
project = "winkle"
98189849
expected = "projects/{project}".format(
98199850
project=project,
98209851
)
@@ -9824,7 +9855,7 @@ def test_common_project_path():
98249855

98259856
def test_parse_common_project_path():
98269857
expected = {
9827-
"project": "clam",
9858+
"project": "nautilus",
98289859
}
98299860
path = ConversationsClient.common_project_path(**expected)
98309861

@@ -9834,8 +9865,8 @@ def test_parse_common_project_path():
98349865

98359866

98369867
def test_common_location_path():
9837-
project = "whelk"
9838-
location = "octopus"
9868+
project = "scallop"
9869+
location = "abalone"
98399870
expected = "projects/{project}/locations/{location}".format(
98409871
project=project,
98419872
location=location,
@@ -9846,8 +9877,8 @@ def test_common_location_path():
98469877

98479878
def test_parse_common_location_path():
98489879
expected = {
9849-
"project": "oyster",
9850-
"location": "nudibranch",
9880+
"project": "squid",
9881+
"location": "clam",
98519882
}
98529883
path = ConversationsClient.common_location_path(**expected)
98539884

0 commit comments

Comments
 (0)