Skip to content

Commit

Permalink
feat: [dialogflow-cx] added Generator API (#4837)
Browse files Browse the repository at this point in the history
* feat: add agent answer feedback capability
feat: add fields for supporting barge-in in StreamingDetectIntent API
feat: add end_user_metadata to QueryParameters
feat: add boost & bury and filter ES controls

PiperOrigin-RevId: 583522403

Source-Link: googleapis/googleapis@86c7ca6

Source-Link: googleapis/googleapis-gen@42f2c6e
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRpYWxvZ2Zsb3ctY3gvLk93bEJvdC55YW1sIiwiaCI6IjQyZjJjNmU5NzlhMWQyYTZmYWVkZDc3MmUyM2Q0OWU2ZWYwMTk0NzAifQ==

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: add agent answer feedback capability
feat: add fields for supporting barge-in in StreamingDetectIntent API
feat: add end_user_metadata to QueryParameters
feat: add boost & bury and filter ES controls

PiperOrigin-RevId: 583523426

Source-Link: googleapis/googleapis@c73d0da

Source-Link: googleapis/googleapis-gen@1b5ed29
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRpYWxvZ2Zsb3ctY3gvLk93bEJvdC55YW1sIiwiaCI6IjFiNWVkMjk0OThiMzRlMTAxNmUxZjY5ZWNiMjgwODE2OGJkMzRkMTUifQ==

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: added Generator API
docs: updated doc for speech model

PiperOrigin-RevId: 586288282

Source-Link: googleapis/googleapis@17d36c4

Source-Link: googleapis/googleapis-gen@e2fb5ba
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRpYWxvZ2Zsb3ctY3gvLk93bEJvdC55YW1sIiwiaCI6ImUyZmI1YmFiZmVjOTJmNzVmMTdmMzFmOTBiNjViYTVmZjNkNjkwOTUifQ==

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: added Generator API
docs: updated doc for speech mode

PiperOrigin-RevId: 586469693

Source-Link: googleapis/googleapis@e8148d6

Source-Link: googleapis/googleapis-gen@85136bd
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRpYWxvZ2Zsb3ctY3gvLk93bEJvdC55YW1sIiwiaCI6Ijg1MTM2YmQwNDM4M2VkNzE3MmJiMThiN2I4ZDIyMGRkN2ZmNmIzYTAifQ==

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 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>
Co-authored-by: sofisl <[email protected]>
  • Loading branch information
3 people authored Nov 30, 2023
1 parent 061e9a8 commit 34ddf57
Show file tree
Hide file tree
Showing 144 changed files with 75,697 additions and 37,905 deletions.
12 changes: 12 additions & 0 deletions packages/google-cloud-dialogflow-cx/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ message Agent {
string engine = 1 [(google.api.field_behavior) = REQUIRED];
}

// Settings for answer feedback collection.
message AnswerFeedbackSettings {
// Optional. If enabled, end users will be able to provide
// [answer feedback][google.cloud.dialogflow.cx.v3.AnswerFeedback] to
// Dialogflow responses. Feature works only if interaction logging is
// enabled in the Dialogflow agent.
bool enable_answer_feedback = 1 [(google.api.field_behavior) = OPTIONAL];
}

// The unique identifier of the agent.
// Required for the
// [Agents.UpdateAgent][google.cloud.dialogflow.cx.v3.Agents.UpdateAgent]
Expand Down Expand Up @@ -335,6 +344,10 @@ message Agent {

// Gen App Builder-related agent-level settings.
optional GenAppBuilderSettings gen_app_builder_settings = 33;

// Optional. Answer feedback collection settings.
AnswerFeedbackSettings answer_feedback_settings = 38
[(google.api.field_behavior) = OPTIONAL];
}

// The request message for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,39 @@ message SpeechWordInfo {
float confidence = 4;
}

// Configuration of the barge-in behavior. Barge-in instructs the API to return
// a detected utterance at a proper time while the client is playing back the
// response audio from a previous request. When the client sees the
// utterance, it should stop the playback and immediately get ready for
// receiving the responses for the current request.
//
// The barge-in handling requires the client to start streaming audio input
// as soon as it starts playing back the audio from the previous response. The
// playback is modeled into two phases:
//
// * No barge-in phase: which goes first and during which speech detection
// should not be carried out.
//
// * Barge-in phase: which follows the no barge-in phase and during which
// the API starts speech detection and may inform the client that an utterance
// has been detected. Note that no-speech event is not expected in this
// phase.
//
// The client provides this configuration in terms of the durations of those
// two phases. The durations are measured in terms of the audio length from the
// the start of the input audio.
//
// No-speech event is a response with END_OF_UTTERANCE without any transcript
// following up.
message BargeInConfig {
// Duration that is not eligible for barge-in at the beginning of the input
// audio.
google.protobuf.Duration no_barge_in_duration = 1;

// Total duration for the playback at the beginning of the input audio.
google.protobuf.Duration total_duration = 2;
}

// Instructs the speech recognizer on how to process the audio content.
message InputAudioConfig {
// Required. Audio encoding of the audio content to process.
Expand Down Expand Up @@ -181,8 +214,8 @@ message InputAudioConfig {

// Optional. Which Speech model to select for the given request. Select the
// model best suited to your domain to get best results. If a model is not
// explicitly specified, then we auto-select a model based on the parameters
// in the InputAudioConfig.
// explicitly specified, then Dialogflow auto-selects a model based on other
// parameters in the InputAudioConfig and Agent settings.
// If enhanced speech model is enabled for the agent and an enhanced
// version of the specified model for the language does not exist, then the
// speech is recognized using the standard version of the specified model.
Expand All @@ -195,7 +228,12 @@ message InputAudioConfig {
//
// - phone_call (best for Agent Assist and telephony)
// - latest_short (best for Dialogflow non-telephony)
// - command_and_search (best for very short utterances and commands)
// - command_and_search
//
// Leave this field unspecified to use
// [Agent Speech
// settings](https://cloud.google.com/dialogflow/cx/docs/concept/agent#settings-speech)
// for model selection.
string model = 7;

// Optional. Which variant of the [Speech
Expand All @@ -211,6 +249,9 @@ message InputAudioConfig {
// needed.
// Note: This setting is relevant only for streaming methods.
bool single_utterance = 8;

// Configuration of barge-in behavior during the streaming of input audio.
BargeInConfig barge_in_config = 15;
}

// Gender of the voice as described in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@ service EntityTypes {
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/dialogflow";

// Returns the list of all entity types in the specified agent.
rpc ListEntityTypes(ListEntityTypesRequest)
returns (ListEntityTypesResponse) {
option (google.api.http) = {
get: "/v3/{parent=projects/*/locations/*/agents/*}/entityTypes"
};
option (google.api.method_signature) = "parent";
}

// Retrieves the specified entity type.
rpc GetEntityType(GetEntityTypeRequest) returns (EntityType) {
option (google.api.http) = {
Expand Down Expand Up @@ -94,6 +85,15 @@ service EntityTypes {
};
option (google.api.method_signature) = "name";
}

// Returns the list of all entity types in the specified agent.
rpc ListEntityTypes(ListEntityTypesRequest)
returns (ListEntityTypesResponse) {
option (google.api.http) = {
get: "/v3/{parent=projects/*/locations/*/agents/*}/entityTypes"
};
option (google.api.method_signature) = "parent";
}
}

// Entities are extracted from user input and represent parameters that are
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.cloud.dialogflow.cx.v3;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";

option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3";
option go_package = "cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpb";
option java_multiple_files = true;
option java_outer_classname = "GeneratorProto";
option java_package = "com.google.cloud.dialogflow.cx.v3";
option objc_class_prefix = "DF";

// Service for managing [Generators][google.cloud.dialogflow.cx.v3.Generator]
service Generators {
option (google.api.default_host) = "dialogflow.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/dialogflow";

// Returns the list of all generators in the specified agent.
rpc ListGenerators(ListGeneratorsRequest) returns (ListGeneratorsResponse) {
option (google.api.http) = {
get: "/v3/{parent=projects/*/locations/*/agents/*}/generators"
};
option (google.api.method_signature) = "parent";
}

// Retrieves the specified generator.
rpc GetGenerator(GetGeneratorRequest) returns (Generator) {
option (google.api.http) = {
get: "/v3/{name=projects/*/locations/*/agents/*/generators/*}"
};
option (google.api.method_signature) = "name";
}

// Creates a generator in the specified agent.
rpc CreateGenerator(CreateGeneratorRequest) returns (Generator) {
option (google.api.http) = {
post: "/v3/{parent=projects/*/locations/*/agents/*}/generators"
body: "generator"
};
option (google.api.method_signature) = "parent,generator";
}

// Update the specified generator.
rpc UpdateGenerator(UpdateGeneratorRequest) returns (Generator) {
option (google.api.http) = {
patch: "/v3/{generator.name=projects/*/locations/*/agents/*/generators/*}"
body: "generator"
};
option (google.api.method_signature) = "generator,update_mask";
}

// Deletes the specified generators.
rpc DeleteGenerator(DeleteGeneratorRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v3/{name=projects/*/locations/*/agents/*/generators/*}"
};
option (google.api.method_signature) = "name";
}
}

// Generators contain prompt to be sent to the LLM model to generate text. The
// prompt can contain parameters which will be resolved before calling the
// model. It can optionally contain banned phrases to ensure the model responses
// are safe.
message Generator {
option (google.api.resource) = {
type: "dialogflow.googleapis.com/Generator"
pattern: "projects/{project}/locations/{location}/agents/{agent}/generators/{generator}"
};

// Represents a custom placeholder in the prompt text.
message Placeholder {
// Unique ID used to map custom placeholder to parameters in fulfillment.
string id = 1;

// Custom placeholder value in the prompt text.
string name = 2;
}

// The unique identifier of the generator.
// Must be set for the
// [Generators.UpdateGenerator][google.cloud.dialogflow.cx.v3.Generators.UpdateGenerator]
// method. [Generators.CreateGenerate][] populates the name automatically.
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
// ID>/generators/<Generator ID>`.
string name = 1;

// Required. The human-readable name of the generator, unique within the
// agent. The prompt contains pre-defined parameters such as $conversation,
// $last-user-utterance, etc. populated by Dialogflow. It can also contain
// custom placeholders which will be resolved during fulfillment.
string display_name = 2 [(google.api.field_behavior) = REQUIRED];

// Required. Prompt for the LLM model.
Phrase prompt_text = 3 [(google.api.field_behavior) = REQUIRED];

// Optional. List of custom placeholders in the prompt text.
repeated Placeholder placeholders = 5
[(google.api.field_behavior) = OPTIONAL];
}

// Text input which can be used for prompt or banned phrases.
message Phrase {
// Required. Text input which can be used for prompt or banned phrases.
string text = 1 [(google.api.field_behavior) = REQUIRED];
}

// The request message for
// [Generators.ListGenerators][google.cloud.dialogflow.cx.v3.Generators.ListGenerators].
message ListGeneratorsRequest {
// Required. The agent to list all generators for.
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "dialogflow.googleapis.com/Generator"
}
];

// The language to list generators for.
string language_code = 2;

// The maximum number of items to return in a single page. By default 100 and
// at most 1000.
int32 page_size = 3;

// The next_page_token value returned from a previous list request.
string page_token = 4;
}

// The response message for
// [Generators.ListGenerators][google.cloud.dialogflow.cx.v3.Generators.ListGenerators].
message ListGeneratorsResponse {
// The list of generators. There will be a maximum number of items returned
// based on the page_size field in the request.
repeated Generator generators = 1;

// Token to retrieve the next page of results, or empty if there are no more
// results in the list.
string next_page_token = 2;
}

// The request message for
// [Generators.GetGenerator][google.cloud.dialogflow.cx.v3.Generators.GetGenerator].
message GetGeneratorRequest {
// Required. The name of the generator.
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
// ID>/generators/<Generator ID>`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "dialogflow.googleapis.com/Generator"
}
];

// The language to list generators for.
string language_code = 2;
}

// The request message for
// [Generators.CreateGenerator][google.cloud.dialogflow.cx.v3.Generators.CreateGenerator].
message CreateGeneratorRequest {
// Required. The agent to create a generator for.
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "dialogflow.googleapis.com/Generator"
}
];

// Required. The generator to create.
Generator generator = 2 [(google.api.field_behavior) = REQUIRED];

// The language to create generators for the following fields:
// * `Generator.prompt_text.text`
// If not specified, the agent's default language is used.
string language_code = 3;
}

// The request message for
// [Generators.UpdateGenerator][google.cloud.dialogflow.cx.v3.Generators.UpdateGenerator].
message UpdateGeneratorRequest {
// Required. The generator to update.
Generator generator = 1 [(google.api.field_behavior) = REQUIRED];

// The language to list generators for.
string language_code = 2;

// The mask to control which fields get updated. If the mask is not present,
// all fields will be updated.
google.protobuf.FieldMask update_mask = 3;
}

// The request message for
// [Generators.DeleteGenerator][google.cloud.dialogflow.cx.v3.Generators.DeleteGenerator].
message DeleteGeneratorRequest {
// Required. The name of the generator to delete.
// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
// ID>/generators/<Generator ID>`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "dialogflow.googleapis.com/Generator"
}
];

// This field has no effect for generators not being used.
// For generators that are used by pages/flows/transition route groups:
//
// * If `force` is set to false, an error will be returned with message
// indicating the referenced resources.
// * If `force` is set to true, Dialogflow will remove the generator, as well
// as any references to the generator (i.e.
// [Generator][Fulfillment.generator]) in fulfillments.
bool force = 2;
}
Loading

0 comments on commit 34ddf57

Please sign in to comment.