@@ -22,6 +22,7 @@ import "google/api/field_behavior.proto";
2222import "google/api/resource.proto" ;
2323import "google/cloud/dialogflow/v2beta1/conversation_profile.proto" ;
2424import "google/cloud/dialogflow/v2beta1/participant.proto" ;
25+ import "google/cloud/dialogflow/v2beta1/session.proto" ;
2526import "google/protobuf/timestamp.proto" ;
2627
2728option 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+ }
0 commit comments