Skip to content

Commit

Permalink
feat: [google-cloud-dialogflow] add options of query_source, search_c…
Browse files Browse the repository at this point in the history
…onfig, 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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Nov 14, 2024
1 parent cef77c3 commit 28eb346
Show file tree
Hide file tree
Showing 10 changed files with 433 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "2.35.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "2.35.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "2.35.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ class ConversationsAsyncClient:
parse_cx_security_settings_path = staticmethod(
ConversationsClient.parse_cx_security_settings_path
)
data_store_path = staticmethod(ConversationsClient.data_store_path)
parse_data_store_path = staticmethod(ConversationsClient.parse_data_store_path)
document_path = staticmethod(ConversationsClient.document_path)
parse_document_path = staticmethod(ConversationsClient.parse_document_path)
generator_path = staticmethod(ConversationsClient.generator_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,30 @@ def parse_cx_security_settings_path(path: str) -> Dict[str, str]:
)
return m.groupdict() if m else {}

@staticmethod
def data_store_path(
project: str,
location: str,
collection: str,
data_store: str,
) -> str:
"""Returns a fully-qualified data_store string."""
return "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}".format(
project=project,
location=location,
collection=collection,
data_store=data_store,
)

@staticmethod
def parse_data_store_path(path: str) -> Dict[str, str]:
"""Parses a data_store path into its component segments."""
m = re.match(
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/collections/(?P<collection>.+?)/dataStores/(?P<data_store>.+?)$",
path,
)
return m.groupdict() if m else {}

@staticmethod
def document_path(
project: str,
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-dialogflow",
"version": "2.35.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-dialogflow",
"version": "2.35.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class dialogflowCallTransformer(cst.CSTTransformer):
'reload_document': ('name', 'gcs_source', 'import_gcs_custom_metadata', ),
'restore_agent': ('parent', 'agent_uri', 'agent_content', ),
'search_agents': ('parent', 'page_size', 'page_token', ),
'search_knowledge': ('parent', 'query', 'conversation_profile', 'session_id', 'conversation', 'latest_message', ),
'search_knowledge': ('parent', 'query', 'conversation_profile', 'session_id', 'conversation', 'latest_message', 'query_source', 'end_user_metadata', 'search_config', 'exact_search', ),
'set_agent': ('agent', 'update_mask', ),
'set_suggestion_feature_config': ('conversation_profile', 'participant_role', 'suggestion_feature_config', ),
'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', ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9624,10 +9624,41 @@ def test_parse_cx_security_settings_path():
assert expected == actual


def test_document_path():
def test_data_store_path():
project = "whelk"
knowledge_base = "octopus"
document = "oyster"
location = "octopus"
collection = "oyster"
data_store = "nudibranch"
expected = "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}".format(
project=project,
location=location,
collection=collection,
data_store=data_store,
)
actual = ConversationsClient.data_store_path(
project, location, collection, data_store
)
assert expected == actual


def test_parse_data_store_path():
expected = {
"project": "cuttlefish",
"location": "mussel",
"collection": "winkle",
"data_store": "nautilus",
}
path = ConversationsClient.data_store_path(**expected)

# Check that the path construction is reversible.
actual = ConversationsClient.parse_data_store_path(path)
assert expected == actual


def test_document_path():
project = "scallop"
knowledge_base = "abalone"
document = "squid"
expected = "projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}".format(
project=project,
knowledge_base=knowledge_base,
Expand All @@ -9639,9 +9670,9 @@ def test_document_path():

def test_parse_document_path():
expected = {
"project": "nudibranch",
"knowledge_base": "cuttlefish",
"document": "mussel",
"project": "clam",
"knowledge_base": "whelk",
"document": "octopus",
}
path = ConversationsClient.document_path(**expected)

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


def test_generator_path():
project = "winkle"
location = "nautilus"
generator = "scallop"
project = "oyster"
location = "nudibranch"
generator = "cuttlefish"
expected = "projects/{project}/locations/{location}/generators/{generator}".format(
project=project,
location=location,
Expand All @@ -9665,9 +9696,9 @@ def test_generator_path():

def test_parse_generator_path():
expected = {
"project": "abalone",
"location": "squid",
"generator": "clam",
"project": "mussel",
"location": "winkle",
"generator": "nautilus",
}
path = ConversationsClient.generator_path(**expected)

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


def test_knowledge_base_path():
project = "whelk"
knowledge_base = "octopus"
project = "scallop"
knowledge_base = "abalone"
expected = "projects/{project}/knowledgeBases/{knowledge_base}".format(
project=project,
knowledge_base=knowledge_base,
Expand All @@ -9689,8 +9720,8 @@ def test_knowledge_base_path():

def test_parse_knowledge_base_path():
expected = {
"project": "oyster",
"knowledge_base": "nudibranch",
"project": "squid",
"knowledge_base": "clam",
}
path = ConversationsClient.knowledge_base_path(**expected)

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


def test_message_path():
project = "cuttlefish"
conversation = "mussel"
message = "winkle"
project = "whelk"
conversation = "octopus"
message = "oyster"
expected = (
"projects/{project}/conversations/{conversation}/messages/{message}".format(
project=project,
Expand All @@ -9716,9 +9747,9 @@ def test_message_path():

def test_parse_message_path():
expected = {
"project": "nautilus",
"conversation": "scallop",
"message": "abalone",
"project": "nudibranch",
"conversation": "cuttlefish",
"message": "mussel",
}
path = ConversationsClient.message_path(**expected)

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


def test_phrase_set_path():
project = "squid"
location = "clam"
phrase_set = "whelk"
project = "winkle"
location = "nautilus"
phrase_set = "scallop"
expected = "projects/{project}/locations/{location}/phraseSets/{phrase_set}".format(
project=project,
location=location,
Expand All @@ -9742,9 +9773,9 @@ def test_phrase_set_path():

def test_parse_phrase_set_path():
expected = {
"project": "octopus",
"location": "oyster",
"phrase_set": "nudibranch",
"project": "abalone",
"location": "squid",
"phrase_set": "clam",
}
path = ConversationsClient.phrase_set_path(**expected)

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


def test_common_billing_account_path():
billing_account = "cuttlefish"
billing_account = "whelk"
expected = "billingAccounts/{billing_account}".format(
billing_account=billing_account,
)
Expand All @@ -9764,7 +9795,7 @@ def test_common_billing_account_path():

def test_parse_common_billing_account_path():
expected = {
"billing_account": "mussel",
"billing_account": "octopus",
}
path = ConversationsClient.common_billing_account_path(**expected)

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


def test_common_folder_path():
folder = "winkle"
folder = "oyster"
expected = "folders/{folder}".format(
folder=folder,
)
Expand All @@ -9784,7 +9815,7 @@ def test_common_folder_path():

def test_parse_common_folder_path():
expected = {
"folder": "nautilus",
"folder": "nudibranch",
}
path = ConversationsClient.common_folder_path(**expected)

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


def test_common_organization_path():
organization = "scallop"
organization = "cuttlefish"
expected = "organizations/{organization}".format(
organization=organization,
)
Expand All @@ -9804,7 +9835,7 @@ def test_common_organization_path():

def test_parse_common_organization_path():
expected = {
"organization": "abalone",
"organization": "mussel",
}
path = ConversationsClient.common_organization_path(**expected)

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


def test_common_project_path():
project = "squid"
project = "winkle"
expected = "projects/{project}".format(
project=project,
)
Expand All @@ -9824,7 +9855,7 @@ def test_common_project_path():

def test_parse_common_project_path():
expected = {
"project": "clam",
"project": "nautilus",
}
path = ConversationsClient.common_project_path(**expected)

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


def test_common_location_path():
project = "whelk"
location = "octopus"
project = "scallop"
location = "abalone"
expected = "projects/{project}/locations/{location}".format(
project=project,
location=location,
Expand All @@ -9846,8 +9877,8 @@ def test_common_location_path():

def test_parse_common_location_path():
expected = {
"project": "oyster",
"location": "nudibranch",
"project": "squid",
"location": "clam",
}
path = ConversationsClient.common_location_path(**expected)

Expand Down

0 comments on commit 28eb346

Please sign in to comment.