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

Commit 0bf73ae

Browse files
feat: added speech endpointing setting (#669)
* feat: added speech endpointing setting feat: added Knowledge Search API PiperOrigin-RevId: 561112943 Source-Link: googleapis/googleapis@6d69526 Source-Link: https://github.com/googleapis/googleapis-gen/commit/5d3ab0d9ffda232d36cb148ce192ea8771510402 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNWQzYWIwZDlmZmRhMjMyZDM2Y2IxNDhjZTE5MmVhODc3MTUxMDQwMiJ9 * 🦉 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 f09e34e commit 0bf73ae

26 files changed

+1309
-13
lines changed

google/cloud/dialogflow_v2beta1/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@
105105
ListConversationsResponse,
106106
ListMessagesRequest,
107107
ListMessagesResponse,
108+
SearchKnowledgeAnswer,
109+
SearchKnowledgeRequest,
110+
SearchKnowledgeResponse,
108111
SuggestConversationSummaryRequest,
109112
SuggestConversationSummaryResponse,
110113
)
@@ -467,6 +470,9 @@
467470
"RestoreAgentRequest",
468471
"SearchAgentsRequest",
469472
"SearchAgentsResponse",
473+
"SearchKnowledgeAnswer",
474+
"SearchKnowledgeRequest",
475+
"SearchKnowledgeResponse",
470476
"Sentiment",
471477
"SentimentAnalysisRequestConfig",
472478
"SentimentAnalysisResult",

google/cloud/dialogflow_v2beta1/gapic_metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,11 @@
496496
"list_messages"
497497
]
498498
},
499+
"SearchKnowledge": {
500+
"methods": [
501+
"search_knowledge"
502+
]
503+
},
499504
"SuggestConversationSummary": {
500505
"methods": [
501506
"suggest_conversation_summary"
@@ -541,6 +546,11 @@
541546
"list_messages"
542547
]
543548
},
549+
"SearchKnowledge": {
550+
"methods": [
551+
"search_knowledge"
552+
]
553+
},
544554
"SuggestConversationSummary": {
545555
"methods": [
546556
"suggest_conversation_summary"
@@ -586,6 +596,11 @@
586596
"list_messages"
587597
]
588598
},
599+
"SearchKnowledge": {
600+
"methods": [
601+
"search_knowledge"
602+
]
603+
},
589604
"SuggestConversationSummary": {
590605
"methods": [
591606
"suggest_conversation_summary"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ async def sample_clear_suggestion_feature_config():
10401040
request = dialogflow_v2beta1.ClearSuggestionFeatureConfigRequest(
10411041
conversation_profile="conversation_profile_value",
10421042
participant_role="END_USER",
1043-
suggestion_feature_type="CONVERSATION_SUMMARIZATION",
1043+
suggestion_feature_type="KNOWLEDGE_SEARCH",
10441044
)
10451045
10461046
# Make the request

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,7 @@ def sample_clear_suggestion_feature_config():
13641364
request = dialogflow_v2beta1.ClearSuggestionFeatureConfigRequest(
13651365
conversation_profile="conversation_profile_value",
13661366
participant_role="END_USER",
1367-
suggestion_feature_type="CONVERSATION_SUMMARIZATION",
1367+
suggestion_feature_type="KNOWLEDGE_SEARCH",
13681368
)
13691369
13701370
# Make the request

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

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,87 @@ async def sample_generate_stateless_summary():
11651165
# Done; return the response.
11661166
return response
11671167

1168+
async def search_knowledge(
1169+
self,
1170+
request: Optional[Union[conversation.SearchKnowledgeRequest, dict]] = None,
1171+
*,
1172+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1173+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1174+
metadata: Sequence[Tuple[str, str]] = (),
1175+
) -> conversation.SearchKnowledgeResponse:
1176+
r"""Get answers for the given query based on knowledge
1177+
documents.
1178+
1179+
.. code-block:: python
1180+
1181+
# This snippet has been automatically generated and should be regarded as a
1182+
# code template only.
1183+
# It will require modifications to work:
1184+
# - It may require correct/in-range values for request initialization.
1185+
# - It may require specifying regional endpoints when creating the service
1186+
# client as shown in:
1187+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1188+
from google.cloud import dialogflow_v2beta1
1189+
1190+
async def sample_search_knowledge():
1191+
# Create a client
1192+
client = dialogflow_v2beta1.ConversationsAsyncClient()
1193+
1194+
# Initialize request argument(s)
1195+
request = dialogflow_v2beta1.SearchKnowledgeRequest(
1196+
conversation_profile="conversation_profile_value",
1197+
)
1198+
1199+
# Make the request
1200+
response = await client.search_knowledge(request=request)
1201+
1202+
# Handle the response
1203+
print(response)
1204+
1205+
Args:
1206+
request (Optional[Union[google.cloud.dialogflow_v2beta1.types.SearchKnowledgeRequest, dict]]):
1207+
The request object. The request message for
1208+
[Conversations.SearchKnowledge][google.cloud.dialogflow.v2beta1.Conversations.SearchKnowledge].
1209+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1210+
should be retried.
1211+
timeout (float): The timeout for this request.
1212+
metadata (Sequence[Tuple[str, str]]): Strings which should be
1213+
sent along with the request as metadata.
1214+
1215+
Returns:
1216+
google.cloud.dialogflow_v2beta1.types.SearchKnowledgeResponse:
1217+
The response message for
1218+
[Conversations.SearchKnowledge][google.cloud.dialogflow.v2beta1.Conversations.SearchKnowledge].
1219+
1220+
"""
1221+
# Create or coerce a protobuf request object.
1222+
request = conversation.SearchKnowledgeRequest(request)
1223+
1224+
# Wrap the RPC method; this adds retry and timeout information,
1225+
# and friendly error handling.
1226+
rpc = gapic_v1.method_async.wrap_method(
1227+
self._client._transport.search_knowledge,
1228+
default_timeout=None,
1229+
client_info=DEFAULT_CLIENT_INFO,
1230+
)
1231+
1232+
# Certain fields should be provided within the metadata header;
1233+
# add these here.
1234+
metadata = tuple(metadata) + (
1235+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
1236+
)
1237+
1238+
# Send the request.
1239+
response = await rpc(
1240+
request,
1241+
retry=retry,
1242+
timeout=timeout,
1243+
metadata=metadata,
1244+
)
1245+
1246+
# Done; return the response.
1247+
return response
1248+
11681249
async def list_operations(
11691250
self,
11701251
request: Optional[operations_pb2.ListOperationsRequest] = None,

google/cloud/dialogflow_v2beta1/services/conversations/client.py

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,6 +1527,88 @@ def sample_generate_stateless_summary():
15271527
# Done; return the response.
15281528
return response
15291529

1530+
def search_knowledge(
1531+
self,
1532+
request: Optional[Union[conversation.SearchKnowledgeRequest, dict]] = None,
1533+
*,
1534+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1535+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1536+
metadata: Sequence[Tuple[str, str]] = (),
1537+
) -> conversation.SearchKnowledgeResponse:
1538+
r"""Get answers for the given query based on knowledge
1539+
documents.
1540+
1541+
.. code-block:: python
1542+
1543+
# This snippet has been automatically generated and should be regarded as a
1544+
# code template only.
1545+
# It will require modifications to work:
1546+
# - It may require correct/in-range values for request initialization.
1547+
# - It may require specifying regional endpoints when creating the service
1548+
# client as shown in:
1549+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1550+
from google.cloud import dialogflow_v2beta1
1551+
1552+
def sample_search_knowledge():
1553+
# Create a client
1554+
client = dialogflow_v2beta1.ConversationsClient()
1555+
1556+
# Initialize request argument(s)
1557+
request = dialogflow_v2beta1.SearchKnowledgeRequest(
1558+
conversation_profile="conversation_profile_value",
1559+
)
1560+
1561+
# Make the request
1562+
response = client.search_knowledge(request=request)
1563+
1564+
# Handle the response
1565+
print(response)
1566+
1567+
Args:
1568+
request (Union[google.cloud.dialogflow_v2beta1.types.SearchKnowledgeRequest, dict]):
1569+
The request object. The request message for
1570+
[Conversations.SearchKnowledge][google.cloud.dialogflow.v2beta1.Conversations.SearchKnowledge].
1571+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1572+
should be retried.
1573+
timeout (float): The timeout for this request.
1574+
metadata (Sequence[Tuple[str, str]]): Strings which should be
1575+
sent along with the request as metadata.
1576+
1577+
Returns:
1578+
google.cloud.dialogflow_v2beta1.types.SearchKnowledgeResponse:
1579+
The response message for
1580+
[Conversations.SearchKnowledge][google.cloud.dialogflow.v2beta1.Conversations.SearchKnowledge].
1581+
1582+
"""
1583+
# Create or coerce a protobuf request object.
1584+
# Minor optimization to avoid making a copy if the user passes
1585+
# in a conversation.SearchKnowledgeRequest.
1586+
# There's no risk of modifying the input as we've already verified
1587+
# there are no flattened fields.
1588+
if not isinstance(request, conversation.SearchKnowledgeRequest):
1589+
request = conversation.SearchKnowledgeRequest(request)
1590+
1591+
# Wrap the RPC method; this adds retry and timeout information,
1592+
# and friendly error handling.
1593+
rpc = self._transport._wrapped_methods[self._transport.search_knowledge]
1594+
1595+
# Certain fields should be provided within the metadata header;
1596+
# add these here.
1597+
metadata = tuple(metadata) + (
1598+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
1599+
)
1600+
1601+
# Send the request.
1602+
response = rpc(
1603+
request,
1604+
retry=retry,
1605+
timeout=timeout,
1606+
metadata=metadata,
1607+
)
1608+
1609+
# Done; return the response.
1610+
return response
1611+
15301612
def __enter__(self) -> "ConversationsClient":
15311613
return self
15321614

google/cloud/dialogflow_v2beta1/services/conversations/transports/base.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ def _prep_wrapped_messages(self, client_info):
168168
default_timeout=None,
169169
client_info=client_info,
170170
),
171+
self.search_knowledge: gapic_v1.method.wrap_method(
172+
self.search_knowledge,
173+
default_timeout=None,
174+
client_info=client_info,
175+
),
171176
}
172177

173178
def close(self):
@@ -266,6 +271,18 @@ def generate_stateless_summary(
266271
]:
267272
raise NotImplementedError()
268273

274+
@property
275+
def search_knowledge(
276+
self,
277+
) -> Callable[
278+
[conversation.SearchKnowledgeRequest],
279+
Union[
280+
conversation.SearchKnowledgeResponse,
281+
Awaitable[conversation.SearchKnowledgeResponse],
282+
],
283+
]:
284+
raise NotImplementedError()
285+
269286
@property
270287
def list_operations(
271288
self,

google/cloud/dialogflow_v2beta1/services/conversations/transports/grpc.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,35 @@ def generate_stateless_summary(
489489
)
490490
return self._stubs["generate_stateless_summary"]
491491

492+
@property
493+
def search_knowledge(
494+
self,
495+
) -> Callable[
496+
[conversation.SearchKnowledgeRequest], conversation.SearchKnowledgeResponse
497+
]:
498+
r"""Return a callable for the search knowledge method over gRPC.
499+
500+
Get answers for the given query based on knowledge
501+
documents.
502+
503+
Returns:
504+
Callable[[~.SearchKnowledgeRequest],
505+
~.SearchKnowledgeResponse]:
506+
A function that, when called, will call the underlying RPC
507+
on the server.
508+
"""
509+
# Generate a "stub function" on-the-fly which will actually make
510+
# the request.
511+
# gRPC handles serialization and deserialization, so we just need
512+
# to pass in the functions for each.
513+
if "search_knowledge" not in self._stubs:
514+
self._stubs["search_knowledge"] = self.grpc_channel.unary_unary(
515+
"/google.cloud.dialogflow.v2beta1.Conversations/SearchKnowledge",
516+
request_serializer=conversation.SearchKnowledgeRequest.serialize,
517+
response_deserializer=conversation.SearchKnowledgeResponse.deserialize,
518+
)
519+
return self._stubs["search_knowledge"]
520+
492521
def close(self):
493522
self.grpc_channel.close()
494523

google/cloud/dialogflow_v2beta1/services/conversations/transports/grpc_asyncio.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,36 @@ def generate_stateless_summary(
496496
)
497497
return self._stubs["generate_stateless_summary"]
498498

499+
@property
500+
def search_knowledge(
501+
self,
502+
) -> Callable[
503+
[conversation.SearchKnowledgeRequest],
504+
Awaitable[conversation.SearchKnowledgeResponse],
505+
]:
506+
r"""Return a callable for the search knowledge method over gRPC.
507+
508+
Get answers for the given query based on knowledge
509+
documents.
510+
511+
Returns:
512+
Callable[[~.SearchKnowledgeRequest],
513+
Awaitable[~.SearchKnowledgeResponse]]:
514+
A function that, when called, will call the underlying RPC
515+
on the server.
516+
"""
517+
# Generate a "stub function" on-the-fly which will actually make
518+
# the request.
519+
# gRPC handles serialization and deserialization, so we just need
520+
# to pass in the functions for each.
521+
if "search_knowledge" not in self._stubs:
522+
self._stubs["search_knowledge"] = self.grpc_channel.unary_unary(
523+
"/google.cloud.dialogflow.v2beta1.Conversations/SearchKnowledge",
524+
request_serializer=conversation.SearchKnowledgeRequest.serialize,
525+
response_deserializer=conversation.SearchKnowledgeResponse.deserialize,
526+
)
527+
return self._stubs["search_knowledge"]
528+
499529
def close(self):
500530
return self.grpc_channel.close()
501531

0 commit comments

Comments
 (0)