Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

Commit

Permalink
feat(v3beta1): add advanced settings for agent level (#138)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 387851191

Source-Link: googleapis/googleapis@5af6d9b

Source-Link: https://github.com/googleapis/googleapis-gen/commit/d323f766c0c6406e6a7bfae91ebaefb0819a3681

feat(v3beta1): add rollout config, state and failure reason for experiment
feat(v3beta1): add insights export settings for security setting
feat(v3beta1): add language code for streaming recognition result and flow versions for query parameters
docs(v3beta1): deprecate legacy logging settings
  • Loading branch information
gcf-owl-bot[bot] authored Aug 2, 2021
1 parent 24ef477 commit 96141a1
Show file tree
Hide file tree
Showing 14 changed files with 300 additions and 25 deletions.
6 changes: 6 additions & 0 deletions google/cloud/dialogflowcx_v3beta1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from .services.webhooks import WebhooksClient
from .services.webhooks import WebhooksAsyncClient

from .types.advanced_settings import AdvancedSettings
from .types.agent import Agent
from .types.agent import AgentValidationResult
from .types.agent import CreateAgentRequest
Expand Down Expand Up @@ -94,6 +95,8 @@
from .types.experiment import GetExperimentRequest
from .types.experiment import ListExperimentsRequest
from .types.experiment import ListExperimentsResponse
from .types.experiment import RolloutConfig
from .types.experiment import RolloutState
from .types.experiment import StartExperimentRequest
from .types.experiment import StopExperimentRequest
from .types.experiment import UpdateExperimentRequest
Expand Down Expand Up @@ -247,6 +250,7 @@
"TransitionRouteGroupsAsyncClient",
"VersionsAsyncClient",
"WebhooksAsyncClient",
"AdvancedSettings",
"Agent",
"AgentValidationResult",
"AgentsClient",
Expand Down Expand Up @@ -386,6 +390,8 @@
"ResourceName",
"ResponseMessage",
"RestoreAgentRequest",
"RolloutConfig",
"RolloutState",
"RunContinuousTestMetadata",
"RunContinuousTestRequest",
"RunContinuousTestResponse",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from google.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.dialogflowcx_v3beta1.services.agents import pagers
from google.cloud.dialogflowcx_v3beta1.types import advanced_settings
from google.cloud.dialogflowcx_v3beta1.types import agent
from google.cloud.dialogflowcx_v3beta1.types import agent as gcdc_agent
from google.cloud.dialogflowcx_v3beta1.types import flow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from google.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.dialogflowcx_v3beta1.services.agents import pagers
from google.cloud.dialogflowcx_v3beta1.types import advanced_settings
from google.cloud.dialogflowcx_v3beta1.types import agent
from google.cloud.dialogflowcx_v3beta1.types import agent as gcdc_agent
from google.cloud.dialogflowcx_v3beta1.types import flow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ class SessionsAsyncClient:
parse_transition_route_group_path = staticmethod(
SessionsClient.parse_transition_route_group_path
)
version_path = staticmethod(SessionsClient.version_path)
parse_version_path = staticmethod(SessionsClient.parse_version_path)
webhook_path = staticmethod(SessionsClient.webhook_path)
parse_webhook_path = staticmethod(SessionsClient.parse_webhook_path)
common_billing_account_path = staticmethod(
Expand Down
18 changes: 18 additions & 0 deletions google/cloud/dialogflowcx_v3beta1/services/sessions/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,24 @@ def parse_transition_route_group_path(path: str) -> Dict[str, str]:
)
return m.groupdict() if m else {}

@staticmethod
def version_path(
project: str, location: str, agent: str, flow: str, version: str,
) -> str:
"""Returns a fully-qualified version string."""
return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format(
project=project, location=location, agent=agent, flow=flow, version=version,
)

@staticmethod
def parse_version_path(path: str) -> Dict[str, str]:
"""Parses a version path into its component segments."""
m = re.match(
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/agents/(?P<agent>.+?)/flows/(?P<flow>.+?)/versions/(?P<version>.+?)$",
path,
)
return m.groupdict() if m else {}

@staticmethod
def webhook_path(project: str, location: str, agent: str, webhook: str,) -> str:
"""Returns a fully-qualified webhook string."""
Expand Down
6 changes: 6 additions & 0 deletions google/cloud/dialogflowcx_v3beta1/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from .advanced_settings import AdvancedSettings
from .agent import (
Agent,
AgentValidationResult,
Expand Down Expand Up @@ -73,6 +74,8 @@
GetExperimentRequest,
ListExperimentsRequest,
ListExperimentsResponse,
RolloutConfig,
RolloutState,
StartExperimentRequest,
StopExperimentRequest,
UpdateExperimentRequest,
Expand Down Expand Up @@ -235,6 +238,7 @@
)

__all__ = (
"AdvancedSettings",
"Agent",
"AgentValidationResult",
"CreateAgentRequest",
Expand Down Expand Up @@ -286,6 +290,8 @@
"GetExperimentRequest",
"ListExperimentsRequest",
"ListExperimentsResponse",
"RolloutConfig",
"RolloutState",
"StartExperimentRequest",
"StopExperimentRequest",
"UpdateExperimentRequest",
Expand Down
57 changes: 57 additions & 0 deletions google/cloud/dialogflowcx_v3beta1/types/advanced_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import proto # type: ignore


__protobuf__ = proto.module(
package="google.cloud.dialogflow.cx.v3beta1", manifest={"AdvancedSettings",},
)


class AdvancedSettings(proto.Message):
r"""Hierarchical advanced settings for
agent/flow/page/fulfillment/parameter. Settings exposed at lower
level overrides the settings exposed at higher level.
Hierarchy: Agent->Flow->Page->Fulfillment/Parameter.
Attributes:
logging_settings (google.cloud.dialogflowcx_v3beta1.types.AdvancedSettings.LoggingSettings):
Settings for logging.
Settings for Dialogflow History, Contact Center
messages, StackDriver logs, and speech logging.
Exposed at the following levels:
- Agent level.
"""

class LoggingSettings(proto.Message):
r"""Define behaviors on logging.
Attributes:
enable_stackdriver_logging (bool):
If true, StackDriver logging is currently
enabled.
enable_interaction_logging (bool):
If true, DF Interaction logging is currently
enabled.
"""

enable_stackdriver_logging = proto.Field(proto.BOOL, number=2,)
enable_interaction_logging = proto.Field(proto.BOOL, number=3,)

logging_settings = proto.Field(proto.MESSAGE, number=6, message=LoggingSettings,)


__all__ = tuple(sorted(__protobuf__.manifest))
17 changes: 15 additions & 2 deletions google/cloud/dialogflowcx_v3beta1/types/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#
import proto # type: ignore

from google.cloud.dialogflowcx_v3beta1.types import (
advanced_settings as gcdc_advanced_settings,
)
from google.cloud.dialogflowcx_v3beta1.types import flow
from google.protobuf import field_mask_pb2 # type: ignore

Expand Down Expand Up @@ -114,11 +117,18 @@ class Agent(proto.Message):
reference for the agent. Format:
``projects/<Project ID>/locations/<Location ID>/securitySettings/<Security Settings ID>``.
enable_stackdriver_logging (bool):
Indicates if stackdriver logging is enabled
for the agent.
Indicates if stackdriver logging is enabled for the agent.
Please use
[agent.advanced_settings][google.cloud.dialogflow.cx.v3beta1.AdvancedSettings.LoggingSettings]
instead.
enable_spell_correction (bool):
Indicates if automatic spell correction is
enabled in detect intent requests.
advanced_settings (google.cloud.dialogflowcx_v3beta1.types.AdvancedSettings):
Hierarchical advanced settings for this
agent. The settings exposed at the lower level
overrides the settings exposed at the higher
level.
"""

name = proto.Field(proto.STRING, number=1,)
Expand All @@ -135,6 +145,9 @@ class Agent(proto.Message):
security_settings = proto.Field(proto.STRING, number=17,)
enable_stackdriver_logging = proto.Field(proto.BOOL, number=18,)
enable_spell_correction = proto.Field(proto.BOOL, number=20,)
advanced_settings = proto.Field(
proto.MESSAGE, number=22, message=gcdc_advanced_settings.AdvancedSettings,
)


class ListAgentsRequest(proto.Message):
Expand Down
92 changes: 89 additions & 3 deletions google/cloud/dialogflowcx_v3beta1/types/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
manifest={
"Experiment",
"VersionVariants",
"RolloutConfig",
"RolloutState",
"VariantsHistory",
"ListExperimentsRequest",
"ListExperimentsResponse",
Expand Down Expand Up @@ -57,12 +59,26 @@ class Experiment(proto.Message):
state (google.cloud.dialogflowcx_v3beta1.types.Experiment.State):
The current state of the experiment.
Transition triggered by
Expriments.StartExperiment: PENDING->RUNNING.
Experiments.StartExperiment: DRAFT->RUNNING.
Transition triggered by
Expriments.CancelExperiment: PENDING->CANCELLED
or RUNNING->CANCELLED.
Experiments.CancelExperiment: DRAFT->DONE or
RUNNING->DONE.
definition (google.cloud.dialogflowcx_v3beta1.types.Experiment.Definition):
The definition of the experiment.
rollout_config (google.cloud.dialogflowcx_v3beta1.types.RolloutConfig):
The configuration for auto rollout. If set,
there should be exactly two variants in the
experiment (control variant being the default
version of the flow), the traffic allocation for
the non-control variant will gradually increase
to 100% when conditions are met, and eventually
replace the control variant to become the
default version of the flow.
rollout_state (google.cloud.dialogflowcx_v3beta1.types.RolloutState):
State of the auto rollout process.
rollout_failure_reason (str):
The reason why rollout has failed. Should only be set when
state is ROLLOUT_FAILED.
result (google.cloud.dialogflowcx_v3beta1.types.Experiment.Result):
Inference result of the experiment.
create_time (google.protobuf.timestamp_pb2.Timestamp):
Expand Down Expand Up @@ -90,6 +106,7 @@ class State(proto.Enum):
DRAFT = 1
RUNNING = 2
DONE = 3
ROLLOUT_FAILED = 4

class Definition(proto.Message):
r"""Definition of the experiment.
Expand Down Expand Up @@ -226,6 +243,9 @@ class VersionMetrics(proto.Message):
description = proto.Field(proto.STRING, number=3,)
state = proto.Field(proto.ENUM, number=4, enum=State,)
definition = proto.Field(proto.MESSAGE, number=5, message=Definition,)
rollout_config = proto.Field(proto.MESSAGE, number=14, message="RolloutConfig",)
rollout_state = proto.Field(proto.MESSAGE, number=15, message="RolloutState",)
rollout_failure_reason = proto.Field(proto.STRING, number=16,)
result = proto.Field(proto.MESSAGE, number=6, message=Result,)
create_time = proto.Field(proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,)
start_time = proto.Field(proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp,)
Expand Down Expand Up @@ -269,6 +289,72 @@ class Variant(proto.Message):
variants = proto.RepeatedField(proto.MESSAGE, number=1, message=Variant,)


class RolloutConfig(proto.Message):
r"""The configuration for auto rollout.
Attributes:
rollout_steps (Sequence[google.cloud.dialogflowcx_v3beta1.types.RolloutConfig.RolloutStep]):
Steps to roll out a flow version. Steps
should be sorted by percentage in ascending
order.
rollout_condition (str):
The conditions that are used to evaluate the success of a
rollout step. If not specified, all rollout steps will
proceed to the next one unless failure conditions are met.
E.g. "containment_rate > 60% AND callback_rate < 20%". See
the `conditions
reference <https://cloud.google.com/dialogflow/cx/docs/reference/condition>`__.
failure_condition (str):
The conditions that are used to evaluate the failure of a
rollout step. If not specified, no rollout steps will fail.
E.g. "containment_rate < 10% OR average_turn_count < 3". See
the `conditions
reference <https://cloud.google.com/dialogflow/cx/docs/reference/condition>`__.
"""

class RolloutStep(proto.Message):
r"""A single rollout step with specified traffic allocation.
Attributes:
display_name (str):
The name of the rollout step;
traffic_percent (int):
The percentage of traffic allocated to the flow version of
this rollout step. (0%, 100%].
min_duration (google.protobuf.duration_pb2.Duration):
The minimum time that this step should last.
Should be longer than 1 hour. If not set, the
default minimum duration for each step will be 1
hour.
"""

display_name = proto.Field(proto.STRING, number=1,)
traffic_percent = proto.Field(proto.INT32, number=2,)
min_duration = proto.Field(
proto.MESSAGE, number=3, message=duration_pb2.Duration,
)

rollout_steps = proto.RepeatedField(proto.MESSAGE, number=1, message=RolloutStep,)
rollout_condition = proto.Field(proto.STRING, number=2,)
failure_condition = proto.Field(proto.STRING, number=3,)


class RolloutState(proto.Message):
r"""State of the auto-rollout process.
Attributes:
step (str):
Display name of the current auto rollout
step.
step_index (int):
Index of the current step in the auto rollout
steps list.
start_time (google.protobuf.timestamp_pb2.Timestamp):
Start time of the current step.
"""

step = proto.Field(proto.STRING, number=1,)
step_index = proto.Field(proto.INT32, number=3,)
start_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,)


class VariantsHistory(proto.Message):
r"""The history of variants update.
Attributes:
Expand Down
Loading

0 comments on commit 96141a1

Please sign in to comment.