1// Copyright 2023 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.ai.generativelanguage.v1; 18 19import "google/ai/generativelanguage/v1/model.proto"; 20import "google/api/annotations.proto"; 21import "google/api/client.proto"; 22import "google/api/field_behavior.proto"; 23import "google/api/resource.proto"; 24 25option go_package = "cloud.google.com/go/ai/generativelanguage/apiv1/generativelanguagepb;generativelanguagepb"; 26option java_multiple_files = true; 27option java_outer_classname = "ModelServiceProto"; 28option java_package = "com.google.ai.generativelanguage.v1"; 29 30// Provides methods for getting metadata information about Generative Models. 31service ModelService { 32 option (google.api.default_host) = "generativelanguage.googleapis.com"; 33 34 // Gets information about a specific Model. 35 rpc GetModel(GetModelRequest) returns (Model) { 36 option (google.api.http) = { 37 get: "/v1/{name=models/*}" 38 }; 39 option (google.api.method_signature) = "name"; 40 } 41 42 // Lists models available through the API. 43 rpc ListModels(ListModelsRequest) returns (ListModelsResponse) { 44 option (google.api.http) = { 45 get: "/v1/models" 46 }; 47 option (google.api.method_signature) = "page_size,page_token"; 48 } 49} 50 51// Request for getting information about a specific Model. 52message GetModelRequest { 53 // Required. The resource name of the model. 54 // 55 // This name should match a model name returned by the `ListModels` method. 56 // 57 // Format: `models/{model}` 58 string name = 1 [ 59 (google.api.field_behavior) = REQUIRED, 60 (google.api.resource_reference) = { 61 type: "generativelanguage.googleapis.com/Model" 62 } 63 ]; 64} 65 66// Request for listing all Models. 67message ListModelsRequest { 68 // The maximum number of `Models` to return (per page). 69 // 70 // The service may return fewer models. 71 // If unspecified, at most 50 models will be returned per page. 72 // This method returns at most 1000 models per page, even if you pass a larger 73 // page_size. 74 int32 page_size = 2; 75 76 // A page token, received from a previous `ListModels` call. 77 // 78 // Provide the `page_token` returned by one request as an argument to the next 79 // request to retrieve the next page. 80 // 81 // When paginating, all other parameters provided to `ListModels` must match 82 // the call that provided the page token. 83 string page_token = 3; 84} 85 86// Response from `ListModel` containing a paginated list of Models. 87message ListModelsResponse { 88 // The returned Models. 89 repeated Model models = 1; 90 91 // A token, which can be sent as `page_token` to retrieve the next page. 92 // 93 // If this field is omitted, there are no more pages. 94 string next_page_token = 2; 95} 96