Skip to content

Commit 7c5b1c9

Browse files
Google APIscopybara-github
authored andcommitted
feat: Add example, example_store, and example_store_service protos
PiperOrigin-RevId: 740829050
1 parent 4507000 commit 7c5b1c9

4 files changed

Lines changed: 677 additions & 0 deletions

File tree

google/cloud/aiplatform/v1beta1/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ proto_library(
6060
"evaluated_annotation.proto",
6161
"evaluation_service.proto",
6262
"event.proto",
63+
"example.proto",
64+
"example_store.proto",
65+
"example_store_service.proto",
6366
"execution.proto",
6467
"explanation.proto",
6568
"explanation_metadata.proto",
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// Copyright 2025 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+
15+
syntax = "proto3";
16+
17+
package google.cloud.aiplatform.v1beta1;
18+
19+
import "google/api/field_behavior.proto";
20+
import "google/cloud/aiplatform/v1beta1/content.proto";
21+
22+
option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1";
23+
option go_package = "cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb;aiplatformpb";
24+
option java_multiple_files = true;
25+
option java_outer_classname = "ExampleProto";
26+
option java_package = "com.google.cloud.aiplatform.v1beta1";
27+
option php_namespace = "Google\\Cloud\\AIPlatform\\V1beta1";
28+
option ruby_package = "Google::Cloud::AIPlatform::V1beta1";
29+
30+
// A single example of a conversation with the model.
31+
message ContentsExample {
32+
// A single step of the expected output.
33+
message ExpectedContent {
34+
// Required. A single step's content.
35+
Content content = 1 [(google.api.field_behavior) = REQUIRED];
36+
}
37+
38+
// Required. The content of the conversation with the model that resulted in
39+
// the expected output.
40+
repeated Content contents = 1 [(google.api.field_behavior) = REQUIRED];
41+
42+
// Required. The expected output for the given `contents`. To represent
43+
// multi-step reasoning, this is a repeated field that contains the iterative
44+
// steps of the expected output.
45+
repeated ExpectedContent expected_contents = 2
46+
[(google.api.field_behavior) = REQUIRED];
47+
}
48+
49+
// A ContentsExample to be used with GenerateContent alongside information
50+
// required for storage and retrieval with Example Store.
51+
message StoredContentsExample {
52+
// Options for generating the search key from the conversation history.
53+
message SearchKeyGenerationMethod {
54+
// Configuration for using only the last entry of the conversation history
55+
// as the search key.
56+
message LastEntry {}
57+
58+
// The method for generating the search key.
59+
oneof method {
60+
// Use only the last entry of the conversation history
61+
// (`contents_example.contents`) as the search key.
62+
LastEntry last_entry = 1;
63+
}
64+
}
65+
66+
// Optional. (Optional) the search key used for retrieval. If not provided at
67+
// upload-time, the search key will be generated from
68+
// `contents_example.contents` using the method provided by
69+
// `search_key_generation_method`. The generated search key will be included
70+
// in retrieved examples.
71+
string search_key = 1 [(google.api.field_behavior) = OPTIONAL];
72+
73+
// Required. The example to be used with GenerateContent.
74+
ContentsExample contents_example = 2 [(google.api.field_behavior) = REQUIRED];
75+
76+
// Optional. The method used to generate the search key from
77+
// `contents_example.contents`. This is ignored when uploading an example if
78+
// `search_key` is provided.
79+
SearchKeyGenerationMethod search_key_generation_method = 3
80+
[(google.api.field_behavior) = OPTIONAL];
81+
}
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
// Copyright 2025 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+
15+
syntax = "proto3";
16+
17+
package google.cloud.aiplatform.v1beta1;
18+
19+
import "google/api/field_behavior.proto";
20+
import "google/api/resource.proto";
21+
import "google/cloud/aiplatform/v1beta1/content.proto";
22+
import "google/cloud/aiplatform/v1beta1/example.proto";
23+
import "google/protobuf/timestamp.proto";
24+
25+
option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1";
26+
option go_package = "cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb;aiplatformpb";
27+
option java_multiple_files = true;
28+
option java_outer_classname = "ExampleStoreProto";
29+
option java_package = "com.google.cloud.aiplatform.v1beta1";
30+
option php_namespace = "Google\\Cloud\\AIPlatform\\V1beta1";
31+
option ruby_package = "Google::Cloud::AIPlatform::V1beta1";
32+
33+
// Represents an executable service to manage and retrieve examples.
34+
message ExampleStore {
35+
option (google.api.resource) = {
36+
type: "aiplatform.googleapis.com/ExampleStore"
37+
pattern: "projects/{project}/locations/{location}/exampleStores/{example_store}"
38+
plural: "exampleStores"
39+
singular: "exampleStore"
40+
};
41+
42+
// Identifier. The resource name of the ExampleStore. This is a unique
43+
// identifier. Format:
44+
// projects/{project}/locations/{location}/exampleStores/{example_store}
45+
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
46+
47+
// Required. Display name of the ExampleStore.
48+
string display_name = 2 [(google.api.field_behavior) = REQUIRED];
49+
50+
// Optional. Description of the ExampleStore.
51+
string description = 3 [(google.api.field_behavior) = OPTIONAL];
52+
53+
// Output only. Timestamp when this ExampleStore was created.
54+
google.protobuf.Timestamp create_time = 4
55+
[(google.api.field_behavior) = OUTPUT_ONLY];
56+
57+
// Output only. Timestamp when this ExampleStore was most recently updated.
58+
google.protobuf.Timestamp update_time = 5
59+
[(google.api.field_behavior) = OUTPUT_ONLY];
60+
61+
// Required. Example Store config.
62+
ExampleStoreConfig example_store_config = 6
63+
[(google.api.field_behavior) = REQUIRED];
64+
}
65+
66+
// Configuration for the Example Store.
67+
message ExampleStoreConfig {
68+
// Required. The embedding model to be used for vector embedding.
69+
// Immutable.
70+
// Supported models:
71+
// * "textembedding-gecko@003"
72+
// * "text-embedding-004"
73+
// * "text-embedding-005"
74+
// * "text-multilingual-embedding-002"
75+
string vertex_embedding_model = 1 [(google.api.field_behavior) = REQUIRED];
76+
}
77+
78+
// The metadata filters that will be used to remove or fetch
79+
// StoredContentsExamples. If a field is unspecified, then no filtering for that
80+
// field will be applied.
81+
message StoredContentsExampleFilter {
82+
// Optional. The search keys for filtering. Only examples with one of the
83+
// specified search keys
84+
// ([StoredContentsExample.search_key][google.cloud.aiplatform.v1beta1.StoredContentsExample.search_key])
85+
// are eligible to be returned.
86+
repeated string search_keys = 1 [(google.api.field_behavior) = OPTIONAL];
87+
88+
// Optional. The function names for filtering.
89+
ExamplesArrayFilter function_names = 2
90+
[(google.api.field_behavior) = OPTIONAL];
91+
}
92+
93+
// The metadata filters that will be used to search StoredContentsExamples.
94+
// If a field is unspecified, then no filtering for that field will be applied
95+
message StoredContentsExampleParameters {
96+
// The chat history to use to generate the search key for retrieval.
97+
message ContentSearchKey {
98+
// Required. The conversation for generating a search key.
99+
repeated Content contents = 1 [(google.api.field_behavior) = REQUIRED];
100+
101+
// Required. The method of generating a search key.
102+
StoredContentsExample.SearchKeyGenerationMethod
103+
search_key_generation_method = 2
104+
[(google.api.field_behavior) = REQUIRED];
105+
}
106+
107+
// The query to use to retrieve similar StoredContentsExamples.
108+
oneof query {
109+
// The exact search key to use for retrieval.
110+
string search_key = 1;
111+
112+
// The chat history to use to generate the search key for retrieval.
113+
ContentSearchKey content_search_key = 2;
114+
}
115+
116+
// Optional. The function names for filtering.
117+
ExamplesArrayFilter function_names = 3
118+
[(google.api.field_behavior) = OPTIONAL];
119+
}
120+
121+
// Filters for examples' array metadata fields. An array field is example
122+
// metadata where multiple values are attributed to a single example.
123+
message ExamplesArrayFilter {
124+
// The logic to use for filtering.
125+
enum ArrayOperator {
126+
// Not specified. This value should not be used.
127+
ARRAY_OPERATOR_UNSPECIFIED = 0;
128+
129+
// The metadata array field in the example must contain at least one of the
130+
// values.
131+
CONTAINS_ANY = 1;
132+
133+
// The metadata array field in the example must contain all of the values.
134+
CONTAINS_ALL = 2;
135+
}
136+
137+
// Required. The values by which to filter examples.
138+
repeated string values = 1 [(google.api.field_behavior) = REQUIRED];
139+
140+
// Required. The operator logic to use for filtering.
141+
ArrayOperator array_operator = 2 [(google.api.field_behavior) = REQUIRED];
142+
}

0 commit comments

Comments
 (0)