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

Commit

Permalink
feat(v3beta1): added support for locking an agent for changes (#281)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

feat(v3beta1): added data format specification for export agent

PiperOrigin-RevId: 437848093

Source-Link: googleapis/googleapis@daffb06

Source-Link: googleapis/googleapis-gen@b851ca5
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjg1MWNhNWNjNTkyYTViOWM4NjVjYmU2NzczNmQ2NzIwNTA3MmRjZSJ9
  • Loading branch information
gcf-owl-bot[bot] committed Mar 30, 2022
1 parent 956596a commit 72e624a
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 36 deletions.
12 changes: 9 additions & 3 deletions google/cloud/dialogflowcx_v3/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from .advanced_settings import AdvancedSettings
from .advanced_settings import (
AdvancedSettings,
)
from .agent import (
Agent,
AgentValidationResult,
Expand Down Expand Up @@ -115,7 +117,9 @@
UpdateFlowRequest,
ValidateFlowRequest,
)
from .fulfillment import Fulfillment
from .fulfillment import (
Fulfillment,
)
from .intent import (
CreateIntentRequest,
DeleteIntentRequest,
Expand All @@ -138,7 +142,9 @@
TransitionRoute,
UpdatePageRequest,
)
from .response_message import ResponseMessage
from .response_message import (
ResponseMessage,
)
from .security_settings import (
CreateSecuritySettingsRequest,
DeleteSecuritySettingsRequest,
Expand Down
25 changes: 13 additions & 12 deletions google/cloud/dialogflowcx_v3beta1/services/sessions/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,31 +385,32 @@ def request_generator():
method.
Multiple request messages should be sent in order:
1. The first message must contain
1. The first message must contain
[session][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.session],
[query_input][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.query_input]
plus optionally
[query_params][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.query_params].
If the client wants to receive an audio response, it
If the client wants to receive an audio response, it
should also contain
[output_audio_config][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.output_audio_config].
2. If
[query_input][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.query_input]
was set to
[query_input.audio.config][google.cloud.dialogflow.cx.v3beta1.AudioInput.config],
all subsequent messages must contain
all subsequent messages must contain
[query_input.audio.audio][google.cloud.dialogflow.cx.v3beta1.AudioInput.audio]
to continue with Speech recognition.
If you decide to rather detect an intent from text
to continue with Speech recognition.
If you decide to rather detect an intent from text
input after you already started Speech recognition,
please send a message with
please send a message with
[query_input.text][google.cloud.dialogflow.cx.v3beta1.QueryInput.text].
However, note that:
* Dialogflow will bill you for the audio duration so
far. * Dialogflow discards all Speech recognition
results in favor of the input text.
* Dialogflow will use the language code from the first
message.
However, note that:
* Dialogflow will bill you for the audio duration so
far. * Dialogflow discards all Speech recognition
results in favor of the input text.
* Dialogflow will use the language code from the
first message.
After you sent all input, you must half-close or abort
the request stream.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down
25 changes: 13 additions & 12 deletions google/cloud/dialogflowcx_v3beta1/services/sessions/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,31 +777,32 @@ def request_generator():
method.
Multiple request messages should be sent in order:
1. The first message must contain
1. The first message must contain
[session][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.session],
[query_input][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.query_input]
plus optionally
[query_params][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.query_params].
If the client wants to receive an audio response, it
If the client wants to receive an audio response, it
should also contain
[output_audio_config][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.output_audio_config].
2. If
[query_input][google.cloud.dialogflow.cx.v3beta1.StreamingDetectIntentRequest.query_input]
was set to
[query_input.audio.config][google.cloud.dialogflow.cx.v3beta1.AudioInput.config],
all subsequent messages must contain
all subsequent messages must contain
[query_input.audio.audio][google.cloud.dialogflow.cx.v3beta1.AudioInput.audio]
to continue with Speech recognition.
If you decide to rather detect an intent from text
to continue with Speech recognition.
If you decide to rather detect an intent from text
input after you already started Speech recognition,
please send a message with
please send a message with
[query_input.text][google.cloud.dialogflow.cx.v3beta1.QueryInput.text].
However, note that:
* Dialogflow will bill you for the audio duration so
far. * Dialogflow discards all Speech recognition
results in favor of the input text.
* Dialogflow will use the language code from the first
message.
However, note that:
* Dialogflow will bill you for the audio duration so
far. * Dialogflow discards all Speech recognition
results in favor of the input text.
* Dialogflow will use the language code from the
first message.
After you sent all input, you must half-close or abort
the request stream.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down
12 changes: 9 additions & 3 deletions google/cloud/dialogflowcx_v3beta1/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from .advanced_settings import AdvancedSettings
from .advanced_settings import (
AdvancedSettings,
)
from .agent import (
Agent,
AgentValidationResult,
Expand Down Expand Up @@ -115,7 +117,9 @@
UpdateFlowRequest,
ValidateFlowRequest,
)
from .fulfillment import Fulfillment
from .fulfillment import (
Fulfillment,
)
from .intent import (
CreateIntentRequest,
DeleteIntentRequest,
Expand All @@ -138,7 +142,9 @@
TransitionRoute,
UpdatePageRequest,
)
from .response_message import ResponseMessage
from .response_message import (
ResponseMessage,
)
from .security_settings import (
CreateSecuritySettingsRequest,
DeleteSecuritySettingsRequest,
Expand Down
21 changes: 21 additions & 0 deletions google/cloud/dialogflowcx_v3beta1/types/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ class Agent(proto.Message):
enable_spell_correction (bool):
Indicates if automatic spell correction is
enabled in detect intent requests.
locked (bool):
Indiciates whether the agent is locked for changes. If the
agent is locked, modifications to the agent will be rejected
except for [RestoreAgent][].
advanced_settings (google.cloud.dialogflowcx_v3beta1.types.AdvancedSettings):
Hierarchical advanced settings for this
agent. The settings exposed at the lower level
Expand Down Expand Up @@ -184,6 +188,10 @@ class Agent(proto.Message):
proto.BOOL,
number=20,
)
locked = proto.Field(
proto.BOOL,
number=27,
)
advanced_settings = proto.Field(
proto.MESSAGE,
number=22,
Expand Down Expand Up @@ -350,12 +358,20 @@ class ExportAgentRequest(proto.Message):
authentication must have write permissions for the object.
For more information, see `Dialogflow access
control <https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage>`__.
data_format (google.cloud.dialogflowcx_v3beta1.types.ExportAgentRequest.DataFormat):
Optional. The data format of the exported agent. If not
specified, ``BLOB`` is assumed.
environment (str):
Optional. Environment name. If not set, draft environment is
assumed. Format:
``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/environments/<Environment ID>``.
"""

class DataFormat(proto.Enum):
r"""Data format of the exported agent."""
DATA_FORMAT_UNSPECIFIED = 0
BLOB = 1

name = proto.Field(
proto.STRING,
number=1,
Expand All @@ -364,6 +380,11 @@ class ExportAgentRequest(proto.Message):
proto.STRING,
number=2,
)
data_format = proto.Field(
proto.ENUM,
number=3,
enum=DataFormat,
)
environment = proto.Field(
proto.STRING,
number=5,
Expand Down
10 changes: 5 additions & 5 deletions google/cloud/dialogflowcx_v3beta1/types/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ class StreamingDetectIntentRequest(proto.Message):
recognition, please send a message with
[query_input.text][google.cloud.dialogflow.cx.v3beta1.QueryInput.text].
However, note that:
However, note that:
- Dialogflow will bill you for the audio duration so far.
- Dialogflow discards all Speech recognition results in favor of
the input text.
- Dialogflow will use the language code from the first message.
- Dialogflow will bill you for the audio duration so far.
- Dialogflow discards all Speech recognition results in favor of
the input text.
- Dialogflow will use the language code from the first message.
After you sent all input, you must half-close or abort the request
stream.
Expand Down
2 changes: 1 addition & 1 deletion scripts/fixup_dialogflowcx_v3beta1_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class dialogflowcxCallTransformer(cst.CSTTransformer):
'delete_webhook': ('name', 'force', ),
'deploy_flow': ('environment', 'flow_version', ),
'detect_intent': ('session', 'query_input', 'query_params', 'output_audio_config', ),
'export_agent': ('name', 'agent_uri', 'environment', ),
'export_agent': ('name', 'agent_uri', 'data_format', 'environment', ),
'export_flow': ('name', 'flow_uri', 'include_referenced_flows', ),
'export_test_cases': ('parent', 'gcs_uri', 'data_format', 'filter', ),
'fulfill_intent': ('match_intent_request', 'match', 'output_audio_config', ),
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/gapic/dialogflowcx_v3beta1/test_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,7 @@ def test_get_agent(request_type, transport: str = "grpc"):
security_settings="security_settings_value",
enable_stackdriver_logging=True,
enable_spell_correction=True,
locked=True,
)
response = client.get_agent(request)

Expand All @@ -1081,6 +1082,7 @@ def test_get_agent(request_type, transport: str = "grpc"):
assert response.security_settings == "security_settings_value"
assert response.enable_stackdriver_logging is True
assert response.enable_spell_correction is True
assert response.locked is True


def test_get_agent_empty_call():
Expand Down Expand Up @@ -1128,6 +1130,7 @@ async def test_get_agent_async(
security_settings="security_settings_value",
enable_stackdriver_logging=True,
enable_spell_correction=True,
locked=True,
)
)
response = await client.get_agent(request)
Expand All @@ -1150,6 +1153,7 @@ async def test_get_agent_async(
assert response.security_settings == "security_settings_value"
assert response.enable_stackdriver_logging is True
assert response.enable_spell_correction is True
assert response.locked is True


@pytest.mark.asyncio
Expand Down Expand Up @@ -1328,6 +1332,7 @@ def test_create_agent(request_type, transport: str = "grpc"):
security_settings="security_settings_value",
enable_stackdriver_logging=True,
enable_spell_correction=True,
locked=True,
)
response = client.create_agent(request)

Expand All @@ -1349,6 +1354,7 @@ def test_create_agent(request_type, transport: str = "grpc"):
assert response.security_settings == "security_settings_value"
assert response.enable_stackdriver_logging is True
assert response.enable_spell_correction is True
assert response.locked is True


def test_create_agent_empty_call():
Expand Down Expand Up @@ -1396,6 +1402,7 @@ async def test_create_agent_async(
security_settings="security_settings_value",
enable_stackdriver_logging=True,
enable_spell_correction=True,
locked=True,
)
)
response = await client.create_agent(request)
Expand All @@ -1418,6 +1425,7 @@ async def test_create_agent_async(
assert response.security_settings == "security_settings_value"
assert response.enable_stackdriver_logging is True
assert response.enable_spell_correction is True
assert response.locked is True


@pytest.mark.asyncio
Expand Down Expand Up @@ -1606,6 +1614,7 @@ def test_update_agent(request_type, transport: str = "grpc"):
security_settings="security_settings_value",
enable_stackdriver_logging=True,
enable_spell_correction=True,
locked=True,
)
response = client.update_agent(request)

Expand All @@ -1627,6 +1636,7 @@ def test_update_agent(request_type, transport: str = "grpc"):
assert response.security_settings == "security_settings_value"
assert response.enable_stackdriver_logging is True
assert response.enable_spell_correction is True
assert response.locked is True


def test_update_agent_empty_call():
Expand Down Expand Up @@ -1674,6 +1684,7 @@ async def test_update_agent_async(
security_settings="security_settings_value",
enable_stackdriver_logging=True,
enable_spell_correction=True,
locked=True,
)
)
response = await client.update_agent(request)
Expand All @@ -1696,6 +1707,7 @@ async def test_update_agent_async(
assert response.security_settings == "security_settings_value"
assert response.enable_stackdriver_logging is True
assert response.enable_spell_correction is True
assert response.locked is True


@pytest.mark.asyncio
Expand Down

0 comments on commit 72e624a

Please sign in to comment.