Skip to content
This repository was archived by the owner on Dec 17, 2023. It is now read-only.

Commit f09e34e

Browse files
feat: added speech endpointing setting (#668)
* feat: added speech endpointing setting feat: added Knowledge Search API PiperOrigin-RevId: 560215389 Source-Link: googleapis/googleapis@b1666e6 Source-Link: https://github.com/googleapis/googleapis-gen/commit/07e82b4d4917494d85039722f673d409c4c7305f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDdlODJiNGQ0OTE3NDk0ZDg1MDM5NzIyZjY3M2Q0MDljNGM3MzA1ZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 6ac5a4f commit f09e34e

29 files changed

+2046
-31
lines changed

google/cloud/dialogflow/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@
154154
ListConversationsResponse,
155155
ListMessagesRequest,
156156
ListMessagesResponse,
157+
SearchKnowledgeAnswer,
158+
SearchKnowledgeRequest,
159+
SearchKnowledgeResponse,
157160
SuggestConversationSummaryRequest,
158161
SuggestConversationSummaryResponse,
159162
)
@@ -301,10 +304,12 @@
301304
AssistQueryParameters,
302305
AutomatedAgentReply,
303306
CreateParticipantRequest,
307+
DialogflowAssistAnswer,
304308
DtmfParameters,
305309
FaqAnswer,
306310
GetParticipantRequest,
307311
InputTextConfig,
312+
IntentSuggestion,
308313
ListParticipantsRequest,
309314
ListParticipantsResponse,
310315
Message,
@@ -318,6 +323,7 @@
318323
SuggestArticlesResponse,
319324
SuggestFaqAnswersRequest,
320325
SuggestFaqAnswersResponse,
326+
SuggestionInput,
321327
SuggestionResult,
322328
SuggestSmartRepliesRequest,
323329
SuggestSmartRepliesResponse,
@@ -453,6 +459,9 @@
453459
"ListConversationsResponse",
454460
"ListMessagesRequest",
455461
"ListMessagesResponse",
462+
"SearchKnowledgeAnswer",
463+
"SearchKnowledgeRequest",
464+
"SearchKnowledgeResponse",
456465
"SuggestConversationSummaryRequest",
457466
"SuggestConversationSummaryResponse",
458467
"ConversationDataset",
@@ -579,10 +588,12 @@
579588
"AssistQueryParameters",
580589
"AutomatedAgentReply",
581590
"CreateParticipantRequest",
591+
"DialogflowAssistAnswer",
582592
"DtmfParameters",
583593
"FaqAnswer",
584594
"GetParticipantRequest",
585595
"InputTextConfig",
596+
"IntentSuggestion",
586597
"ListParticipantsRequest",
587598
"ListParticipantsResponse",
588599
"Message",
@@ -596,6 +607,7 @@
596607
"SuggestArticlesResponse",
597608
"SuggestFaqAnswersRequest",
598609
"SuggestFaqAnswersResponse",
610+
"SuggestionInput",
599611
"SuggestionResult",
600612
"SuggestSmartRepliesRequest",
601613
"SuggestSmartRepliesResponse",

google/cloud/dialogflow_v2/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@
107107
ListConversationsResponse,
108108
ListMessagesRequest,
109109
ListMessagesResponse,
110+
SearchKnowledgeAnswer,
111+
SearchKnowledgeRequest,
112+
SearchKnowledgeResponse,
110113
SuggestConversationSummaryRequest,
111114
SuggestConversationSummaryResponse,
112115
)
@@ -252,10 +255,12 @@
252255
AssistQueryParameters,
253256
AutomatedAgentReply,
254257
CreateParticipantRequest,
258+
DialogflowAssistAnswer,
255259
DtmfParameters,
256260
FaqAnswer,
257261
GetParticipantRequest,
258262
InputTextConfig,
263+
IntentSuggestion,
259264
ListParticipantsRequest,
260265
ListParticipantsResponse,
261266
Message,
@@ -269,6 +274,7 @@
269274
SuggestArticlesResponse,
270275
SuggestFaqAnswersRequest,
271276
SuggestFaqAnswersResponse,
277+
SuggestionInput,
272278
SuggestionResult,
273279
SuggestSmartRepliesRequest,
274280
SuggestSmartRepliesResponse,
@@ -408,6 +414,7 @@
408414
"DeployConversationModelRequest",
409415
"DetectIntentRequest",
410416
"DetectIntentResponse",
417+
"DialogflowAssistAnswer",
411418
"Document",
412419
"DocumentsClient",
413420
"DtmfParameters",
@@ -464,6 +471,7 @@
464471
"InputTextConfig",
465472
"Intent",
466473
"IntentBatch",
474+
"IntentSuggestion",
467475
"IntentView",
468476
"IntentsClient",
469477
"KnowledgeBase",
@@ -518,6 +526,9 @@
518526
"RestoreAgentRequest",
519527
"SearchAgentsRequest",
520528
"SearchAgentsResponse",
529+
"SearchKnowledgeAnswer",
530+
"SearchKnowledgeRequest",
531+
"SearchKnowledgeResponse",
521532
"Sentiment",
522533
"SentimentAnalysisRequestConfig",
523534
"SentimentAnalysisResult",
@@ -549,6 +560,7 @@
549560
"SuggestSmartRepliesRequest",
550561
"SuggestSmartRepliesResponse",
551562
"SuggestionFeature",
563+
"SuggestionInput",
552564
"SuggestionResult",
553565
"SynthesizeSpeechConfig",
554566
"TelephonyDtmf",

google/cloud/dialogflow_v2/gapic_metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,11 @@
724724
"list_messages"
725725
]
726726
},
727+
"SearchKnowledge": {
728+
"methods": [
729+
"search_knowledge"
730+
]
731+
},
727732
"SuggestConversationSummary": {
728733
"methods": [
729734
"suggest_conversation_summary"
@@ -764,6 +769,11 @@
764769
"list_messages"
765770
]
766771
},
772+
"SearchKnowledge": {
773+
"methods": [
774+
"search_knowledge"
775+
]
776+
},
767777
"SuggestConversationSummary": {
768778
"methods": [
769779
"suggest_conversation_summary"
@@ -804,6 +814,11 @@
804814
"list_messages"
805815
]
806816
},
817+
"SearchKnowledge": {
818+
"methods": [
819+
"search_knowledge"
820+
]
821+
},
807822
"SuggestConversationSummary": {
808823
"methods": [
809824
"suggest_conversation_summary"

google/cloud/dialogflow_v2/services/answer_records/async_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ class AnswerRecordsAsyncClient:
6969
parse_answer_record_path = staticmethod(
7070
AnswerRecordsClient.parse_answer_record_path
7171
)
72+
context_path = staticmethod(AnswerRecordsClient.context_path)
73+
parse_context_path = staticmethod(AnswerRecordsClient.parse_context_path)
74+
intent_path = staticmethod(AnswerRecordsClient.intent_path)
75+
parse_intent_path = staticmethod(AnswerRecordsClient.parse_intent_path)
7276
common_billing_account_path = staticmethod(
7377
AnswerRecordsClient.common_billing_account_path
7478
)

google/cloud/dialogflow_v2/services/answer_records/client.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,45 @@ def parse_answer_record_path(path: str) -> Dict[str, str]:
201201
)
202202
return m.groupdict() if m else {}
203203

204+
@staticmethod
205+
def context_path(
206+
project: str,
207+
session: str,
208+
context: str,
209+
) -> str:
210+
"""Returns a fully-qualified context string."""
211+
return "projects/{project}/agent/sessions/{session}/contexts/{context}".format(
212+
project=project,
213+
session=session,
214+
context=context,
215+
)
216+
217+
@staticmethod
218+
def parse_context_path(path: str) -> Dict[str, str]:
219+
"""Parses a context path into its component segments."""
220+
m = re.match(
221+
r"^projects/(?P<project>.+?)/agent/sessions/(?P<session>.+?)/contexts/(?P<context>.+?)$",
222+
path,
223+
)
224+
return m.groupdict() if m else {}
225+
226+
@staticmethod
227+
def intent_path(
228+
project: str,
229+
intent: str,
230+
) -> str:
231+
"""Returns a fully-qualified intent string."""
232+
return "projects/{project}/agent/intents/{intent}".format(
233+
project=project,
234+
intent=intent,
235+
)
236+
237+
@staticmethod
238+
def parse_intent_path(path: str) -> Dict[str, str]:
239+
"""Parses a intent path into its component segments."""
240+
m = re.match(r"^projects/(?P<project>.+?)/agent/intents/(?P<intent>.+?)$", path)
241+
return m.groupdict() if m else {}
242+
204243
@staticmethod
205244
def common_billing_account_path(
206245
billing_account: str,

google/cloud/dialogflow_v2/services/conversation_profiles/async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ async def sample_clear_suggestion_feature_config():
10421042
request = dialogflow_v2.ClearSuggestionFeatureConfigRequest(
10431043
conversation_profile="conversation_profile_value",
10441044
participant_role="END_USER",
1045-
suggestion_feature_type="SMART_REPLY",
1045+
suggestion_feature_type="KNOWLEDGE_SEARCH",
10461046
)
10471047
10481048
# Make the request

google/cloud/dialogflow_v2/services/conversation_profiles/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ def sample_clear_suggestion_feature_config():
13661366
request = dialogflow_v2.ClearSuggestionFeatureConfigRequest(
13671367
conversation_profile="conversation_profile_value",
13681368
participant_role="END_USER",
1369-
suggestion_feature_type="SMART_REPLY",
1369+
suggestion_feature_type="KNOWLEDGE_SEARCH",
13701370
)
13711371
13721372
# Make the request

google/cloud/dialogflow_v2/services/conversations/async_client.py

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,92 @@ async def sample_generate_stateless_summary():
10551055
# Done; return the response.
10561056
return response
10571057

1058+
async def search_knowledge(
1059+
self,
1060+
request: Optional[Union[conversation.SearchKnowledgeRequest, dict]] = None,
1061+
*,
1062+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1063+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1064+
metadata: Sequence[Tuple[str, str]] = (),
1065+
) -> conversation.SearchKnowledgeResponse:
1066+
r"""Get answers for the given query based on knowledge
1067+
documents.
1068+
1069+
.. code-block:: python
1070+
1071+
# This snippet has been automatically generated and should be regarded as a
1072+
# code template only.
1073+
# It will require modifications to work:
1074+
# - It may require correct/in-range values for request initialization.
1075+
# - It may require specifying regional endpoints when creating the service
1076+
# client as shown in:
1077+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1078+
from google.cloud import dialogflow_v2
1079+
1080+
async def sample_search_knowledge():
1081+
# Create a client
1082+
client = dialogflow_v2.ConversationsAsyncClient()
1083+
1084+
# Initialize request argument(s)
1085+
query = dialogflow_v2.TextInput()
1086+
query.text = "text_value"
1087+
query.language_code = "language_code_value"
1088+
1089+
request = dialogflow_v2.SearchKnowledgeRequest(
1090+
query=query,
1091+
conversation_profile="conversation_profile_value",
1092+
)
1093+
1094+
# Make the request
1095+
response = await client.search_knowledge(request=request)
1096+
1097+
# Handle the response
1098+
print(response)
1099+
1100+
Args:
1101+
request (Optional[Union[google.cloud.dialogflow_v2.types.SearchKnowledgeRequest, dict]]):
1102+
The request object. The request message for
1103+
[Conversations.SearchKnowledge][google.cloud.dialogflow.v2.Conversations.SearchKnowledge].
1104+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1105+
should be retried.
1106+
timeout (float): The timeout for this request.
1107+
metadata (Sequence[Tuple[str, str]]): Strings which should be
1108+
sent along with the request as metadata.
1109+
1110+
Returns:
1111+
google.cloud.dialogflow_v2.types.SearchKnowledgeResponse:
1112+
The response message for
1113+
[Conversations.SearchKnowledge][google.cloud.dialogflow.v2.Conversations.SearchKnowledge].
1114+
1115+
"""
1116+
# Create or coerce a protobuf request object.
1117+
request = conversation.SearchKnowledgeRequest(request)
1118+
1119+
# Wrap the RPC method; this adds retry and timeout information,
1120+
# and friendly error handling.
1121+
rpc = gapic_v1.method_async.wrap_method(
1122+
self._client._transport.search_knowledge,
1123+
default_timeout=None,
1124+
client_info=DEFAULT_CLIENT_INFO,
1125+
)
1126+
1127+
# Certain fields should be provided within the metadata header;
1128+
# add these here.
1129+
metadata = tuple(metadata) + (
1130+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
1131+
)
1132+
1133+
# Send the request.
1134+
response = await rpc(
1135+
request,
1136+
retry=retry,
1137+
timeout=timeout,
1138+
metadata=metadata,
1139+
)
1140+
1141+
# Done; return the response.
1142+
return response
1143+
10581144
async def list_operations(
10591145
self,
10601146
request: Optional[operations_pb2.ListOperationsRequest] = None,

0 commit comments

Comments
 (0)