Skip to content

Commit a481c80

Browse files
feat: [google-cloud-dialogflow] add sections field to HumanAgentAssistantConfig.SuggestionQueryConfig (googleapis#12128)
- [ ] 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: 591042460 Source-Link: googleapis/googleapis@8e2e403 Source-Link: https://github.com/googleapis/googleapis-gen/commit/c8cdc4d386352c860fce2b6efc5c02e680403a3d Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRpYWxvZ2Zsb3cvLk93bEJvdC55YW1sIiwiaCI6ImM4Y2RjNGQzODYzNTJjODYwZmNlMmI2ZWZjNWMwMmU2ODA0MDNhM2QifQ== --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent e063fa9 commit a481c80

10 files changed

Lines changed: 141 additions & 35 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
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.26.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

Lines changed: 1 addition & 1 deletion
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.26.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

Lines changed: 1 addition & 1 deletion
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.26.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -471,23 +471,9 @@ class InputAudioConfig(proto.Message):
471471
documentation <https://cloud.google.com/speech-to-text/docs/basics#phrase-hints>`__
472472
for more details.
473473
model (str):
474-
Which Speech model to select for the given request. Select
475-
the model best suited to your domain to get best results. If
476-
a model is not explicitly specified, then we auto-select a
477-
model based on the parameters in the InputAudioConfig. If
478-
enhanced speech model is enabled for the agent and an
479-
enhanced version of the specified model for the language
480-
does not exist, then the speech is recognized using the
481-
standard version of the specified model. Refer to `Cloud
482-
Speech API
483-
documentation <https://cloud.google.com/speech-to-text/docs/basics#select-model>`__
484-
for more details. If you specify a model, the following
485-
models typically have the best performance:
486-
487-
- phone_call (best for Agent Assist and telephony)
488-
- latest_short (best for Dialogflow non-telephony)
489-
- command_and_search (best for very short utterances and
490-
commands)
474+
Optional. Which Speech model to select for the given
475+
request. For more information, see `Speech
476+
models <https://cloud.google.com/dialogflow/es/docs/speech-models>`__.
491477
model_variant (google.cloud.dialogflow_v2beta1.types.SpeechModelVariant):
492478
Which variant of the [Speech
493479
model][google.cloud.dialogflow.v2beta1.InputAudioConfig.model]
@@ -739,10 +725,24 @@ class SpeechToTextConfig(proto.Message):
739725
model (str):
740726
Which Speech model to select. Select the model best suited
741727
to your domain to get best results. If a model is not
742-
explicitly specified, then a default model is used. Refer to
743-
`Cloud Speech API
728+
explicitly specified, then Dialogflow auto-selects a model
729+
based on other parameters in the SpeechToTextConfig and
730+
Agent settings. If enhanced speech model is enabled for the
731+
agent and an enhanced version of the specified model for the
732+
language does not exist, then the speech is recognized using
733+
the standard version of the specified model. Refer to `Cloud
734+
Speech API
744735
documentation <https://cloud.google.com/speech-to-text/docs/basics#select-model>`__
745-
for more details.
736+
for more details. If you specify a model, the following
737+
models typically have the best performance:
738+
739+
- phone_call (best for Agent Assist and telephony)
740+
- latest_short (best for Dialogflow non-telephony)
741+
- command_and_search
742+
743+
Leave this field unspecified to use `Agent Speech
744+
settings <https://cloud.google.com/dialogflow/cx/docs/concept/agent#settings-speech>`__
745+
for model selection.
746746
use_timeout_based_endpointing (bool):
747747
Use timeout based endpointing, interpreting
748748
endpointer sensitivy as seconds of timeout

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,13 +826,19 @@ class SearchKnowledgeResponse(proto.Message):
826826
Most relevant snippets extracted from
827827
articles in the given knowledge base, ordered by
828828
confidence.
829+
rewritten_query (str):
830+
The rewritten query used to search knowledge.
829831
"""
830832

831833
answers: MutableSequence["SearchKnowledgeAnswer"] = proto.RepeatedField(
832834
proto.MESSAGE,
833835
number=2,
834836
message="SearchKnowledgeAnswer",
835837
)
838+
rewritten_query: str = proto.Field(
839+
proto.STRING,
840+
number=3,
841+
)
836842

837843

838844
class SearchKnowledgeAnswer(proto.Message):
@@ -858,13 +864,16 @@ class AnswerType(proto.Enum):
858864
ANSWER_TYPE_UNSPECIFIED (0):
859865
The answer has a unspecified type.
860866
FAQ (1):
861-
The answer is from FAQ doucments.
867+
The answer is from FAQ documents.
862868
GENERATIVE (2):
863869
The answer is from generative model.
870+
INTENT (3):
871+
The answer is from intent matching.
864872
"""
865873
ANSWER_TYPE_UNSPECIFIED = 0
866874
FAQ = 1
867875
GENERATIVE = 2
876+
INTENT = 3
868877

869878
class AnswerSource(proto.Message):
870879
r"""The sources of the answers.

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

Lines changed: 90 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,12 @@ class AutomatedAgentConfig(proto.Message):
208208
If environment is not specified, the default ``draft``
209209
environment is used.
210210
session_ttl (google.protobuf.duration_pb2.Duration):
211-
Optional. Sets Dialogflow CX session life
212-
time. By default, a Dialogflow CX session
213-
remains active and its data is stored for 30
214-
minutes after the last request is sent for the
215-
session. This value should be no longer than 1
216-
day.
211+
Optional. Configure lifetime of the
212+
Dialogflow session. By default, a Dialogflow CX
213+
session remains active and its data is stored
214+
for 30 minutes after the last request is sent
215+
for the session. This value should be no longer
216+
than 1 day.
217217
"""
218218

219219
agent: str = proto.Field(
@@ -286,6 +286,9 @@ class SuggestionFeatureConfig(proto.Message):
286286
at answer records.
287287
288288
Supported features: KNOWLEDGE_SEARCH.
289+
enable_conversation_augmented_query (bool):
290+
Optional. Enable including conversation context during query
291+
answer generation. Supported features: KNOWLEDGE_SEARCH.
289292
suggestion_trigger_settings (google.cloud.dialogflow_v2beta1.types.HumanAgentAssistantConfig.SuggestionTriggerSettings):
290293
Settings of suggestion trigger.
291294
@@ -312,6 +315,10 @@ class SuggestionFeatureConfig(proto.Message):
312315
proto.BOOL,
313316
number=14,
314317
)
318+
enable_conversation_augmented_query: bool = proto.Field(
319+
proto.BOOL,
320+
number=16,
321+
)
315322
suggestion_trigger_settings: "HumanAgentAssistantConfig.SuggestionTriggerSettings" = proto.Field(
316323
proto.MESSAGE,
317324
number=10,
@@ -424,6 +431,10 @@ class SuggestionQueryConfig(proto.Message):
424431
Determines how recent conversation context is
425432
filtered when generating suggestions. If
426433
unspecified, no messages will be dropped.
434+
sections (google.cloud.dialogflow_v2beta1.types.HumanAgentAssistantConfig.SuggestionQueryConfig.Sections):
435+
Optional. The customized sections chosen to
436+
return when requesting a summary of a
437+
conversation.
427438
"""
428439

429440
class KnowledgeBaseQuerySource(proto.Message):
@@ -534,6 +545,72 @@ class ContextFilterSettings(proto.Message):
534545
number=3,
535546
)
536547

548+
class Sections(proto.Message):
549+
r"""Custom sections to return when requesting a summary of a
550+
conversation. This is only supported when ``baseline_model_version``
551+
== '2.0'.
552+
553+
Supported features: CONVERSATION_SUMMARIZATION,
554+
CONVERSATION_SUMMARIZATION_VOICE.
555+
556+
Attributes:
557+
section_types (MutableSequence[google.cloud.dialogflow_v2beta1.types.HumanAgentAssistantConfig.SuggestionQueryConfig.Sections.SectionType]):
558+
The selected sections chosen to return when
559+
requesting a summary of a conversation. A
560+
duplicate selected section will be treated as a
561+
single selected section. If section types are
562+
not provided, the default will be {SITUATION,
563+
ACTION, RESULT}.
564+
"""
565+
566+
class SectionType(proto.Enum):
567+
r"""Selectable sections to return when requesting a summary of a
568+
conversation.
569+
570+
Values:
571+
SECTION_TYPE_UNSPECIFIED (0):
572+
Undefined section type, does not return
573+
anything.
574+
SITUATION (1):
575+
What the customer needs help with or has
576+
question about. Section name: "situation".
577+
ACTION (2):
578+
What the agent does to help the customer.
579+
Section name: "action".
580+
RESOLUTION (3):
581+
Result of the customer service. A single word
582+
describing the result of the conversation.
583+
Section name: "resolution".
584+
REASON_FOR_CANCELLATION (4):
585+
Reason for cancellation if the customer requests for a
586+
cancellation. "N/A" otherwise. Section name:
587+
"reason_for_cancellation".
588+
CUSTOMER_SATISFACTION (5):
589+
"Unsatisfied" or "Satisfied" depending on the customer's
590+
feelings at the end of the conversation. Section name:
591+
"customer_satisfaction".
592+
ENTITIES (6):
593+
Key entities extracted from the conversation,
594+
such as ticket number, order number, dollar
595+
amount, etc. Section names are prefixed by
596+
"entities/".
597+
"""
598+
SECTION_TYPE_UNSPECIFIED = 0
599+
SITUATION = 1
600+
ACTION = 2
601+
RESOLUTION = 3
602+
REASON_FOR_CANCELLATION = 4
603+
CUSTOMER_SATISFACTION = 5
604+
ENTITIES = 6
605+
606+
section_types: MutableSequence[
607+
"HumanAgentAssistantConfig.SuggestionQueryConfig.Sections.SectionType"
608+
] = proto.RepeatedField(
609+
proto.ENUM,
610+
number=1,
611+
enum="HumanAgentAssistantConfig.SuggestionQueryConfig.Sections.SectionType",
612+
)
613+
537614
knowledge_base_query_source: "HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource" = proto.Field(
538615
proto.MESSAGE,
539616
number=1,
@@ -565,6 +642,13 @@ class ContextFilterSettings(proto.Message):
565642
number=7,
566643
message="HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings",
567644
)
645+
sections: "HumanAgentAssistantConfig.SuggestionQueryConfig.Sections" = (
646+
proto.Field(
647+
proto.MESSAGE,
648+
number=8,
649+
message="HumanAgentAssistantConfig.SuggestionQueryConfig.Sections",
650+
)
651+
)
568652

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

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

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

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

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

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3497,6 +3497,7 @@ def test_create_conversation_profile_rest(request_type):
34973497
"suggestion_feature": {"type_": 1},
34983498
"enable_event_based_suggestion": True,
34993499
"disable_agent_query_logging": True,
3500+
"enable_conversation_augmented_query": True,
35003501
"suggestion_trigger_settings": {
35013502
"no_small_talk": True,
35023503
"only_end_user": True,
@@ -3522,6 +3523,7 @@ def test_create_conversation_profile_rest(request_type):
35223523
"drop_virtual_agent_messages": True,
35233524
"drop_ivr_messages": True,
35243525
},
3526+
"sections": {"section_types": [1]},
35253527
},
35263528
"conversation_model_config": {
35273529
"model": "model_value",
@@ -3960,6 +3962,7 @@ def test_update_conversation_profile_rest(request_type):
39603962
"suggestion_feature": {"type_": 1},
39613963
"enable_event_based_suggestion": True,
39623964
"disable_agent_query_logging": True,
3965+
"enable_conversation_augmented_query": True,
39633966
"suggestion_trigger_settings": {
39643967
"no_small_talk": True,
39653968
"only_end_user": True,
@@ -3985,6 +3988,7 @@ def test_update_conversation_profile_rest(request_type):
39853988
"drop_virtual_agent_messages": True,
39863989
"drop_ivr_messages": True,
39873990
},
3991+
"sections": {"section_types": [1]},
39883992
},
39893993
"conversation_model_config": {
39903994
"model": "model_value",

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3064,7 +3064,9 @@ def test_search_knowledge(request_type, transport: str = "grpc"):
30643064
# Mock the actual call within the gRPC stub, and fake the request.
30653065
with mock.patch.object(type(client.transport.search_knowledge), "__call__") as call:
30663066
# Designate an appropriate return value for the call.
3067-
call.return_value = conversation.SearchKnowledgeResponse()
3067+
call.return_value = conversation.SearchKnowledgeResponse(
3068+
rewritten_query="rewritten_query_value",
3069+
)
30683070
response = client.search_knowledge(request)
30693071

30703072
# Establish that the underlying gRPC stub method was called.
@@ -3074,6 +3076,7 @@ def test_search_knowledge(request_type, transport: str = "grpc"):
30743076

30753077
# Establish that the response is the type that we expect.
30763078
assert isinstance(response, conversation.SearchKnowledgeResponse)
3079+
assert response.rewritten_query == "rewritten_query_value"
30773080

30783081

30793082
def test_search_knowledge_empty_call():
@@ -3109,7 +3112,9 @@ async def test_search_knowledge_async(
31093112
with mock.patch.object(type(client.transport.search_knowledge), "__call__") as call:
31103113
# Designate an appropriate return value for the call.
31113114
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
3112-
conversation.SearchKnowledgeResponse()
3115+
conversation.SearchKnowledgeResponse(
3116+
rewritten_query="rewritten_query_value",
3117+
)
31133118
)
31143119
response = await client.search_knowledge(request)
31153120

@@ -3120,6 +3125,7 @@ async def test_search_knowledge_async(
31203125

31213126
# Establish that the response is the type that we expect.
31223127
assert isinstance(response, conversation.SearchKnowledgeResponse)
3128+
assert response.rewritten_query == "rewritten_query_value"
31233129

31243130

31253131
@pytest.mark.asyncio
@@ -5614,7 +5620,9 @@ def test_search_knowledge_rest(request_type):
56145620
# Mock the http request call within the method and fake a response.
56155621
with mock.patch.object(type(client.transport._session), "request") as req:
56165622
# Designate an appropriate value for the returned response.
5617-
return_value = conversation.SearchKnowledgeResponse()
5623+
return_value = conversation.SearchKnowledgeResponse(
5624+
rewritten_query="rewritten_query_value",
5625+
)
56185626

56195627
# Wrap the value into a proper Response obj
56205628
response_value = Response()
@@ -5629,6 +5637,7 @@ def test_search_knowledge_rest(request_type):
56295637

56305638
# Establish that the response is the type that we expect.
56315639
assert isinstance(response, conversation.SearchKnowledgeResponse)
5640+
assert response.rewritten_query == "rewritten_query_value"
56325641

56335642

56345643
def test_search_knowledge_rest_required_fields(

0 commit comments

Comments
 (0)