xref: /aosp_15_r20/external/googleapis/google/cloud/discoveryengine/v1alpha/chunk.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2022 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.discoveryengine.v1alpha;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/protobuf/struct.proto";
22
23option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Alpha";
24option go_package = "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb;discoveryenginepb";
25option java_multiple_files = true;
26option java_outer_classname = "ChunkProto";
27option java_package = "com.google.cloud.discoveryengine.v1alpha";
28option objc_class_prefix = "DISCOVERYENGINE";
29option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1alpha";
30option ruby_package = "Google::Cloud::DiscoveryEngine::V1alpha";
31
32// Chunk captures all raw metadata information of items to be recommended or
33// searched in the chunk mode.
34message Chunk {
35  option (google.api.resource) = {
36    type: "discoveryengine.googleapis.com/Chunk"
37    pattern: "projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}/chunks/{chunk}"
38    pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}/chunks/{chunk}"
39  };
40
41  // Document metadata contains the information of the document of the current
42  // chunk.
43  message DocumentMetadata {
44    // Uri of the document.
45    string uri = 1;
46
47    // Title of the document.
48    string title = 2;
49
50    // Data representation.
51    // The structured JSON data for the document. It should conform to the
52    // registered [Schema][google.cloud.discoveryengine.v1alpha.Schema] or an
53    // `INVALID_ARGUMENT` error is thrown.
54    google.protobuf.Struct struct_data = 3;
55  }
56
57  // Page span of the chunk.
58  message PageSpan {
59    // The start page of the chunk.
60    int32 page_start = 1;
61
62    // The end page of the chunk.
63    int32 page_end = 2;
64  }
65
66  // Metadata of the current chunk. This field is only populated on
67  // [SearchService.Search][google.cloud.discoveryengine.v1alpha.SearchService.Search]
68  // API.
69  message ChunkMetadata {
70    // The previous chunks of the current chunk. The number is controlled by
71    // [SearchRequest.ContentSearchSpec.ChunkSpec.num_previous_chunks][google.cloud.discoveryengine.v1alpha.SearchRequest.ContentSearchSpec.ChunkSpec.num_previous_chunks].
72    // This field is only populated on
73    // [SearchService.Search][google.cloud.discoveryengine.v1alpha.SearchService.Search]
74    // API.
75    repeated Chunk previous_chunks = 1;
76
77    // The next chunks of the current chunk. The number is controlled by
78    // [SearchRequest.ContentSearchSpec.ChunkSpec.num_next_chunks][google.cloud.discoveryengine.v1alpha.SearchRequest.ContentSearchSpec.ChunkSpec.num_next_chunks].
79    // This field is only populated on
80    // [SearchService.Search][google.cloud.discoveryengine.v1alpha.SearchService.Search]
81    // API.
82    repeated Chunk next_chunks = 2;
83  }
84
85  // The full resource name of the chunk.
86  // Format:
87  // `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document_id}/chunks/{chunk_id}`.
88  //
89  // This field must be a UTF-8 encoded string with a length limit of 1024
90  // characters.
91  string name = 1;
92
93  // Unique chunk ID of the current chunk.
94  string id = 2;
95
96  // Content is a string from a document (parsed content).
97  string content = 3;
98
99  // Metadata of the document from the current chunk.
100  DocumentMetadata document_metadata = 5;
101
102  // Output only. This field is OUTPUT_ONLY.
103  // It contains derived data that are not in the original input document.
104  google.protobuf.Struct derived_struct_data = 4
105      [(google.api.field_behavior) = OUTPUT_ONLY];
106
107  // Page span of the chunk.
108  PageSpan page_span = 6;
109
110  // Output only. Metadata of the current chunk.
111  ChunkMetadata chunk_metadata = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
112}
113