Skip to content

Commit c6d9113

Browse files
feat: [google-cloud-dialogflow] add sections field to HumanAgentAssistantConfig.SuggestionQueryConfig (#12129)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: Add sections field to HumanAgentAssistantConfig.SuggestionQueryConfig feat: Add enable_conversation_augmented_query field to HumanAgentAssistantConfig.SuggestionFeatureConfig message feat: Add INTENT enum in SearchKnowledgeAnswer.AnswerType message feat: Add rewritten_query in field in SearchKnowledgeResponse message docs: Improved comments on audio_config proto END_COMMIT_OVERRIDE PiperOrigin-RevId: 591055870 Source-Link: googleapis/googleapis@2f93f44 Source-Link: googleapis/googleapis-gen@2154bfc Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRpYWxvZ2Zsb3cvLk93bEJvdC55YW1sIiwiaCI6IjIxNTRiZmMwZDUwZGJhMGI4Yjg5ODBlODAyNDNkOTI4Yzk5NzcxMDgifQ== --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent a481c80 commit c6d9113

File tree

5 files changed

+136
-30
lines changed

5 files changed

+136
-30
lines changed

packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/types/audio_config.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -409,23 +409,9 @@ class InputAudioConfig(proto.Message):
409409
documentation <https://cloud.google.com/speech-to-text/docs/basics#phrase-hints>`__
410410
for more details.
411411
model (str):
412-
Which Speech model to select for the given request. Select
413-
the model best suited to your domain to get best results. If
414-
a model is not explicitly specified, then we auto-select a
415-
model based on the parameters in the InputAudioConfig. If
416-
enhanced speech model is enabled for the agent and an
417-
enhanced version of the specified model for the language
418-
does not exist, then the speech is recognized using the
419-
standard version of the specified model. Refer to `Cloud
420-
Speech API
421-
documentation <https://cloud.google.com/speech-to-text/docs/basics#select-model>`__
422-
for more details. If you specify a model, the following
423-
models typically have the best performance:
424-
425-
- phone_call (best for Agent Assist and telephony)
426-
- latest_short (best for Dialogflow non-telephony)
427-
- command_and_search (best for very short utterances and
428-
commands)
412+
Optional. Which Speech model to select for the given
413+
request. For more information, see `Speech
414+
models <https://cloud.google.com/dialogflow/es/docs/speech-models>`__.
429415
model_variant (google.cloud.dialogflow_v2.types.SpeechModelVariant):
430416
Which variant of the [Speech
431417
model][google.cloud.dialogflow.v2.InputAudioConfig.model] to
@@ -665,10 +651,24 @@ class SpeechToTextConfig(proto.Message):
665651
model (str):
666652
Which Speech model to select. Select the model best suited
667653
to your domain to get best results. If a model is not
668-
explicitly specified, then a default model is used. Refer to
669-
`Cloud Speech API
654+
explicitly specified, then Dialogflow auto-selects a model
655+
based on other parameters in the SpeechToTextConfig and
656+
Agent settings. If enhanced speech model is enabled for the
657+
agent and an enhanced version of the specified model for the
658+
language does not exist, then the speech is recognized using
659+
the standard version of the specified model. Refer to `Cloud
660+
Speech API
670661
documentation <https://cloud.google.com/speech-to-text/docs/basics#select-model>`__
671-
for more details.
662+
for more details. If you specify a model, the following
663+
models typically have the best performance:
664+
665+
- phone_call (best for Agent Assist and telephony)
666+
- latest_short (best for Dialogflow non-telephony)
667+
- command_and_search
668+
669+
Leave this field unspecified to use `Agent Speech
670+
settings <https://cloud.google.com/dialogflow/cx/docs/concept/agent#settings-speech>`__
671+
for model selection.
672672
use_timeout_based_endpointing (bool):
673673
Use timeout based endpointing, interpreting
674674
endpointer sensitivy as seconds of timeout

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,13 +754,19 @@ class SearchKnowledgeResponse(proto.Message):
754754
Most relevant snippets extracted from
755755
articles in the given knowledge base, ordered by
756756
confidence.
757+
rewritten_query (str):
758+
The rewritten query used to search knowledge.
757759
"""
758760

759761
answers: MutableSequence["SearchKnowledgeAnswer"] = proto.RepeatedField(
760762
proto.MESSAGE,
761763
number=2,
762764
message="SearchKnowledgeAnswer",
763765
)
766+
rewritten_query: str = proto.Field(
767+
proto.STRING,
768+
number=3,
769+
)
764770

765771

766772
class SearchKnowledgeAnswer(proto.Message):
@@ -786,13 +792,16 @@ class AnswerType(proto.Enum):
786792
ANSWER_TYPE_UNSPECIFIED (0):
787793
The answer has a unspecified type.
788794
FAQ (1):
789-
The answer is from FAQ doucments.
795+
The answer is from FAQ documents.
790796
GENERATIVE (2):
791797
The answer is from generative model.
798+
INTENT (3):
799+
The answer is from intent matching.
792800
"""
793801
ANSWER_TYPE_UNSPECIFIED = 0
794802
FAQ = 1
795803
GENERATIVE = 2
804+
INTENT = 3
796805

797806
class AnswerSource(proto.Message):
798807
r"""The sources of the answers.

packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/types/conversation_profile.py

Lines changed: 90 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,12 @@ class AutomatedAgentConfig(proto.Message):
354354
If environment is not specified, the default ``draft``
355355
environment is used.
356356
session_ttl (google.protobuf.duration_pb2.Duration):
357-
Optional. Sets Dialogflow CX session life
358-
time. By default, a Dialogflow CX session
359-
remains active and its data is stored for 30
360-
minutes after the last request is sent for the
361-
session. This value should be no longer than 1
362-
day.
357+
Optional. Configure lifetime of the
358+
Dialogflow session. By default, a Dialogflow CX
359+
session remains active and its data is stored
360+
for 30 minutes after the last request is sent
361+
for the session. This value should be no longer
362+
than 1 day.
363363
"""
364364

365365
agent: str = proto.Field(
@@ -431,6 +431,9 @@ class SuggestionFeatureConfig(proto.Message):
431431
at answer records.
432432
433433
Supported features: KNOWLEDGE_SEARCH.
434+
enable_conversation_augmented_query (bool):
435+
Optional. Enable including conversation context during query
436+
answer generation. Supported features: KNOWLEDGE_SEARCH.
434437
suggestion_trigger_settings (google.cloud.dialogflow_v2.types.HumanAgentAssistantConfig.SuggestionTriggerSettings):
435438
Settings of suggestion trigger.
436439
@@ -457,6 +460,10 @@ class SuggestionFeatureConfig(proto.Message):
457460
proto.BOOL,
458461
number=14,
459462
)
463+
enable_conversation_augmented_query: bool = proto.Field(
464+
proto.BOOL,
465+
number=16,
466+
)
460467
suggestion_trigger_settings: "HumanAgentAssistantConfig.SuggestionTriggerSettings" = proto.Field(
461468
proto.MESSAGE,
462469
number=10,
@@ -569,6 +576,10 @@ class SuggestionQueryConfig(proto.Message):
569576
Determines how recent conversation context is
570577
filtered when generating suggestions. If
571578
unspecified, no messages will be dropped.
579+
sections (google.cloud.dialogflow_v2.types.HumanAgentAssistantConfig.SuggestionQueryConfig.Sections):
580+
Optional. The customized sections chosen to
581+
return when requesting a summary of a
582+
conversation.
572583
"""
573584

574585
class KnowledgeBaseQuerySource(proto.Message):
@@ -679,6 +690,72 @@ class ContextFilterSettings(proto.Message):
679690
number=3,
680691
)
681692

693+
class Sections(proto.Message):
694+
r"""Custom sections to return when requesting a summary of a
695+
conversation. This is only supported when ``baseline_model_version``
696+
== '2.0'.
697+
698+
Supported features: CONVERSATION_SUMMARIZATION,
699+
CONVERSATION_SUMMARIZATION_VOICE.
700+
701+
Attributes:
702+
section_types (MutableSequence[google.cloud.dialogflow_v2.types.HumanAgentAssistantConfig.SuggestionQueryConfig.Sections.SectionType]):
703+
The selected sections chosen to return when
704+
requesting a summary of a conversation. A
705+
duplicate selected section will be treated as a
706+
single selected section. If section types are
707+
not provided, the default will be {SITUATION,
708+
ACTION, RESULT}.
709+
"""
710+
711+
class SectionType(proto.Enum):
712+
r"""Selectable sections to return when requesting a summary of a
713+
conversation.
714+
715+
Values:
716+
SECTION_TYPE_UNSPECIFIED (0):
717+
Undefined section type, does not return
718+
anything.
719+
SITUATION (1):
720+
What the customer needs help with or has
721+
question about. Section name: "situation".
722+
ACTION (2):
723+
What the agent does to help the customer.
724+
Section name: "action".
725+
RESOLUTION (3):
726+
Result of the customer service. A single word
727+
describing the result of the conversation.
728+
Section name: "resolution".
729+
REASON_FOR_CANCELLATION (4):
730+
Reason for cancellation if the customer requests for a
731+
cancellation. "N/A" otherwise. Section name:
732+
"reason_for_cancellation".
733+
CUSTOMER_SATISFACTION (5):
734+
"Unsatisfied" or "Satisfied" depending on the customer's
735+
feelings at the end of the conversation. Section name:
736+
"customer_satisfaction".
737+
ENTITIES (6):
738+
Key entities extracted from the conversation,
739+
such as ticket number, order number, dollar
740+
amount, etc. Section names are prefixed by
741+
"entities/".
742+
"""
743+
SECTION_TYPE_UNSPECIFIED = 0
744+
SITUATION = 1
745+
ACTION = 2
746+
RESOLUTION = 3
747+
REASON_FOR_CANCELLATION = 4
748+
CUSTOMER_SATISFACTION = 5
749+
ENTITIES = 6
750+
751+
section_types: MutableSequence[
752+
"HumanAgentAssistantConfig.SuggestionQueryConfig.Sections.SectionType"
753+
] = proto.RepeatedField(
754+
proto.ENUM,
755+
number=1,
756+
enum="HumanAgentAssistantConfig.SuggestionQueryConfig.Sections.SectionType",
757+
)
758+
682759
knowledge_base_query_source: "HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource" = proto.Field(
683760
proto.MESSAGE,
684761
number=1,
@@ -710,6 +787,13 @@ class ContextFilterSettings(proto.Message):
710787
number=7,
711788
message="HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings",
712789
)
790+
sections: "HumanAgentAssistantConfig.SuggestionQueryConfig.Sections" = (
791+
proto.Field(
792+
proto.MESSAGE,
793+
number=8,
794+
message="HumanAgentAssistantConfig.SuggestionQueryConfig.Sections",
795+
)
796+
)
713797

714798
class ConversationModelConfig(proto.Message):
715799
r"""Custom conversation models used in agent assist feature.

packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversation_profiles.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3491,6 +3491,7 @@ def test_create_conversation_profile_rest(request_type):
34913491
"suggestion_feature": {"type_": 1},
34923492
"enable_event_based_suggestion": True,
34933493
"disable_agent_query_logging": True,
3494+
"enable_conversation_augmented_query": True,
34943495
"suggestion_trigger_settings": {
34953496
"no_smalltalk": True,
34963497
"only_end_user": True,
@@ -3516,6 +3517,7 @@ def test_create_conversation_profile_rest(request_type):
35163517
"drop_virtual_agent_messages": True,
35173518
"drop_ivr_messages": True,
35183519
},
3520+
"sections": {"section_types": [1]},
35193521
},
35203522
"conversation_model_config": {
35213523
"model": "model_value",
@@ -3953,6 +3955,7 @@ def test_update_conversation_profile_rest(request_type):
39533955
"suggestion_feature": {"type_": 1},
39543956
"enable_event_based_suggestion": True,
39553957
"disable_agent_query_logging": True,
3958+
"enable_conversation_augmented_query": True,
39563959
"suggestion_trigger_settings": {
39573960
"no_smalltalk": True,
39583961
"only_end_user": True,
@@ -3978,6 +3981,7 @@ def test_update_conversation_profile_rest(request_type):
39783981
"drop_virtual_agent_messages": True,
39793982
"drop_ivr_messages": True,
39803983
},
3984+
"sections": {"section_types": [1]},
39813985
},
39823986
"conversation_model_config": {
39833987
"model": "model_value",

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2819,7 +2819,9 @@ def test_search_knowledge(request_type, transport: str = "grpc"):
28192819
# Mock the actual call within the gRPC stub, and fake the request.
28202820
with mock.patch.object(type(client.transport.search_knowledge), "__call__") as call:
28212821
# Designate an appropriate return value for the call.
2822-
call.return_value = conversation.SearchKnowledgeResponse()
2822+
call.return_value = conversation.SearchKnowledgeResponse(
2823+
rewritten_query="rewritten_query_value",
2824+
)
28232825
response = client.search_knowledge(request)
28242826

28252827
# Establish that the underlying gRPC stub method was called.
@@ -2829,6 +2831,7 @@ def test_search_knowledge(request_type, transport: str = "grpc"):
28292831

28302832
# Establish that the response is the type that we expect.
28312833
assert isinstance(response, conversation.SearchKnowledgeResponse)
2834+
assert response.rewritten_query == "rewritten_query_value"
28322835

28332836

28342837
def test_search_knowledge_empty_call():
@@ -2864,7 +2867,9 @@ async def test_search_knowledge_async(
28642867
with mock.patch.object(type(client.transport.search_knowledge), "__call__") as call:
28652868
# Designate an appropriate return value for the call.
28662869
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
2867-
conversation.SearchKnowledgeResponse()
2870+
conversation.SearchKnowledgeResponse(
2871+
rewritten_query="rewritten_query_value",
2872+
)
28682873
)
28692874
response = await client.search_knowledge(request)
28702875

@@ -2875,6 +2880,7 @@ async def test_search_knowledge_async(
28752880

28762881
# Establish that the response is the type that we expect.
28772882
assert isinstance(response, conversation.SearchKnowledgeResponse)
2883+
assert response.rewritten_query == "rewritten_query_value"
28782884

28792885

28802886
@pytest.mark.asyncio
@@ -5088,7 +5094,9 @@ def test_search_knowledge_rest(request_type):
50885094
# Mock the http request call within the method and fake a response.
50895095
with mock.patch.object(type(client.transport._session), "request") as req:
50905096
# Designate an appropriate value for the returned response.
5091-
return_value = conversation.SearchKnowledgeResponse()
5097+
return_value = conversation.SearchKnowledgeResponse(
5098+
rewritten_query="rewritten_query_value",
5099+
)
50925100

50935101
# Wrap the value into a proper Response obj
50945102
response_value = Response()
@@ -5103,6 +5111,7 @@ def test_search_knowledge_rest(request_type):
51035111

51045112
# Establish that the response is the type that we expect.
51055113
assert isinstance(response, conversation.SearchKnowledgeResponse)
5114+
assert response.rewritten_query == "rewritten_query_value"
51065115

51075116

51085117
def test_search_knowledge_rest_required_fields(

0 commit comments

Comments
 (0)