Skip to content

Commit

Permalink
feat: [discoveryengine] add additional resource path with collections (
Browse files Browse the repository at this point in the history
…#4120)

* feat: add additional resource path with collections
feat: document schema id is no longer required
docs: keep the API doc up-to-date with recent changes

PiperOrigin-RevId: 518297793

Source-Link: googleapis/googleapis@95410d7

Source-Link: googleapis/googleapis-gen@b5100c8
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRpc2NvdmVyeWVuZ2luZS8uT3dsQm90LnlhbWwiLCJoIjoiYjUxMDBjOGM4NTlhZTM3MmU1NzM0ZTQ5Yzk1N2U5NzM3ZDAwZjAxNyJ9

* 🦉 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 Mar 22, 2023
1 parent 2965fea commit 0fe6ff4
Show file tree
Hide file tree
Showing 23 changed files with 2,329 additions and 427 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ option ruby_package = "Google::Cloud::DiscoveryEngine::V1beta";
option (google.api.resource_definition) = {
type: "discoveryengine.googleapis.com/Branch"
pattern: "projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}"
pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}"
};
option (google.api.resource_definition) = {
type: "discoveryengine.googleapis.com/DataStore"
pattern: "projects/{project}/locations/{location}/dataStores/{data_store}"
pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}"
};
option (google.api.resource_definition) = {
type: "discoveryengine.googleapis.com/ServingConfig"
pattern: "projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config}"
pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/servingConfigs/{serving_config}"
};

// A custom attribute that is not explicitly modeled in a resource, e.g.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ message Document {
option (google.api.resource) = {
type: "discoveryengine.googleapis.com/Document"
pattern: "projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}"
pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}"
};

// Data representation. One of
Expand All @@ -53,7 +54,7 @@ message Document {

// Immutable. The full resource name of the document.
// Format:
// `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document_id}`.
// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document_id}`.
//
// This field must be a UTF-8 encoded string with a length limit of 1024
// characters.
Expand All @@ -65,8 +66,8 @@ message Document {
// standard with a length limit of 63 characters.
string id = 2 [(google.api.field_behavior) = IMMUTABLE];

// Required. The identifier of the schema located in the same data store.
string schema_id = 3 [(google.api.field_behavior) = REQUIRED];
// The identifier of the schema located in the same data store.
string schema_id = 3;

// The identifier of the parent document. Currently supports at most two level
// document hierarchy.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ service DocumentService {
rpc GetDocument(GetDocumentRequest) returns (Document) {
option (google.api.http) = {
get: "/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/documents/*}"
additional_bindings {
get: "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/documents/*}"
}
};
option (google.api.method_signature) = "name";
}
Expand All @@ -54,6 +57,9 @@ service DocumentService {
rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) {
option (google.api.http) = {
get: "/v1beta/{parent=projects/*/locations/*/dataStores/*/branches/*}/documents"
additional_bindings {
get: "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*/branches/*}/documents"
}
};
option (google.api.method_signature) = "parent";
}
Expand All @@ -63,6 +69,10 @@ service DocumentService {
option (google.api.http) = {
post: "/v1beta/{parent=projects/*/locations/*/dataStores/*/branches/*}/documents"
body: "document"
additional_bindings {
post: "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*/branches/*}/documents"
body: "document"
}
};
option (google.api.method_signature) = "parent,document,document_id";
}
Expand All @@ -72,13 +82,20 @@ service DocumentService {
option (google.api.http) = {
patch: "/v1beta/{document.name=projects/*/locations/*/dataStores/*/branches/*/documents/*}"
body: "document"
additional_bindings {
patch: "/v1beta/{document.name=projects/*/locations/*/collections/*/dataStores/*/branches/*/documents/*}"
body: "document"
}
};
}

// Deletes a [Document][google.cloud.discoveryengine.v1beta.Document].
rpc DeleteDocument(DeleteDocumentRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/documents/*}"
additional_bindings {
delete: "/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/documents/*}"
}
};
option (google.api.method_signature) = "name";
}
Expand All @@ -95,6 +112,10 @@ service DocumentService {
option (google.api.http) = {
post: "/v1beta/{parent=projects/*/locations/*/dataStores/*/branches/*}/documents:import"
body: "*"
additional_bindings {
post: "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*/branches/*}/documents:import"
body: "*"
}
};
option (google.longrunning.operation_info) = {
response_type: "google.cloud.discoveryengine.v1beta.ImportDocumentsResponse"
Expand All @@ -109,7 +130,7 @@ service DocumentService {
message GetDocumentRequest {
// Required. Full resource name of
// [Document][google.cloud.discoveryengine.v1beta.Document], such as
// `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
//
// If the caller does not have permission to access the
// [Document][google.cloud.discoveryengine.v1beta.Document], regardless of
Expand All @@ -130,7 +151,7 @@ message GetDocumentRequest {
// method.
message ListDocumentsRequest {
// Required. The parent branch resource name, such as
// `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}`.
// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
// Use `default_branch` as the branch ID, to list documents under the default
// branch.
//
Expand Down Expand Up @@ -183,7 +204,7 @@ message ListDocumentsResponse {
// method.
message CreateDocumentRequest {
// Required. The parent resource name, such as
// `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}`.
// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
Expand Down Expand Up @@ -244,7 +265,7 @@ message UpdateDocumentRequest {
message DeleteDocumentRequest {
// Required. Full resource name of
// [Document][google.cloud.discoveryengine.v1beta.Document], such as
// `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
//
// If the caller does not have permission to delete the
// [Document][google.cloud.discoveryengine.v1beta.Document], regardless of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ option objc_class_prefix = "DISCOVERYENGINE";
option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1beta";
option ruby_package = "Google::Cloud::DiscoveryEngine::V1beta";

// Google Cloud Storage location for input content.
// format.
// Cloud Storage location for input content.
message GcsSource {
// Required. Google Cloud Storage URIs to input files. URI can be up to
// Required. Cloud Storage URIs to input files. URI can be up to
// 2000 characters long. URIs can match the full object path (for example,
// `gs://bucket/directory/object.json`) or a pattern matching one or more
// files, such as `gs://bucket/directory/*.json`. A request can
Expand All @@ -45,16 +44,18 @@ message GcsSource {

// The schema to use when parsing the data from the source.
//
// Supported values for imports:
//
// * `user_event` (default): One JSON
// [UserEvent][google.cloud.discoveryengine.v1beta.UserEvent] per line.
// Supported values for document imports:
//
// * `document` (default): One JSON
// [Document][google.cloud.discoveryengine.v1beta.Document] per line. Each
// document must
// have a valid
// [Document.id][google.cloud.discoveryengine.v1beta.Document.id].
//
// Supported values for user even imports:
//
// * `user_event` (default): One JSON
// [UserEvent][google.cloud.discoveryengine.v1beta.UserEvent] per line.
string data_schema = 2;
}

Expand Down Expand Up @@ -102,7 +103,7 @@ message BigQuerySource {
message ImportErrorConfig {
// Required. Errors destination.
oneof destination {
// Google Cloud Storage prefix for import errors. This must be an empty,
// Cloud Storage prefix for import errors. This must be an empty,
// existing Cloud Storage directory. Import errors will be written to
// sharded files in this directory, one per line, as a JSON-encoded
// `google.rpc.Status` message.
Expand All @@ -123,15 +124,15 @@ message ImportUserEventsRequest {
// Required. The Inline source for the input content for UserEvents.
InlineSource inline_source = 2 [(google.api.field_behavior) = REQUIRED];

// Required. Google Cloud Storage location for the input content.
// Required. Cloud Storage location for the input content.
GcsSource gcs_source = 3 [(google.api.field_behavior) = REQUIRED];

// Required. BigQuery input source.
BigQuerySource bigquery_source = 4 [(google.api.field_behavior) = REQUIRED];
}

// Required. Parent DataStore resource name, of the form
// `projects/{project}/locations/{location}/dataStores/{data_store}`
// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
Expand Down Expand Up @@ -226,15 +227,15 @@ message ImportDocumentsRequest {
// The Inline source for the input content for documents.
InlineSource inline_source = 2;

// Google Cloud Storage location for the input content.
// Cloud Storage location for the input content.
GcsSource gcs_source = 3;

// BigQuery input source.
BigQuerySource bigquery_source = 4;
}

// Required. The parent branch resource name, such as
// `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}`.
// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
// Requires create/update permission.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,18 @@ service RecommendationService {
option (google.api.http) = {
post: "/v1beta/{serving_config=projects/*/locations/*/dataStores/*/servingConfigs/*}:recommend"
body: "*"
additional_bindings {
post: "/v1beta/{serving_config=projects/*/locations/*/collections/*/dataStores/*/servingConfigs/*}:recommend"
body: "*"
}
};
}
}

// Request message for Recommend method.
message RecommendRequest {
// Required. Full resource name of the format:
// projects/*/locations/global/dataStores/*/servingConfigs/*
// projects/*/locations/global/collections/*/dataStores/*/servingConfigs/*
//
// Before you can request recommendations from your model, you must create at
// least one serving config for it.
Expand Down Expand Up @@ -152,8 +156,8 @@ message RecommendRequest {
// key with multiple resources.
// * Keys must start with a lowercase letter or international character.
//
// See [Google Cloud
// Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
// See [Requirements for
// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
// for more details.
map<string, string> user_labels = 8;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,26 @@ option objc_class_prefix = "DISCOVERYENGINE";
option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1beta";
option ruby_package = "Google::Cloud::DiscoveryEngine::V1beta";

// UserEvent captures all metadata information DiscoveryEngine API needs to know
// about how end users interact with customers' website.
// UserEvent captures all metadata information Discovery Engine API needs to
// know about how end users interact with customers' website.
message UserEvent {
// Required. User event type. Allowed values are:
//
// Generic values:
//
// * `search`: Search for Documents.
// * `view-item`: Detailed page view of a Document.
// * `view-item-list`: View of a panel or ordered list of Documents.
// * `view-home-page`: View of the home page.
// * `view-category-page`: View of a category page, e.g. Home > Men > Jeans
//
// Retail-related values:
//
// * `add-to-cart`: Add an item(s) to cart, e.g. in Retail online shopping
// * `purchase`: Purchase an item(s)
//
// Media-related values:
//
// * `media-play`: Start/resume watching a video, playing a song, etc.
// * `media-complete`: Finished or stopped midway through a video, song, etc.
string event_type = 1 [(google.api.field_behavior) = REQUIRED];
Expand Down Expand Up @@ -96,7 +99,8 @@ message UserEvent {
// 128 bytes. A session is an aggregation of an end user behavior in a time
// span.
//
// A general guideline to populate the sesion_id:
// A general guideline to populate the session_id:
//
// 1. If user has no activity for 30 min, a new session_id should be assigned.
// 2. The session_id should be unique across users, suggest use uuid or add
// [UserEvent.user_pseudo_id][google.cloud.discoveryengine.v1beta.UserEvent.user_pseudo_id]
Expand Down Expand Up @@ -199,7 +203,7 @@ message UserEvent {
// If you provide custom attributes for ingested user events, also include
// them in the user events that you associate with prediction requests. Custom
// attribute formatting must be consistent between imported events and events
// provided with prediction requests. This lets the DiscoveryEngine API use
// provided with prediction requests. This lets the Discovery Engine API use
// those custom attributes when training models and serving predictions, which
// helps improve recommendation quality.
//
Expand Down Expand Up @@ -377,19 +381,20 @@ message DocumentInfo {
// A required descriptor of the associated Document.
//
// * If [id][google.cloud.discoveryengine.v1beta.DocumentInfo.id] is
// specified, then the default values for <location>, <data_store_id>, and
// <branch_id> are used when annotating with the stored Document.
// specified, then the default values for {location}, {collection_id},
// {data_store_id}, and {branch_id} are used when annotating with the stored
// Document.
//
// * If [name][google.cloud.discoveryengine.v1beta.DocumentInfo.name] is
// specified, then the provided values (default values allowed) for
// <location>, <data_store_id>, and <branch_id> are used when annotating with
// the stored Document.
// {location}, {collection_id}, {data_store_id}, and {branch_id} are used when
// annotating with the stored Document.
oneof document_descriptor {
// Required. The Document resource ID.
string id = 1 [(google.api.field_behavior) = REQUIRED];

// Required. The Document resource full name, of the form:
// projects/<project_id>/locations/<location>/dataStores/<data_store_id>/branches/<branch_id>/documents/<document_id>
// projects/{project\_id}/locations/{location}/collections/{collection\_id}/dataStores/{data\_store\_id}/branches/{branch\_id}/documents/{document\_id}
string name = 2 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
Expand All @@ -404,6 +409,7 @@ message DocumentInfo {
// are involved in a `add-to-cart` event.
//
// Required for events of the following event types:
//
// * `add-to-cart`
// * `purchase`
optional int32 quantity = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ service UserEventService {
option (google.api.http) = {
post: "/v1beta/{parent=projects/*/locations/*/dataStores/*}/userEvents:write"
body: "user_event"
additional_bindings {
post: "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:write"
body: "user_event"
}
};
}

Expand All @@ -56,6 +60,9 @@ service UserEventService {
rpc CollectUserEvent(CollectUserEventRequest) returns (google.api.HttpBody) {
option (google.api.http) = {
get: "/v1beta/{parent=projects/*/locations/*/dataStores/*}/userEvents:collect"
additional_bindings {
get: "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:collect"
}
};
}

Expand All @@ -71,6 +78,10 @@ service UserEventService {
option (google.api.http) = {
post: "/v1beta/{parent=projects/*/locations/*/dataStores/*}/userEvents:import"
body: "*"
additional_bindings {
post: "/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:import"
body: "*"
}
};
option (google.longrunning.operation_info) = {
response_type: "google.cloud.discoveryengine.v1beta.ImportUserEventsResponse"
Expand All @@ -82,7 +93,7 @@ service UserEventService {
// Request message for WriteUserEvent method.
message WriteUserEventRequest {
// Required. The parent DataStore resource name, such as
// `projects/{project}/locations/{location}/dataStores/{data_store}`.
// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
Expand All @@ -97,7 +108,7 @@ message WriteUserEventRequest {
// Request message for CollectUserEvent method.
message CollectUserEventRequest {
// Required. The parent DataStore resource name, such as
// `projects/{project}/locations/{location}/dataStores/{data_store}`.
// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
Expand Down
Loading

0 comments on commit 0fe6ff4

Please sign in to comment.