Skip to content

Commit 6d69526

Browse files
Google APIscopybara-github
authored andcommitted
feat: added speech endpointing setting
feat: added Knowledge Search API PiperOrigin-RevId: 561112943
1 parent 0d312cc commit 6d69526

8 files changed

Lines changed: 170 additions & 13 deletions

File tree

google/cloud/dialogflow/v2beta1/BUILD.bazel

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -237,15 +237,15 @@ py_gapic_library(
237237
],
238238
)
239239

240-
# py_test(
241-
# name = "dialogflow_py_gapic_test",
242-
# srcs = [
243-
# "dialogflow_py_gapic_pytest.py",
244-
# "dialogflow_py_gapic_test.py",
245-
# ],
246-
# legacy_create_init = False,
247-
# deps = [":dialogflow_py_gapic"],
248-
# )
240+
py_test(
241+
name = "dialogflow_py_gapic_test",
242+
srcs = [
243+
"dialogflow_py_gapic_pytest.py",
244+
"dialogflow_py_gapic_test.py",
245+
],
246+
legacy_create_init = False,
247+
deps = [":dialogflow_py_gapic"],
248+
)
249249

250250
# Open Source Packages
251251
py_gapic_assembly_pkg(
@@ -390,7 +390,6 @@ load(
390390

391391
csharp_proto_library(
392392
name = "dialogflow_csharp_proto",
393-
extra_opts = [""],
394393
deps = [":dialogflow_proto"],
395394
)
396395

google/cloud/dialogflow/v2beta1/answer_record.proto

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,22 @@ message AgentAssistantFeedback {
245245
string summary_text = 3;
246246
}
247247

248+
// Feedback for knowledge search.
249+
message KnowledgeSearchFeedback {
250+
// Whether the answer was copied by the human agent or not.
251+
// If the value is set to be true,
252+
// [AnswerFeedback.clicked][google.cloud.dialogflow.v2beta1.AnswerFeedback.clicked]
253+
// will be updated to be true.
254+
bool answer_copied = 1;
255+
256+
// The URIs clicked by the human agent. The value is appended for each
257+
// UpdateAnswerRecordRequest.
258+
// If the value is not empty,
259+
// [AnswerFeedback.clicked][google.cloud.dialogflow.v2beta1.AnswerFeedback.clicked]
260+
// will be updated to be true.
261+
repeated string clicked_uris = 2;
262+
}
263+
248264
// Optional. Whether or not the suggested answer is relevant.
249265
//
250266
// For example:
@@ -276,6 +292,10 @@ message AgentAssistantFeedback {
276292

277293
// Feedback for conversation summarization.
278294
SummarizationFeedback summarization_feedback = 4;
295+
296+
// Optional. Feedback for knowledge search.
297+
KnowledgeSearchFeedback knowledge_search_feedback = 5
298+
[(google.api.field_behavior) = OPTIONAL];
279299
}
280300

281301
// Request message for

google/cloud/dialogflow/v2beta1/audio_config.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,10 @@ message SpeechToTextConfig {
330330
// documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model)
331331
// for more details.
332332
string model = 2;
333+
334+
// Use timeout based endpointing, interpreting endpointer sensitivy as
335+
// seconds of timeout value.
336+
bool use_timeout_based_endpointing = 11;
333337
}
334338

335339
// [DTMF](https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling)

google/cloud/dialogflow/v2beta1/conversation.proto

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import "google/api/field_behavior.proto";
2222
import "google/api/resource.proto";
2323
import "google/cloud/dialogflow/v2beta1/conversation_profile.proto";
2424
import "google/cloud/dialogflow/v2beta1/participant.proto";
25+
import "google/cloud/dialogflow/v2beta1/session.proto";
2526
import "google/protobuf/timestamp.proto";
2627

2728
option cc_enable_arenas = true;
@@ -169,6 +170,27 @@ service Conversations {
169170
}
170171
};
171172
}
173+
174+
// Get answers for the given query based on knowledge documents.
175+
rpc SearchKnowledge(SearchKnowledgeRequest)
176+
returns (SearchKnowledgeResponse) {
177+
option (google.api.http) = {
178+
post: "/v2beta1/{parent=projects/*}/suggestions:searchKnowledge"
179+
body: "*"
180+
additional_bindings {
181+
post: "/v2beta1/{parent=projects/*/locations/*}/suggestions:searchKnowledge"
182+
body: "*"
183+
}
184+
additional_bindings {
185+
post: "/v2beta1/{conversation=projects/*/conversations/*}/suggestions:searchKnowledge"
186+
body: "*"
187+
}
188+
additional_bindings {
189+
post: "/v2beta1/{conversation=projects/*/locations/*/conversations/*}/suggestions:searchKnowledge"
190+
body: "*"
191+
}
192+
};
193+
}
172194
}
173195

174196
// Represents a conversation.
@@ -623,3 +645,99 @@ message GenerateStatelessSummaryResponse {
623645
// the request if there weren't that many messages in the conversation.
624646
int32 context_size = 3;
625647
}
648+
649+
// The request message for
650+
// [Conversations.SearchKnowledge][google.cloud.dialogflow.v2beta1.Conversations.SearchKnowledge].
651+
message SearchKnowledgeRequest {
652+
// The parent resource contains the conversation profile
653+
// Format: 'projects/<Project ID>' or `projects/<Project
654+
// ID>/locations/<Location ID>`.
655+
string parent = 6;
656+
657+
// Required. The natural language text query for knowledge search.
658+
TextInput query = 1 [(google.api.field_behavior) = REQUIRED];
659+
660+
// Required. The conversation profile used to configure the search.
661+
// Format: `projects/<Project ID>/locations/<Location
662+
// ID>/conversationProfiles/<Conversation Profile ID>`.
663+
string conversation_profile = 2 [
664+
(google.api.field_behavior) = REQUIRED,
665+
(google.api.resource_reference) = {
666+
type: "dialogflow.googleapis.com/ConversationProfile"
667+
}
668+
];
669+
670+
// The ID of the search session.
671+
// The session_id can be combined with Dialogflow V3 Agent ID retrieved from
672+
// conversation profile or on its own to identify a search session. The search
673+
// history of the same session will impact the search result. It's up to the
674+
// API caller to choose an appropriate `Session ID`. It can be a random number
675+
// or some type of session identifiers (preferably hashed). The length must
676+
// not exceed 36 characters.
677+
string session_id = 3;
678+
679+
// The conversation (between human agent and end user) where the search
680+
// request is triggered. Format: `projects/<Project ID>/locations/<Location
681+
// ID>/conversations/<Conversation ID>`.
682+
string conversation = 4 [(google.api.resource_reference) = {
683+
type: "dialogflow.googleapis.com/Conversation"
684+
}];
685+
686+
// The name of the latest conversation message when the request is
687+
// triggered.
688+
// Format: `projects/<Project ID>/locations/<Location
689+
// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
690+
string latest_message = 5 [(google.api.resource_reference) = {
691+
type: "dialogflow.googleapis.com/Message"
692+
}];
693+
}
694+
695+
// The response message for
696+
// [Conversations.SearchKnowledge][google.cloud.dialogflow.v2beta1.Conversations.SearchKnowledge].
697+
message SearchKnowledgeResponse {
698+
// Most relevant snippets extracted from articles in the given knowledge base,
699+
// ordered by confidence.
700+
repeated SearchKnowledgeAnswer answers = 2;
701+
}
702+
703+
// Represents a SearchKnowledge answer.
704+
message SearchKnowledgeAnswer {
705+
// The type of the answer.
706+
enum AnswerType {
707+
// The answer has a unspecified type.
708+
ANSWER_TYPE_UNSPECIFIED = 0;
709+
710+
// The answer is from FAQ doucments.
711+
FAQ = 1;
712+
713+
// The answer is from generative model.
714+
GENERATIVE = 2;
715+
}
716+
717+
// The sources of the answers.
718+
message AnswerSource {
719+
// The title of the article.
720+
string title = 1;
721+
722+
// The URI of the article.
723+
string uri = 2;
724+
725+
// The relevant snippet of the article.
726+
string snippet = 3;
727+
}
728+
729+
// The piece of text from the knowledge base documents that answers
730+
// the search query
731+
string answer = 1;
732+
733+
// The type of the answer.
734+
AnswerType answer_type = 2;
735+
736+
// All sources used to generate the answer.
737+
repeated AnswerSource answer_sources = 3;
738+
739+
// The name of the answer record.
740+
// Format: `projects/<Project ID>/locations/<location ID>/answer
741+
// Records/<Answer Record ID>`
742+
string answer_record = 5;
743+
}

google/cloud/dialogflow/v2beta1/conversation_profile.proto

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,16 @@ message HumanAgentAssistantConfig {
325325
// suggestions.
326326
//
327327
// Supported features: ARTICLE_SUGGESTION, FAQ, DIALOGFLOW_ASSIST,
328-
// ENTITY_EXTRACTION.
328+
// ENTITY_EXTRACTION, KNOWLEDGE_ASSIST.
329329
bool enable_event_based_suggestion = 3;
330330

331+
// Optional. Disable the logging of search queries sent by human agents. It
332+
// can prevent those queries from being stored at answer records.
333+
//
334+
// Supported features: KNOWLEDGE_SEARCH.
335+
bool disable_agent_query_logging = 14
336+
[(google.api.field_behavior) = OPTIONAL];
337+
331338
// Settings of suggestion trigger.
332339
//
333340
// Currently, only ARTICLE_SUGGESTION, FAQ, and DIALOGFLOW_ASSIST will use

google/cloud/dialogflow/v2beta1/dialogflow_grpc_service_config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@
8383
{
8484
"service": "google.cloud.dialogflow.v2beta1.Fulfillments"
8585
},
86+
{
87+
"service": "google.cloud.dialogflow.v2beta1.Generators"
88+
},
8689
{
8790
"service": "google.cloud.dialogflow.v2beta1.HumanAgentAssistants"
8891
},

google/cloud/dialogflow/v2beta1/participant.proto

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,9 @@ message SuggestionFeature {
620620

621621
// Run conversation summarization model for chat.
622622
CONVERSATION_SUMMARIZATION = 8;
623+
624+
// Run knowledge search with text input from agent or text generated query.
625+
KNOWLEDGE_SEARCH = 14;
623626
}
624627

625628
// Type of Human Agent Assistant API feature to request.
@@ -888,7 +891,7 @@ message StreamingAnalyzeContentRequest {
888891
// The UTF-8 encoded natural language text to be processed. Must be sent if
889892
// `text_config` is set in the first message. Text length must not exceed
890893
// 256 bytes for virtual agent interactions. The `input_text` field can be
891-
// only sent once.
894+
// only sent once, and would cancel the speech recognition if any ongoing.
892895
string input_text = 6;
893896

894897
// The DTMF digits used to invoke intent and fill in parameter value.

google/cloud/dialogflow/v2beta1/session.proto

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,9 +645,12 @@ message CloudConversationDebuggingInfo {
645645
// beginning of the stream.
646646
google.protobuf.Duration single_utterance_end_time_offset = 14;
647647

648-
// No speech timeout settings observed at runtime.
648+
// No speech timeout settings for the stream.
649649
google.protobuf.Duration no_speech_timeout = 15;
650650

651+
// Speech endpointing timeout settings for the stream.
652+
google.protobuf.Duration endpointing_timeout = 19;
653+
651654
// Whether the streaming terminates with an injected text query.
652655
bool is_input_text = 16;
653656

0 commit comments

Comments
 (0)