Skip to content

Commit

Permalink
feat: [dialogflow] add options of query_source, search_config, end_us…
Browse files Browse the repository at this point in the history
…er_metadata and exact_search (#5789)

* feat: added support for ALAW encoding
feat: add options of query_source, search_config and context_size

PiperOrigin-RevId: 693786098

Source-Link: googleapis/googleapis@35214c2

Source-Link: googleapis/googleapis-gen@d6b4c37
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRpYWxvZ2Zsb3cvLk93bEJvdC55YW1sIiwiaCI6ImQ2YjRjMzcwYWY0MGNhOWIzZTAzMGIxNWY0NjQyNTYyMDgzY2I5MGYifQ==

* 🦉 Updates from OwlBot post-processor

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

* feat: added support for ALAW encoding
feat: add options of query_source, search_config and context_size
feat: add SipTrunks service

PiperOrigin-RevId: 694047306

Source-Link: googleapis/googleapis@4a6ea32

Source-Link: googleapis/googleapis-gen@976c205
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRpYWxvZ2Zsb3cvLk93bEJvdC55YW1sIiwiaCI6Ijk3NmMyMDU4ZmNmMWVlYjM3NWUxMTlhOTNkOWFmMjY4MGM4NmY5MjAifQ==

* 🦉 Updates from OwlBot post-processor

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

* feat: add options of query_source, search_config, end_user_metadata and exact_search
feat: expose metadata in AnswerSource

PiperOrigin-RevId: 695456323

Source-Link: googleapis/googleapis@8081c74

Source-Link: googleapis/googleapis-gen@a74e716
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRpYWxvZ2Zsb3cvLk93bEJvdC55YW1sIiwiaCI6ImE3NGU3MTZiMjM0NWE4NjlkMjVjMmZlYWRmMjBjOWE0M2IxY2Y0NjkifQ==

* 🦉 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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Nov 13, 2024
1 parent 49e8cd1 commit 25a2241
Show file tree
Hide file tree
Showing 112 changed files with 18,827 additions and 67 deletions.
5 changes: 5 additions & 0 deletions packages/google-cloud-dialogflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/
| Session_entity_types.update_session_entity_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js,packages/google-cloud-dialogflow/samples/README.md) |
| Sessions.detect_intent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.detect_intent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.detect_intent.js,packages/google-cloud-dialogflow/samples/README.md) |
| Sessions.streaming_detect_intent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.streaming_detect_intent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.streaming_detect_intent.js,packages/google-cloud-dialogflow/samples/README.md) |
| Sip_trunks.create_sip_trunk | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/sip_trunks.create_sip_trunk.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/sip_trunks.create_sip_trunk.js,packages/google-cloud-dialogflow/samples/README.md) |
| Sip_trunks.delete_sip_trunk | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/sip_trunks.delete_sip_trunk.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/sip_trunks.delete_sip_trunk.js,packages/google-cloud-dialogflow/samples/README.md) |
| Sip_trunks.get_sip_trunk | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/sip_trunks.get_sip_trunk.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/sip_trunks.get_sip_trunk.js,packages/google-cloud-dialogflow/samples/README.md) |
| Sip_trunks.list_sip_trunks | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/sip_trunks.list_sip_trunks.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/sip_trunks.list_sip_trunks.js,packages/google-cloud-dialogflow/samples/README.md) |
| Sip_trunks.update_sip_trunk | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/sip_trunks.update_sip_trunk.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/sip_trunks.update_sip_trunk.js,packages/google-cloud-dialogflow/samples/README.md) |
| Versions.create_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.create_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.create_version.js,packages/google-cloud-dialogflow/samples/README.md) |
| Versions.delete_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.delete_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.delete_version.js,packages/google-cloud-dialogflow/samples/README.md) |
| Versions.get_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.get_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.get_version.js,packages/google-cloud-dialogflow/samples/README.md) |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/struct.proto";

option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.Dialogflow.V2";
option go_package = "cloud.google.com/go/dialogflow/apiv2/dialogflowpb;dialogflowpb";
option java_multiple_files = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/duration.proto";

option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.Dialogflow.V2";
option go_package = "cloud.google.com/go/dialogflow/apiv2/dialogflowpb;dialogflowpb";
option java_multiple_files = true;
Expand Down Expand Up @@ -168,6 +167,11 @@ message InputAudioConfig {
// Enable automatic punctuation option at the speech backend.
bool enable_automatic_punctuation = 17;

// A collection of phrase set resources to use for speech adaptation.
repeated string phrase_sets = 20 [(google.api.resource_reference) = {
type: "speech.googleapis.com/PhraseSet"
}];

// If `true`, the request will opt out for STT conformer model migration.
// This field will be deprecated once force migration takes place in June
// 2024. Please refer to [Dialogflow ES Speech model
Expand Down Expand Up @@ -287,6 +291,11 @@ message SpeechToTextConfig {
// for model selection.
string model = 2;

// List of names of Cloud Speech phrase sets that are used for transcription.
repeated string phrase_sets = 4 [(google.api.resource_reference) = {
type: "speech.googleapis.com/PhraseSet"
}];

// Audio encoding of the audio content to process.
AudioEncoding audio_encoding = 6;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/struct.proto";

option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.Dialogflow.V2";
option go_package = "cloud.google.com/go/dialogflow/apiv2/dialogflowpb;dialogflowpb";
option java_multiple_files = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,20 @@ import "google/cloud/dialogflow/v2/conversation_profile.proto";
import "google/cloud/dialogflow/v2/generator.proto";
import "google/cloud/dialogflow/v2/participant.proto";
import "google/cloud/dialogflow/v2/session.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";

option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.Dialogflow.V2";
option go_package = "cloud.google.com/go/dialogflow/apiv2/dialogflowpb;dialogflowpb";
option java_multiple_files = true;
option java_outer_classname = "ConversationProto";
option java_package = "com.google.cloud.dialogflow.v2";
option objc_class_prefix = "DF";
option (google.api.resource_definition) = {
type: "discoveryengine.googleapis.com/DataStore"
pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}"
pattern: "projects/{project}/locations/{location}/dataStores/{data_store}"
};

// Service for managing
// [Conversations][google.cloud.dialogflow.v2.Conversation].
Expand Down Expand Up @@ -306,9 +311,9 @@ message CreateConversationRequest {
// Google. Only set it if you cannot wait for the response to return a
// auto-generated one to you.
//
// The conversation ID must be compliant with the regression fomula
// The conversation ID must be compliant with the regression formula
// `[a-zA-Z][a-zA-Z0-9_-]*` with the characters length in range of [3,64].
// If the field is provided, the caller is resposible for
// If the field is provided, the caller is responsible for
// 1. the uniqueness of the ID, otherwise the request will be rejected.
// 2. the consistency for whether to use custom ID or not under a project to
// better ensure uniqueness.
Expand Down Expand Up @@ -646,6 +651,183 @@ message GenerateStatelessSuggestionResponse {
// The request message for
// [Conversations.SearchKnowledge][google.cloud.dialogflow.v2.Conversations.SearchKnowledge].
message SearchKnowledgeRequest {
// The source of the query. We use QuerySource to distinguish queries directly
// entered by agents and suggested queries from
// [Participants.SuggestKnowledgeAssist][google.cloud.dialogflow.v2.Participants.SuggestKnowledgeAssist].
// If SUGGESTED_QUERY source is specified, we will treat it as a continuation
// of a SuggestKnowledgeAssist call.
enum QuerySource {
// Unknown query source.
QUERY_SOURCE_UNSPECIFIED = 0;

// The query is from agents.
AGENT_QUERY = 1;

// The query is a suggested query from
// [Participants.SuggestKnowledgeAssist][google.cloud.dialogflow.v2.Participants.SuggestKnowledgeAssist].
SUGGESTED_QUERY = 2;
}

// Configuration specific to search queries with data stores.
message SearchConfig {
// Boost specifications for data stores.
message BoostSpecs {
// Boost specification to boost certain documents.
// A copy of google.cloud.discoveryengine.v1main.BoostSpec, field
// documentation is available at
// https://cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1alpha/BoostSpec
message BoostSpec {
// Boost applies to documents which match a condition.
message ConditionBoostSpec {
// Specification for custom ranking based on customer specified
// attribute
// value. It provides more controls for customized ranking than the
// simple (condition, boost) combination above.
message BoostControlSpec {
// The attribute(or function) for which the custom ranking is to be
// applied.
enum AttributeType {
// Unspecified AttributeType.
ATTRIBUTE_TYPE_UNSPECIFIED = 0;

// The value of the numerical field will be used to dynamically
// update the boost amount. In this case, the attribute_value (the
// x value) of the control point will be the actual value of the
// numerical field for which the boost_amount is specified.
NUMERICAL = 1;

// For the freshness use case the attribute value will be the
// duration between the current time and the date in the datetime
// field specified. The value must be formatted as an XSD
// `dayTimeDuration` value (a restricted subset of an ISO 8601
// duration value). The pattern for this is:
// `[nD][T[nH][nM][nS]]`. E.g. `5D`, `3DT12H30M`, `T24H`.
FRESHNESS = 2;
}

// The interpolation type to be applied. Default will be linear
// (Piecewise Linear).
enum InterpolationType {
// Interpolation type is unspecified. In this case, it defaults to
// Linear.
INTERPOLATION_TYPE_UNSPECIFIED = 0;

// Piecewise linear interpolation will be applied.
LINEAR = 1;
}

// The control points used to define the curve. The curve defined
// through these control points can only be monotonically increasing
// or decreasing(constant values are acceptable).
message ControlPoint {}

// Optional. The name of the field whose value will be used to
// determine the boost amount.
string field_name = 1 [(google.api.field_behavior) = OPTIONAL];

// Optional. The attribute type to be used to determine the boost
// amount. The attribute value can be derived from the field value
// of the specified field_name. In the case of numerical it is
// straightforward i.e. attribute_value = numerical_field_value. In
// the case of freshness however, attribute_value = (time.now() -
// datetime_field_value).
AttributeType attribute_type = 2
[(google.api.field_behavior) = OPTIONAL];

// Optional. The interpolation type to be applied to connect the
// control points listed below.
InterpolationType interpolation_type = 3
[(google.api.field_behavior) = OPTIONAL];

// Optional. The control points used to define the curve. The
// monotonic function (defined through the interpolation_type above)
// passes through the control points listed here.
repeated ControlPoint control_points = 4
[(google.api.field_behavior) = OPTIONAL];
}

// Optional. An expression which specifies a boost condition. The
// syntax and supported fields are the same as a filter expression.
// Examples:
//
// * To boost documents with document ID "doc_1" or "doc_2", and
// color
// "Red" or "Blue":
// * (id: ANY("doc_1", "doc_2")) AND (color: ANY("Red","Blue"))
string condition = 1 [(google.api.field_behavior) = OPTIONAL];

// Optional. Strength of the condition boost, which should be in [-1,
// 1]. Negative boost means demotion. Default is 0.0.
//
// Setting to 1.0 gives the document a big promotion. However, it does
// not necessarily mean that the boosted document will be the top
// result at all times, nor that other documents will be excluded.
// Results could still be shown even when none of them matches the
// condition. And results that are significantly more relevant to the
// search query can still trump your heavily favored but irrelevant
// documents.
//
// Setting to -1.0 gives the document a big demotion. However, results
// that are deeply relevant might still be shown. The document will
// have an upstream battle to get a fairly high ranking, but it is not
// blocked out completely.
//
// Setting to 0.0 means no boost applied. The boosting condition is
// ignored.
float boost = 2 [(google.api.field_behavior) = OPTIONAL];

// Optional. Complex specification for custom ranking based on
// customer defined attribute value.
BoostControlSpec boost_control_spec = 4
[(google.api.field_behavior) = OPTIONAL];
}

// Optional. Condition boost specifications. If a document matches
// multiple conditions in the specifictions, boost scores from these
// specifications are all applied and combined in a non-linear way.
// Maximum number of specifications is 20.
repeated ConditionBoostSpec condition_boost_specs = 1
[(google.api.field_behavior) = OPTIONAL];
}

// Optional. Data Stores where the boosting configuration is applied. The
// full names of the referenced data stores. Formats:
// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`
// `projects/{project}/locations/{location}/dataStores/{data_store}`
repeated string data_stores = 1 [
(google.api.field_behavior) = OPTIONAL,
(google.api.resource_reference) = {
type: "discoveryengine.googleapis.com/DataStore"
}
];

// Optional. A list of boosting specifications.
repeated BoostSpec spec = 2 [(google.api.field_behavior) = OPTIONAL];
}

// Filter specification for data store queries.
message FilterSpecs {
// Optional. The data store where the filter configuration is applied.
// Full resource name of data store, such as
// projects/{project}/locations/{location}/collections/{collectionId}/
// dataStores/{dataStoreId}.
repeated string data_stores = 1 [(google.api.field_behavior) = OPTIONAL];

// Optional. The filter expression to be applied.
// Expression syntax is documented at
// https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata#filter-expression-syntax
string filter = 2 [(google.api.field_behavior) = OPTIONAL];
}

// Optional. Boost specifications for data stores.
repeated BoostSpecs boost_specs = 1
[(google.api.field_behavior) = OPTIONAL];

// Optional. Filter specification for data store queries.
repeated FilterSpecs filter_specs = 2
[(google.api.field_behavior) = OPTIONAL];
}

// Required. The parent resource contains the conversation profile
// Format: 'projects/<Project ID>' or `projects/<Project
// ID>/locations/<Location ID>`.
Expand Down Expand Up @@ -693,6 +875,35 @@ message SearchKnowledgeRequest {
type: "dialogflow.googleapis.com/Message"
}
];

// Optional. The source of the query in the request.
QuerySource query_source = 7 [(google.api.field_behavior) = OPTIONAL];

// Optional. Information about the end-user to improve the relevance and
// accuracy of generative answers.
//
// This will be interpreted and used by a language model, so, for good
// results, the data should be self-descriptive, and in a simple structure.
//
// Example:
//
// ```json
// {
// "subscription plan": "Business Premium Plus",
// "devices owned": [
// {"model": "Google Pixel 7"},
// {"model": "Google Pixel Tablet"}
// ]
// }
// ```
google.protobuf.Struct end_user_metadata = 9
[(google.api.field_behavior) = OPTIONAL];

// Optional. Configuration specific to search queries with data stores.
SearchConfig search_config = 11 [(google.api.field_behavior) = OPTIONAL];

// Optional. Whether to search the query exactly without query rewrite.
bool exact_search = 14 [(google.api.field_behavior) = OPTIONAL];
}

// The response message for
Expand Down Expand Up @@ -733,6 +944,9 @@ message SearchKnowledgeAnswer {

// The relevant snippet of the article.
string snippet = 3;

// Metadata associated with the article.
google.protobuf.Struct metadata = 5;
}

// The piece of text from the knowledge base documents that answers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "google/rpc/status.proto";

option cc_enable_arenas = true;
option csharp_namespace = "Google.Cloud.Dialogflow.V2";
option go_package = "cloud.google.com/go/dialogflow/apiv2/dialogflowpb;dialogflowpb";
option java_multiple_files = true;
Expand Down
Loading

0 comments on commit 25a2241

Please sign in to comment.