Skip to content

Commit 356f0c0

Browse files
Google APIscopybara-github
authored andcommitted
feat: added conversation process config, ImportDocument and SuggestSmartReplies API
PiperOrigin-RevId: 423223164
1 parent 56da7b0 commit 356f0c0

12 files changed

Lines changed: 413 additions & 201 deletions

google/cloud/dialogflow/v2/audio_config.proto

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ syntax = "proto3";
1616

1717
package google.cloud.dialogflow.v2;
1818

19+
import "google/api/annotations.proto";
1920
import "google/api/field_behavior.proto";
2021
import "google/api/resource.proto";
2122
import "google/protobuf/duration.proto";
2223
import "google/protobuf/timestamp.proto";
23-
import "google/api/annotations.proto";
2424

2525
option cc_enable_arenas = true;
2626
option csharp_namespace = "Google.Cloud.Dialogflow.V2";
@@ -109,31 +109,6 @@ message SpeechContext {
109109
float boost = 2;
110110
}
111111

112-
// Information for a word recognized by the speech recognizer.
113-
message SpeechWordInfo {
114-
// The word this info is for.
115-
string word = 3;
116-
117-
// Time offset relative to the beginning of the audio that corresponds to the
118-
// start of the spoken word. This is an experimental feature and the accuracy
119-
// of the time offset can vary.
120-
google.protobuf.Duration start_offset = 1;
121-
122-
// Time offset relative to the beginning of the audio that corresponds to the
123-
// end of the spoken word. This is an experimental feature and the accuracy of
124-
// the time offset can vary.
125-
google.protobuf.Duration end_offset = 2;
126-
127-
// The Speech confidence between 0.0 and 1.0 for this word. A higher number
128-
// indicates an estimated greater likelihood that the recognized word is
129-
// correct. The default of 0.0 is a sentinel value indicating that confidence
130-
// was not set.
131-
//
132-
// This field is not guaranteed to be fully stable over time for the same
133-
// audio input. Users should also not rely on it to always be provided.
134-
float confidence = 4;
135-
}
136-
137112
// Variant of the specified [Speech model][google.cloud.dialogflow.v2.InputAudioConfig.model] to use.
138113
//
139114
// See the [Cloud Speech
@@ -177,6 +152,31 @@ enum SpeechModelVariant {
177152
USE_ENHANCED = 3;
178153
}
179154

155+
// Information for a word recognized by the speech recognizer.
156+
message SpeechWordInfo {
157+
// The word this info is for.
158+
string word = 3;
159+
160+
// Time offset relative to the beginning of the audio that corresponds to the
161+
// start of the spoken word. This is an experimental feature and the accuracy
162+
// of the time offset can vary.
163+
google.protobuf.Duration start_offset = 1;
164+
165+
// Time offset relative to the beginning of the audio that corresponds to the
166+
// end of the spoken word. This is an experimental feature and the accuracy of
167+
// the time offset can vary.
168+
google.protobuf.Duration end_offset = 2;
169+
170+
// The Speech confidence between 0.0 and 1.0 for this word. A higher number
171+
// indicates an estimated greater likelihood that the recognized word is
172+
// correct. The default of 0.0 is a sentinel value indicating that confidence
173+
// was not set.
174+
//
175+
// This field is not guaranteed to be fully stable over time for the same
176+
// audio input. Users should also not rely on it to always be provided.
177+
float confidence = 4;
178+
}
179+
180180
// Instructs the speech recognizer how to process the audio content.
181181
message InputAudioConfig {
182182
// Required. Audio encoding of the audio content to process.
@@ -256,6 +256,23 @@ message InputAudioConfig {
256256
bool disable_no_speech_recognized_event = 14;
257257
}
258258

259+
// Gender of the voice as described in
260+
// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice).
261+
enum SsmlVoiceGender {
262+
// An unspecified gender, which means that the client doesn't care which
263+
// gender the selected voice will have.
264+
SSML_VOICE_GENDER_UNSPECIFIED = 0;
265+
266+
// A male voice.
267+
SSML_VOICE_GENDER_MALE = 1;
268+
269+
// A female voice.
270+
SSML_VOICE_GENDER_FEMALE = 2;
271+
272+
// A gender-neutral voice.
273+
SSML_VOICE_GENDER_NEUTRAL = 3;
274+
}
275+
259276
// Description of which voice to use for speech synthesis.
260277
message VoiceSelectionParams {
261278
// Optional. The name of the voice. If not set, the service will choose a
@@ -303,21 +320,29 @@ message SynthesizeSpeechConfig {
303320
VoiceSelectionParams voice = 4;
304321
}
305322

306-
// Gender of the voice as described in
307-
// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice).
308-
enum SsmlVoiceGender {
309-
// An unspecified gender, which means that the client doesn't care which
310-
// gender the selected voice will have.
311-
SSML_VOICE_GENDER_UNSPECIFIED = 0;
323+
// Audio encoding of the output audio format in Text-To-Speech.
324+
enum OutputAudioEncoding {
325+
// Not specified.
326+
OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0;
312327

313-
// A male voice.
314-
SSML_VOICE_GENDER_MALE = 1;
328+
// Uncompressed 16-bit signed little-endian samples (Linear PCM).
329+
// Audio content returned as LINEAR16 also contains a WAV header.
330+
OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1;
315331

316-
// A female voice.
317-
SSML_VOICE_GENDER_FEMALE = 2;
332+
// MP3 audio at 32kbps.
333+
OUTPUT_AUDIO_ENCODING_MP3 = 2;
318334

319-
// A gender-neutral voice.
320-
SSML_VOICE_GENDER_NEUTRAL = 3;
335+
// MP3 audio at 64kbps.
336+
OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4;
337+
338+
// Opus encoded audio wrapped in an ogg container. The result will be a
339+
// file which can be played natively on Android, and in browsers (at least
340+
// Chrome and Firefox). The quality of the encoding is considerably higher
341+
// than MP3 while using approximately the same bitrate.
342+
OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3;
343+
344+
// 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law.
345+
OUTPUT_AUDIO_ENCODING_MULAW = 5;
321346
}
322347

323348
// Instructs the speech synthesizer on how to generate the output audio content.
@@ -349,28 +374,3 @@ message SpeechToTextConfig {
349374
// would emit an error.
350375
SpeechModelVariant speech_model_variant = 1;
351376
}
352-
353-
// Audio encoding of the output audio format in Text-To-Speech.
354-
enum OutputAudioEncoding {
355-
// Not specified.
356-
OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0;
357-
358-
// Uncompressed 16-bit signed little-endian samples (Linear PCM).
359-
// Audio content returned as LINEAR16 also contains a WAV header.
360-
OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1;
361-
362-
// MP3 audio at 32kbps.
363-
OUTPUT_AUDIO_ENCODING_MP3 = 2;
364-
365-
// MP3 audio at 64kbps.
366-
OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4;
367-
368-
// Opus encoded audio wrapped in an ogg container. The result will be a
369-
// file which can be played natively on Android, and in browsers (at least
370-
// Chrome and Firefox). The quality of the encoding is considerably higher
371-
// than MP3 while using approximately the same bitrate.
372-
OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3;
373-
374-
// 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law.
375-
OUTPUT_AUDIO_ENCODING_MULAW = 5;
376-
}

google/cloud/dialogflow/v2/conversation.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import "google/api/annotations.proto";
2020
import "google/api/client.proto";
2121
import "google/api/field_behavior.proto";
2222
import "google/api/resource.proto";
23+
import "google/cloud/dialogflow/v2/audio_config.proto";
24+
import "google/cloud/dialogflow/v2/conversation_profile.proto";
2325
import "google/cloud/dialogflow/v2/participant.proto";
2426
import "google/protobuf/empty.proto";
2527
import "google/protobuf/timestamp.proto";

google/cloud/dialogflow/v2/conversation_event.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ syntax = "proto3";
1616

1717
package google.cloud.dialogflow.v2;
1818

19+
import "google/api/annotations.proto";
1920
import "google/cloud/dialogflow/v2/participant.proto";
2021
import "google/rpc/status.proto";
21-
import "google/api/annotations.proto";
2222

2323
option cc_enable_arenas = true;
2424
option csharp_namespace = "Google.Cloud.Dialogflow.V2";

google/cloud/dialogflow/v2/conversation_profile.proto

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,9 @@ message HumanAgentAssistantConfig {
329329

330330
// Configs of custom conversation model.
331331
ConversationModelConfig conversation_model_config = 7;
332+
333+
// Configs for processing conversation.
334+
ConversationProcessConfig conversation_process_config = 8;
332335
}
333336

334337
// Detail human agent assistant config.
@@ -469,6 +472,13 @@ message HumanAgentAssistantConfig {
469472
}];
470473
}
471474

475+
// Config to process conversation.
476+
message ConversationProcessConfig {
477+
// Number of recent non-small-talk sentences to use as context for article
478+
// and FAQ suggestion
479+
int32 recent_sentences_count = 2;
480+
}
481+
472482
// Configuration for analyses to run on each conversation message.
473483
message MessageAnalysisConfig {
474484
// Enable entity extraction in conversation messages on [agent assist

google/cloud/dialogflow/v2/dialogflow_v2.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ types:
2626
- name: google.cloud.dialogflow.v2.ConversationEvent
2727
- name: google.cloud.dialogflow.v2.ExportAgentResponse
2828
- name: google.cloud.dialogflow.v2.HumanAgentAssistantEvent
29+
- name: google.cloud.dialogflow.v2.ImportDocumentsResponse
2930
- name: google.cloud.dialogflow.v2.KnowledgeOperationMetadata
3031
- name: google.cloud.dialogflow.v2.OriginalDetectIntentRequest
3132
- name: google.cloud.dialogflow.v2.WebhookRequest

google/cloud/dialogflow/v2/document.proto

Lines changed: 98 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,31 @@ service Documents {
9797
};
9898
}
9999

100+
// Creates documents by importing data from external sources.
101+
// Dialogflow supports up to 350 documents in each request. If you try to
102+
// import more, Dialogflow will return an error.
103+
//
104+
// This method is a [long-running
105+
// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
106+
// The returned `Operation` type has the following method-specific fields:
107+
//
108+
// - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
109+
// - `response`: [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse]
110+
rpc ImportDocuments(ImportDocumentsRequest) returns (google.longrunning.Operation) {
111+
option (google.api.http) = {
112+
post: "/v2/{parent=projects/*/knowledgeBases/*}/documents:import"
113+
body: "*"
114+
additional_bindings {
115+
post: "/v2/{parent=projects/*/locations/*/knowledgeBases/*}/documents:import"
116+
body: "*"
117+
}
118+
};
119+
option (google.longrunning.operation_info) = {
120+
response_type: "ImportDocumentsResponse"
121+
metadata_type: "KnowledgeOperationMetadata"
122+
};
123+
}
124+
100125
// Deletes the specified document.
101126
//
102127
// This method is a [long-running
@@ -224,17 +249,6 @@ message Document {
224249
pattern: "projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}"
225250
};
226251

227-
// The status of a reload attempt.
228-
message ReloadStatus {
229-
// The time of a reload attempt.
230-
// This reload may have been triggered automatically or manually and may
231-
// not have succeeded.
232-
google.protobuf.Timestamp time = 1;
233-
234-
// The status of a reload attempt or the initial load.
235-
google.rpc.Status status = 2;
236-
}
237-
238252
// The knowledge type of document content.
239253
enum KnowledgeType {
240254
// The type is unspecified or arbitrary.
@@ -258,6 +272,17 @@ message Document {
258272
ARTICLE_SUGGESTION = 3;
259273
}
260274

275+
// The status of a reload attempt.
276+
message ReloadStatus {
277+
// The time of a reload attempt.
278+
// This reload may have been triggered automatically or manually and may
279+
// not have succeeded.
280+
google.protobuf.Timestamp time = 1;
281+
282+
// The status of a reload attempt or the initial load.
283+
google.rpc.Status status = 2;
284+
}
285+
261286
// Optional. The document resource name.
262287
// The name must be empty when creating a document.
263288
// Format: `projects/<Project ID>/locations/<Location
@@ -404,6 +429,65 @@ message CreateDocumentRequest {
404429
Document document = 2 [(google.api.field_behavior) = REQUIRED];
405430
}
406431

432+
// Request message for [Documents.ImportDocuments][google.cloud.dialogflow.v2.Documents.ImportDocuments].
433+
message ImportDocumentsRequest {
434+
// Required. The knowledge base to import documents into.
435+
// Format: `projects/<Project ID>/locations/<Location
436+
// ID>/knowledgeBases/<Knowledge Base ID>`.
437+
string parent = 1 [
438+
(google.api.field_behavior) = REQUIRED,
439+
(google.api.resource_reference) = {
440+
child_type: "dialogflow.googleapis.com/Document"
441+
}
442+
];
443+
444+
// Required. The source to use for importing documents.
445+
//
446+
// If the source captures multiple objects, then multiple documents will be
447+
// created, one corresponding to each object, and all of these documents will
448+
// be created using the same document template.
449+
//
450+
// Dialogflow supports up to 350 documents in each request. If you try to
451+
// import more, Dialogflow will return an error.
452+
oneof source {
453+
// The Google Cloud Storage location for the documents.
454+
// The path can include a wildcard.
455+
//
456+
// These URIs may have the forms
457+
// `gs://<bucket-name>/<object-name>`.
458+
// `gs://<bucket-name>/<object-path>/*.<extension>`.
459+
GcsSources gcs_source = 2;
460+
}
461+
462+
// Required. Document template used for importing all the documents.
463+
ImportDocumentTemplate document_template = 3 [(google.api.field_behavior) = REQUIRED];
464+
465+
// Whether to import custom metadata from Google Cloud Storage.
466+
// Only valid when the document source is Google Cloud Storage URI.
467+
bool import_gcs_custom_metadata = 4;
468+
}
469+
470+
// The template used for importing documents.
471+
message ImportDocumentTemplate {
472+
// Required. The MIME type of the document.
473+
string mime_type = 1 [(google.api.field_behavior) = REQUIRED];
474+
475+
// Required. The knowledge type of document content.
476+
repeated Document.KnowledgeType knowledge_types = 2 [(google.api.field_behavior) = REQUIRED];
477+
478+
// Metadata for the document. The metadata supports arbitrary
479+
// key-value pairs. Suggested use cases include storing a document's title,
480+
// an external URL distinct from the document's content_uri, etc.
481+
// The max size of a `key` or a `value` of the metadata is 1024 bytes.
482+
map<string, string> metadata = 3;
483+
}
484+
485+
// Response message for [Documents.ImportDocuments][google.cloud.dialogflow.v2.Documents.ImportDocuments].
486+
message ImportDocumentsResponse {
487+
// Includes details about skipped documents or any other warnings.
488+
repeated google.rpc.Status warnings = 1;
489+
}
490+
407491
// Request message for [Documents.DeleteDocument][google.cloud.dialogflow.v2.Documents.DeleteDocument].
408492
message DeleteDocumentRequest {
409493
// Required. The name of the document to delete.
@@ -507,4 +591,7 @@ message KnowledgeOperationMetadata {
507591

508592
// Output only. The current state of this operation.
509593
State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
594+
595+
// The name of the knowledge base interacted with during the operation.
596+
string knowledge_base = 3;
510597
}

0 commit comments

Comments
 (0)