aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGoogle APIs <noreply@google.com>2024-05-03 15:39:21 -0700
committerCopybara-Service <copybara-worker@google.com>2024-05-03 15:40:19 -0700
commit79c1b132c6c8220ad2a071bd2338236f15c807b6 (patch)
tree1f66e50c8c81184ac260cdcbafbafc85c01e5e59
parent5010f1737cdc2cadd5b66ee0d2c13ad54bbdee35 (diff)
downloadgoogleapis-79c1b132c6c8220ad2a071bd2338236f15c807b6.tar.gz
feat: Add FileState to File
feat: Add response_schema to GenerationConfig feat: Add UsageMetadata to GenerateContentResponse feat: Add GenerateContentRequest to CountTokensRequest docs: Various small fixes PiperOrigin-RevId: 630516587
-rw-r--r--google/ai/generativelanguage/v1beta/citation.proto2
-rw-r--r--google/ai/generativelanguage/v1beta/content.proto10
-rw-r--r--google/ai/generativelanguage/v1beta/discuss_service.proto2
-rw-r--r--google/ai/generativelanguage/v1beta/file.proto20
-rw-r--r--google/ai/generativelanguage/v1beta/file_service.proto2
-rw-r--r--google/ai/generativelanguage/v1beta/generative_service.proto44
-rw-r--r--google/ai/generativelanguage/v1beta/generativelanguage_v1beta.yaml2
-rw-r--r--google/ai/generativelanguage/v1beta/model.proto2
-rw-r--r--google/ai/generativelanguage/v1beta/model_service.proto2
-rw-r--r--google/ai/generativelanguage/v1beta/permission.proto2
-rw-r--r--google/ai/generativelanguage/v1beta/permission_service.proto2
-rw-r--r--google/ai/generativelanguage/v1beta/retriever.proto2
-rw-r--r--google/ai/generativelanguage/v1beta/retriever_service.proto2
-rw-r--r--google/ai/generativelanguage/v1beta/safety.proto2
-rw-r--r--google/ai/generativelanguage/v1beta/text_service.proto2
-rw-r--r--google/ai/generativelanguage/v1beta/tuned_model.proto2
16 files changed, 79 insertions, 21 deletions
diff --git a/google/ai/generativelanguage/v1beta/citation.proto b/google/ai/generativelanguage/v1beta/citation.proto
index d524213fe..a15c85450 100644
--- a/google/ai/generativelanguage/v1beta/citation.proto
+++ b/google/ai/generativelanguage/v1beta/citation.proto
@@ -1,4 +1,4 @@
-// Copyright 2023 Google LLC
+// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/google/ai/generativelanguage/v1beta/content.proto b/google/ai/generativelanguage/v1beta/content.proto
index ef6526784..861b93591 100644
--- a/google/ai/generativelanguage/v1beta/content.proto
+++ b/google/ai/generativelanguage/v1beta/content.proto
@@ -1,4 +1,4 @@
-// Copyright 2023 Google LLC
+// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -102,8 +102,12 @@ message Part {
// Text should not be sent as raw bytes, use the 'text' field.
message Blob {
// The IANA standard MIME type of the source data.
- // Accepted types include: "image/png", "image/jpeg", "image/heic",
- // "image/heif", "image/webp".
+ // Examples:
+ // - image/png
+ // - image/jpeg
+ // If an unsupported MIME type is provided, an error will be returned. For a
+ // complete list of supported types, see [Supported file
+ // formats](https://ai.google.dev/gemini-api/docs/prompting_with_media#supported_file_formats).
string mime_type = 1;
// Raw bytes for media formats.
diff --git a/google/ai/generativelanguage/v1beta/discuss_service.proto b/google/ai/generativelanguage/v1beta/discuss_service.proto
index 19ee3ddb3..ebcd1b4eb 100644
--- a/google/ai/generativelanguage/v1beta/discuss_service.proto
+++ b/google/ai/generativelanguage/v1beta/discuss_service.proto
@@ -1,4 +1,4 @@
-// Copyright 2023 Google LLC
+// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/google/ai/generativelanguage/v1beta/file.proto b/google/ai/generativelanguage/v1beta/file.proto
index 4633569ff..d8cfc69d2 100644
--- a/google/ai/generativelanguage/v1beta/file.proto
+++ b/google/ai/generativelanguage/v1beta/file.proto
@@ -1,4 +1,4 @@
-// Copyright 2023 Google LLC
+// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -34,6 +34,21 @@ message File {
singular: "file"
};
+ // States for the lifecycle of a File.
+ enum State {
+ // The default value. This value is used if the state is omitted.
+ STATE_UNSPECIFIED = 0;
+
+ // File is being processed and cannot be used for inference yet.
+ PROCESSING = 1;
+
+ // File is processed and available for inference.
+ ACTIVE = 2;
+
+ // File failed processing.
+ FAILED = 10;
+ }
+
// Immutable. Identifier. The `File` resource name. The ID (name excluding the
// "files/" prefix) can contain up to 40 characters that are lowercase
// alphanumeric or dashes (-). The ID cannot start or end with a dash. If the
@@ -73,4 +88,7 @@ message File {
// Output only. The uri of the `File`.
string uri = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ // Output only. Processing state of the File.
+ State state = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
}
diff --git a/google/ai/generativelanguage/v1beta/file_service.proto b/google/ai/generativelanguage/v1beta/file_service.proto
index 8c0739357..11490e8ca 100644
--- a/google/ai/generativelanguage/v1beta/file_service.proto
+++ b/google/ai/generativelanguage/v1beta/file_service.proto
@@ -1,4 +1,4 @@
-// Copyright 2023 Google LLC
+// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/google/ai/generativelanguage/v1beta/generative_service.proto b/google/ai/generativelanguage/v1beta/generative_service.proto
index 683fd8732..61fa507f3 100644
--- a/google/ai/generativelanguage/v1beta/generative_service.proto
+++ b/google/ai/generativelanguage/v1beta/generative_service.proto
@@ -1,4 +1,4 @@
-// Copyright 2023 Google LLC
+// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -37,6 +37,11 @@ service GenerativeService {
// Generates a response from the model given an input
// `GenerateContentRequest`.
+ //
+ // Input capabilities differ between models, including tuned models. See the
+ // [model guide](https://ai.google.dev/models/gemini) and
+ // [tuning guide](https://ai.google.dev/docs/model_tuning_guidance) for
+ // details.
rpc GenerateContent(GenerateContentRequest)
returns (GenerateContentResponse) {
option (google.api.http) = {
@@ -245,6 +250,16 @@ message GenerationConfig {
// `text/plain`: (default) Text output.
// `application/json`: JSON response in the candidates.
string response_mime_type = 13 [(google.api.field_behavior) = OPTIONAL];
+
+ // Optional. Output response schema of the generated candidate text when
+ // response mime type can have schema. Schema can be objects, primitives or
+ // arrays and is a subset of [OpenAPI
+ // schema](https://spec.openapis.org/oas/v3.0.3#schema).
+ //
+ // If set, a compatible response_mime_type must also be set.
+ // Compatible mimetypes:
+ // `application/json`: Schema for JSON response.
+ Schema response_schema = 14 [(google.api.field_behavior) = OPTIONAL];
}
// Configuration for retrieving grounding content from a `Corpus` or
@@ -307,11 +322,26 @@ message GenerateContentResponse {
repeated SafetyRating safety_ratings = 2;
}
+ // Metadata on the generation request's token usage.
+ message UsageMetadata {
+ // Number of tokens in the prompt.
+ int32 prompt_token_count = 1;
+
+ // Total number of tokens across the generated candidates.
+ int32 candidates_token_count = 2;
+
+ // Total token count for the generation request (prompt + candidates).
+ int32 total_token_count = 3;
+ }
+
// Candidate responses from the model.
repeated Candidate candidates = 1;
// Returns the prompt's feedback related to the content filters.
PromptFeedback prompt_feedback = 2;
+
+ // Output only. Metadata on the generation requests' token usage.
+ UsageMetadata usage_metadata = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
}
// A response candidate generated from the model.
@@ -593,7 +623,8 @@ message EmbedContentRequest {
// Optional. Optional reduced dimension for the output embedding. If set,
// excessive values in the output embedding are truncated from the end.
- // Supported by `models/text-embedding-latest`.
+ // Supported by newer models since 2024, and the earlier model
+ // (`models/embedding-001`) cannot specify this value.
optional int32 output_dimensionality = 5
[(google.api.field_behavior) = OPTIONAL];
}
@@ -657,8 +688,13 @@ message CountTokensRequest {
}
];
- // Required. The input given to the model as a prompt.
- repeated Content contents = 2 [(google.api.field_behavior) = REQUIRED];
+ // Optional. The input given to the model as a prompt.
+ repeated Content contents = 2 [(google.api.field_behavior) = OPTIONAL];
+
+ // Optional. The overall input given to the model. CountTokens will count
+ // prompt, function calling, etc.
+ GenerateContentRequest generate_content_request = 3
+ [(google.api.field_behavior) = OPTIONAL];
}
// A response from `CountTokens`.
diff --git a/google/ai/generativelanguage/v1beta/generativelanguage_v1beta.yaml b/google/ai/generativelanguage/v1beta/generativelanguage_v1beta.yaml
index b659f2edd..833c46530 100644
--- a/google/ai/generativelanguage/v1beta/generativelanguage_v1beta.yaml
+++ b/google/ai/generativelanguage/v1beta/generativelanguage_v1beta.yaml
@@ -18,7 +18,7 @@ documentation:
The Gemini API allows developers to build generative AI applications using
Gemini models. Gemini is our most capable model, built from the ground up
to be multimodal. It can generalize and seamlessly understand, operate
- across, and combine different types of information. including language,
+ across, and combine different types of information including language,
images, audio, video, and code. You can use the Gemini API for use cases
like reasoning across text and images, content generation, dialogue
agents, summarization and classification systems, and more.
diff --git a/google/ai/generativelanguage/v1beta/model.proto b/google/ai/generativelanguage/v1beta/model.proto
index fed7e13fb..5320db5a2 100644
--- a/google/ai/generativelanguage/v1beta/model.proto
+++ b/google/ai/generativelanguage/v1beta/model.proto
@@ -1,4 +1,4 @@
-// Copyright 2023 Google LLC
+// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/google/ai/generativelanguage/v1beta/model_service.proto b/google/ai/generativelanguage/v1beta/model_service.proto
index 641c37007..0c22e8e9d 100644
--- a/google/ai/generativelanguage/v1beta/model_service.proto
+++ b/google/ai/generativelanguage/v1beta/model_service.proto
@@ -1,4 +1,4 @@
-// Copyright 2023 Google LLC
+// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/google/ai/generativelanguage/v1beta/permission.proto b/google/ai/generativelanguage/v1beta/permission.proto
index 809cdabfc..e9fd76504 100644
--- a/google/ai/generativelanguage/v1beta/permission.proto
+++ b/google/ai/generativelanguage/v1beta/permission.proto
@@ -1,4 +1,4 @@
-// Copyright 2023 Google LLC
+// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/google/ai/generativelanguage/v1beta/permission_service.proto b/google/ai/generativelanguage/v1beta/permission_service.proto
index d09114ae2..cf2625172 100644
--- a/google/ai/generativelanguage/v1beta/permission_service.proto
+++ b/google/ai/generativelanguage/v1beta/permission_service.proto
@@ -1,4 +1,4 @@
-// Copyright 2023 Google LLC
+// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/google/ai/generativelanguage/v1beta/retriever.proto b/google/ai/generativelanguage/v1beta/retriever.proto
index 897263dfa..c60672e6c 100644
--- a/google/ai/generativelanguage/v1beta/retriever.proto
+++ b/google/ai/generativelanguage/v1beta/retriever.proto
@@ -1,4 +1,4 @@
-// Copyright 2023 Google LLC
+// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/google/ai/generativelanguage/v1beta/retriever_service.proto b/google/ai/generativelanguage/v1beta/retriever_service.proto
index 3de5febed..8601861dc 100644
--- a/google/ai/generativelanguage/v1beta/retriever_service.proto
+++ b/google/ai/generativelanguage/v1beta/retriever_service.proto
@@ -1,4 +1,4 @@
-// Copyright 2023 Google LLC
+// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/google/ai/generativelanguage/v1beta/safety.proto b/google/ai/generativelanguage/v1beta/safety.proto
index 6372c105c..40d4dd702 100644
--- a/google/ai/generativelanguage/v1beta/safety.proto
+++ b/google/ai/generativelanguage/v1beta/safety.proto
@@ -1,4 +1,4 @@
-// Copyright 2023 Google LLC
+// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/google/ai/generativelanguage/v1beta/text_service.proto b/google/ai/generativelanguage/v1beta/text_service.proto
index b9a066888..779743bcb 100644
--- a/google/ai/generativelanguage/v1beta/text_service.proto
+++ b/google/ai/generativelanguage/v1beta/text_service.proto
@@ -1,4 +1,4 @@
-// Copyright 2023 Google LLC
+// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/google/ai/generativelanguage/v1beta/tuned_model.proto b/google/ai/generativelanguage/v1beta/tuned_model.proto
index 987b6e7fd..73a2e5713 100644
--- a/google/ai/generativelanguage/v1beta/tuned_model.proto
+++ b/google/ai/generativelanguage/v1beta/tuned_model.proto
@@ -1,4 +1,4 @@
-// Copyright 2023 Google LLC
+// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.