Skip to content

Commit f495b45

Browse files
Google APIscopybara-github
authored andcommitted
feat: add support for additional reasons to stop image generation
feat: add support for finish_message that contain details the reason why the model stopped generating tokens feat: add URL_RETRIEVAL_STATUS_UNSAFE and URL_RETRIEVAL_STATUS_PAYWALL statuses for url retrieval feat: add log_probability_sum docs: deprecation notice for HarmCategory.HARM_CATEGORY_CIVIC_INTEGRITY PiperOrigin-RevId: 819823490
1 parent fd84be8 commit f495b45

File tree

4 files changed

+44
-1
lines changed

4 files changed

+44
-1
lines changed

google/ai/generativelanguage/v1/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ proto_library(
4040
"//google/type:interval_proto",
4141
"//google/type:latlng_proto",
4242
"@com_google_protobuf//:duration_proto",
43+
"@com_google_protobuf//:struct_proto",
4344
],
4445
)
4546

google/ai/generativelanguage/v1/generative_service.proto

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import "google/api/annotations.proto";
2323
import "google/api/client.proto";
2424
import "google/api/field_behavior.proto";
2525
import "google/api/resource.proto";
26+
import "google/protobuf/struct.proto";
2627

2728
option go_package = "cloud.google.com/go/ai/generativelanguage/apiv1/generativelanguagepb;generativelanguagepb";
2829
option java_multiple_files = true;
@@ -144,6 +145,7 @@ enum TaskType {
144145
}
145146

146147
// Request to generate a completion from the model.
148+
// NEXT ID: 18
147149
message GenerateContentRequest {
148150
// Required. The name of the `Model` to use for generating the completion.
149151
//
@@ -190,6 +192,7 @@ message GenerateContentRequest {
190192

191193
// Configuration options for model generation and outputs. Not all parameters
192194
// are configurable for every model.
195+
// Next ID: 29
193196
message GenerationConfig {
194197
// Optional. Number of generated responses to return. If unset, this will
195198
// default to 1. Please note that this doesn't work for previous generation
@@ -248,6 +251,11 @@ message GenerationConfig {
248251
// generated seed.
249252
optional int32 seed = 8 [(google.api.field_behavior) = OPTIONAL];
250253

254+
// Optional. An internal detail. Use `responseJsonSchema` rather than this
255+
// field.
256+
google.protobuf.Value response_json_schema_ordered = 28
257+
[(google.api.field_behavior) = OPTIONAL];
258+
251259
// Optional. Presence penalty applied to the next token's logprobs if the
252260
// token has already been seen in the response.
253261
//
@@ -289,6 +297,7 @@ message GenerationConfig {
289297
// [response_logprobs=True][google.ai.generativelanguage.v1.GenerationConfig.response_logprobs].
290298
// This sets the number of top logprobs to return at each decoding step in the
291299
// [Candidate.logprobs_result][google.ai.generativelanguage.v1.Candidate.logprobs_result].
300+
// The number must be in the range of [0, 20].
292301
optional int32 logprobs = 18 [(google.api.field_behavior) = OPTIONAL];
293302

294303
// Optional. Enables enhanced civic answers. It may not be available for all
@@ -442,8 +451,22 @@ message Candidate {
442451
// violations.
443452
IMAGE_SAFETY = 11;
444453

454+
// Image generation stopped because generated images has other prohibited
455+
// content.
456+
IMAGE_PROHIBITED_CONTENT = 14;
457+
458+
// Image generation stopped because of other miscellaneous issue.
459+
IMAGE_OTHER = 15;
460+
461+
// The model was expected to generate an image, but none was generated.
462+
NO_IMAGE = 16;
463+
445464
// Model generated a tool call but no tools were enabled in the request.
446465
UNEXPECTED_TOOL_CALL = 12;
466+
467+
// Model called too many tools consecutively, thus the system exited
468+
// execution.
469+
TOO_MANY_TOOL_CALLS = 13;
447470
}
448471

449472
// Output only. Index of the candidate in the list of response candidates.
@@ -460,6 +483,13 @@ message Candidate {
460483
(google.api.field_behavior) = OUTPUT_ONLY
461484
];
462485

486+
// Optional. Output only. Details the reason why the model stopped generating
487+
// tokens. This is populated only when `finish_reason` is set.
488+
optional string finish_message = 4 [
489+
(google.api.field_behavior) = OPTIONAL,
490+
(google.api.field_behavior) = OUTPUT_ONLY
491+
];
492+
463493
// List of ratings for the safety of a response candidate.
464494
//
465495
// There is at most one rating per category.
@@ -512,6 +542,12 @@ message UrlMetadata {
512542

513543
// Url retrieval is failed due to error.
514544
URL_RETRIEVAL_STATUS_ERROR = 2;
545+
546+
// Url retrieval is failed because the content is behind paywall.
547+
URL_RETRIEVAL_STATUS_PAYWALL = 3;
548+
549+
// Url retrieval is failed because the content is unsafe.
550+
URL_RETRIEVAL_STATUS_UNSAFE = 4;
515551
}
516552

517553
// Retrieved url by the tool.
@@ -541,6 +577,9 @@ message LogprobsResult {
541577
repeated Candidate candidates = 1;
542578
}
543579

580+
// Sum of log probabilities for all tokens.
581+
optional float log_probability_sum = 3;
582+
544583
// Length = total number of decoding steps.
545584
repeated TopCandidates top_candidates = 1;
546585

google/ai/generativelanguage/v1/generativelanguage_v1.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ http:
3636
- get: '/v1/{name=batches/*}'
3737
- get: '/v1/{name=models/*/operations/*}'
3838
- get: '/v1/{name=corpora/*/operations/*}'
39+
- get: '/v1/{name=ragStores/*/operations/*}'
40+
- get: '/v1/{name=ragStores/*/upload/operations/*}'
3941
- selector: google.longrunning.Operations.ListOperations
4042
get: '/v1/{name=operations}'
4143
additional_bindings:

google/ai/generativelanguage/v1/safety.proto

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ enum HarmCategory {
6565
HARM_CATEGORY_DANGEROUS_CONTENT = 10;
6666

6767
// **Gemini** - Content that may be used to harm civic integrity.
68-
HARM_CATEGORY_CIVIC_INTEGRITY = 11;
68+
// DEPRECATED: use enable_enhanced_civic_answers instead.
69+
HARM_CATEGORY_CIVIC_INTEGRITY = 11 [deprecated = true];
6970
}
7071

7172
// Safety rating for a piece of content.

0 commit comments

Comments
 (0)