Skip to content

Commit

Permalink
feat: added conversation process config, ImportDocument and SuggestSm…
Browse files Browse the repository at this point in the history
…artReplies API

PiperOrigin-RevId: 423223164
  • Loading branch information
Google APIs authored and Copybara-Service committed Jan 21, 2022
1 parent 56da7b0 commit 356f0c0
Show file tree
Hide file tree
Showing 12 changed files with 413 additions and 201 deletions.
126 changes: 63 additions & 63 deletions google/cloud/dialogflow/v2/audio_config.proto
Expand Up @@ -16,11 +16,11 @@ syntax = "proto3";

package google.cloud.dialogflow.v2;

import "google/api/annotations.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";

option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.Dialogflow.V2";
Expand Down Expand Up @@ -109,31 +109,6 @@ message SpeechContext {
float boost = 2;
}

// Information for a word recognized by the speech recognizer.
message SpeechWordInfo {
// The word this info is for.
string word = 3;

// Time offset relative to the beginning of the audio that corresponds to the
// start of the spoken word. This is an experimental feature and the accuracy
// of the time offset can vary.
google.protobuf.Duration start_offset = 1;

// Time offset relative to the beginning of the audio that corresponds to the
// end of the spoken word. This is an experimental feature and the accuracy of
// the time offset can vary.
google.protobuf.Duration end_offset = 2;

// The Speech confidence between 0.0 and 1.0 for this word. A higher number
// indicates an estimated greater likelihood that the recognized word is
// correct. The default of 0.0 is a sentinel value indicating that confidence
// was not set.
//
// This field is not guaranteed to be fully stable over time for the same
// audio input. Users should also not rely on it to always be provided.
float confidence = 4;
}

// Variant of the specified [Speech model][google.cloud.dialogflow.v2.InputAudioConfig.model] to use.
//
// See the [Cloud Speech
Expand Down Expand Up @@ -177,6 +152,31 @@ enum SpeechModelVariant {
USE_ENHANCED = 3;
}

// Information for a word recognized by the speech recognizer.
message SpeechWordInfo {
// The word this info is for.
string word = 3;

// Time offset relative to the beginning of the audio that corresponds to the
// start of the spoken word. This is an experimental feature and the accuracy
// of the time offset can vary.
google.protobuf.Duration start_offset = 1;

// Time offset relative to the beginning of the audio that corresponds to the
// end of the spoken word. This is an experimental feature and the accuracy of
// the time offset can vary.
google.protobuf.Duration end_offset = 2;

// The Speech confidence between 0.0 and 1.0 for this word. A higher number
// indicates an estimated greater likelihood that the recognized word is
// correct. The default of 0.0 is a sentinel value indicating that confidence
// was not set.
//
// This field is not guaranteed to be fully stable over time for the same
// audio input. Users should also not rely on it to always be provided.
float confidence = 4;
}

// Instructs the speech recognizer how to process the audio content.
message InputAudioConfig {
// Required. Audio encoding of the audio content to process.
Expand Down Expand Up @@ -256,6 +256,23 @@ message InputAudioConfig {
bool disable_no_speech_recognized_event = 14;
}

// Gender of the voice as described in
// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice).
enum SsmlVoiceGender {
// An unspecified gender, which means that the client doesn't care which
// gender the selected voice will have.
SSML_VOICE_GENDER_UNSPECIFIED = 0;

// A male voice.
SSML_VOICE_GENDER_MALE = 1;

// A female voice.
SSML_VOICE_GENDER_FEMALE = 2;

// A gender-neutral voice.
SSML_VOICE_GENDER_NEUTRAL = 3;
}

// Description of which voice to use for speech synthesis.
message VoiceSelectionParams {
// Optional. The name of the voice. If not set, the service will choose a
Expand Down Expand Up @@ -303,21 +320,29 @@ message SynthesizeSpeechConfig {
VoiceSelectionParams voice = 4;
}

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

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

// A female voice.
SSML_VOICE_GENDER_FEMALE = 2;
// MP3 audio at 32kbps.
OUTPUT_AUDIO_ENCODING_MP3 = 2;

// A gender-neutral voice.
SSML_VOICE_GENDER_NEUTRAL = 3;
// MP3 audio at 64kbps.
OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4;

// Opus encoded audio wrapped in an ogg container. The result will be a
// file which can be played natively on Android, and in browsers (at least
// Chrome and Firefox). The quality of the encoding is considerably higher
// than MP3 while using approximately the same bitrate.
OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3;

// 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law.
OUTPUT_AUDIO_ENCODING_MULAW = 5;
}

// Instructs the speech synthesizer on how to generate the output audio content.
Expand Down Expand Up @@ -349,28 +374,3 @@ message SpeechToTextConfig {
// would emit an error.
SpeechModelVariant speech_model_variant = 1;
}

// Audio encoding of the output audio format in Text-To-Speech.
enum OutputAudioEncoding {
// Not specified.
OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0;

// Uncompressed 16-bit signed little-endian samples (Linear PCM).
// Audio content returned as LINEAR16 also contains a WAV header.
OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1;

// MP3 audio at 32kbps.
OUTPUT_AUDIO_ENCODING_MP3 = 2;

// MP3 audio at 64kbps.
OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4;

// Opus encoded audio wrapped in an ogg container. The result will be a
// file which can be played natively on Android, and in browsers (at least
// Chrome and Firefox). The quality of the encoding is considerably higher
// than MP3 while using approximately the same bitrate.
OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3;

// 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law.
OUTPUT_AUDIO_ENCODING_MULAW = 5;
}
2 changes: 2 additions & 0 deletions google/cloud/dialogflow/v2/conversation.proto
Expand Up @@ -20,6 +20,8 @@ import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/dialogflow/v2/audio_config.proto";
import "google/cloud/dialogflow/v2/conversation_profile.proto";
import "google/cloud/dialogflow/v2/participant.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/dialogflow/v2/conversation_event.proto
Expand Up @@ -16,9 +16,9 @@ syntax = "proto3";

package google.cloud.dialogflow.v2;

import "google/api/annotations.proto";
import "google/cloud/dialogflow/v2/participant.proto";
import "google/rpc/status.proto";
import "google/api/annotations.proto";

option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.Dialogflow.V2";
Expand Down
10 changes: 10 additions & 0 deletions google/cloud/dialogflow/v2/conversation_profile.proto
Expand Up @@ -329,6 +329,9 @@ message HumanAgentAssistantConfig {

// Configs of custom conversation model.
ConversationModelConfig conversation_model_config = 7;

// Configs for processing conversation.
ConversationProcessConfig conversation_process_config = 8;
}

// Detail human agent assistant config.
Expand Down Expand Up @@ -469,6 +472,13 @@ message HumanAgentAssistantConfig {
}];
}

// Config to process conversation.
message ConversationProcessConfig {
// Number of recent non-small-talk sentences to use as context for article
// and FAQ suggestion
int32 recent_sentences_count = 2;
}

// Configuration for analyses to run on each conversation message.
message MessageAnalysisConfig {
// Enable entity extraction in conversation messages on [agent assist
Expand Down
1 change: 1 addition & 0 deletions google/cloud/dialogflow/v2/dialogflow_v2.yaml
Expand Up @@ -26,6 +26,7 @@ types:
- name: google.cloud.dialogflow.v2.ConversationEvent
- name: google.cloud.dialogflow.v2.ExportAgentResponse
- name: google.cloud.dialogflow.v2.HumanAgentAssistantEvent
- name: google.cloud.dialogflow.v2.ImportDocumentsResponse
- name: google.cloud.dialogflow.v2.KnowledgeOperationMetadata
- name: google.cloud.dialogflow.v2.OriginalDetectIntentRequest
- name: google.cloud.dialogflow.v2.WebhookRequest
Expand Down
109 changes: 98 additions & 11 deletions google/cloud/dialogflow/v2/document.proto
Expand Up @@ -97,6 +97,31 @@ service Documents {
};
}

// Creates documents by importing data from external sources.
// Dialogflow supports up to 350 documents in each request. If you try to
// import more, Dialogflow will return an error.
//
// This method is a [long-running
// operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
// The returned `Operation` type has the following method-specific fields:
//
// - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata]
// - `response`: [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse]
rpc ImportDocuments(ImportDocumentsRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v2/{parent=projects/*/knowledgeBases/*}/documents:import"
body: "*"
additional_bindings {
post: "/v2/{parent=projects/*/locations/*/knowledgeBases/*}/documents:import"
body: "*"
}
};
option (google.longrunning.operation_info) = {
response_type: "ImportDocumentsResponse"
metadata_type: "KnowledgeOperationMetadata"
};
}

// Deletes the specified document.
//
// This method is a [long-running
Expand Down Expand Up @@ -224,17 +249,6 @@ message Document {
pattern: "projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}"
};

// The status of a reload attempt.
message ReloadStatus {
// The time of a reload attempt.
// This reload may have been triggered automatically or manually and may
// not have succeeded.
google.protobuf.Timestamp time = 1;

// The status of a reload attempt or the initial load.
google.rpc.Status status = 2;
}

// The knowledge type of document content.
enum KnowledgeType {
// The type is unspecified or arbitrary.
Expand All @@ -258,6 +272,17 @@ message Document {
ARTICLE_SUGGESTION = 3;
}

// The status of a reload attempt.
message ReloadStatus {
// The time of a reload attempt.
// This reload may have been triggered automatically or manually and may
// not have succeeded.
google.protobuf.Timestamp time = 1;

// The status of a reload attempt or the initial load.
google.rpc.Status status = 2;
}

// Optional. The document resource name.
// The name must be empty when creating a document.
// Format: `projects/<Project ID>/locations/<Location
Expand Down Expand Up @@ -404,6 +429,65 @@ message CreateDocumentRequest {
Document document = 2 [(google.api.field_behavior) = REQUIRED];
}

// Request message for [Documents.ImportDocuments][google.cloud.dialogflow.v2.Documents.ImportDocuments].
message ImportDocumentsRequest {
// Required. The knowledge base to import documents into.
// Format: `projects/<Project ID>/locations/<Location
// ID>/knowledgeBases/<Knowledge Base ID>`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "dialogflow.googleapis.com/Document"
}
];

// Required. The source to use for importing documents.
//
// If the source captures multiple objects, then multiple documents will be
// created, one corresponding to each object, and all of these documents will
// be created using the same document template.
//
// Dialogflow supports up to 350 documents in each request. If you try to
// import more, Dialogflow will return an error.
oneof source {
// The Google Cloud Storage location for the documents.
// The path can include a wildcard.
//
// These URIs may have the forms
// `gs://<bucket-name>/<object-name>`.
// `gs://<bucket-name>/<object-path>/*.<extension>`.
GcsSources gcs_source = 2;
}

// Required. Document template used for importing all the documents.
ImportDocumentTemplate document_template = 3 [(google.api.field_behavior) = REQUIRED];

// Whether to import custom metadata from Google Cloud Storage.
// Only valid when the document source is Google Cloud Storage URI.
bool import_gcs_custom_metadata = 4;
}

// The template used for importing documents.
message ImportDocumentTemplate {
// Required. The MIME type of the document.
string mime_type = 1 [(google.api.field_behavior) = REQUIRED];

// Required. The knowledge type of document content.
repeated Document.KnowledgeType knowledge_types = 2 [(google.api.field_behavior) = REQUIRED];

// Metadata for the document. The metadata supports arbitrary
// key-value pairs. Suggested use cases include storing a document's title,
// an external URL distinct from the document's content_uri, etc.
// The max size of a `key` or a `value` of the metadata is 1024 bytes.
map<string, string> metadata = 3;
}

// Response message for [Documents.ImportDocuments][google.cloud.dialogflow.v2.Documents.ImportDocuments].
message ImportDocumentsResponse {
// Includes details about skipped documents or any other warnings.
repeated google.rpc.Status warnings = 1;
}

// Request message for [Documents.DeleteDocument][google.cloud.dialogflow.v2.Documents.DeleteDocument].
message DeleteDocumentRequest {
// Required. The name of the document to delete.
Expand Down Expand Up @@ -507,4 +591,7 @@ message KnowledgeOperationMetadata {

// Output only. The current state of this operation.
State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

// The name of the knowledge base interacted with during the operation.
string knowledge_base = 3;
}

0 comments on commit 356f0c0

Please sign in to comment.