google-apis-firebaseml_v2beta 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +13 -0
- data/CHANGELOG.md +7 -0
- data/LICENSE.md +202 -0
- data/OVERVIEW.md +96 -0
- data/lib/google/apis/firebaseml_v2beta/classes.rb +1331 -0
- data/lib/google/apis/firebaseml_v2beta/gem_version.rb +28 -0
- data/lib/google/apis/firebaseml_v2beta/representations.rb +595 -0
- data/lib/google/apis/firebaseml_v2beta/service.rb +165 -0
- data/lib/google/apis/firebaseml_v2beta.rb +36 -0
- data/lib/google-apis-firebaseml_v2beta.rb +15 -0
- metadata +82 -0
@@ -0,0 +1,1331 @@
|
|
1
|
+
# Copyright 2020 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
|
+
require 'date'
|
16
|
+
require 'google/apis/core/base_service'
|
17
|
+
require 'google/apis/core/json_representation'
|
18
|
+
require 'google/apis/core/hashable'
|
19
|
+
require 'google/apis/errors'
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Apis
|
23
|
+
module FirebasemlV2beta
|
24
|
+
|
25
|
+
# Content blob. It's preferred to send as text directly rather than raw bytes.
|
26
|
+
class Blob
|
27
|
+
include Google::Apis::Core::Hashable
|
28
|
+
|
29
|
+
# Required. Raw bytes.
|
30
|
+
# Corresponds to the JSON property `data`
|
31
|
+
# NOTE: Values are automatically base64 encoded/decoded in the client library.
|
32
|
+
# @return [String]
|
33
|
+
attr_accessor :data
|
34
|
+
|
35
|
+
# Required. The IANA standard MIME type of the source data.
|
36
|
+
# Corresponds to the JSON property `mimeType`
|
37
|
+
# @return [String]
|
38
|
+
attr_accessor :mime_type
|
39
|
+
|
40
|
+
def initialize(**args)
|
41
|
+
update!(**args)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Update properties of this object
|
45
|
+
def update!(**args)
|
46
|
+
@data = args[:data] if args.key?(:data)
|
47
|
+
@mime_type = args[:mime_type] if args.key?(:mime_type)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# A response candidate generated from the model.
|
52
|
+
class Candidate
|
53
|
+
include Google::Apis::Core::Hashable
|
54
|
+
|
55
|
+
# A collection of source attributions for a piece of content.
|
56
|
+
# Corresponds to the JSON property `citationMetadata`
|
57
|
+
# @return [Google::Apis::FirebasemlV2beta::CitationMetadata]
|
58
|
+
attr_accessor :citation_metadata
|
59
|
+
|
60
|
+
# The base structured datatype containing multi-part content of a message. A `
|
61
|
+
# Content` includes a `role` field designating the producer of the `Content` and
|
62
|
+
# a `parts` field containing multi-part data that contains the content of the
|
63
|
+
# message turn.
|
64
|
+
# Corresponds to the JSON property `content`
|
65
|
+
# @return [Google::Apis::FirebasemlV2beta::Content]
|
66
|
+
attr_accessor :content
|
67
|
+
|
68
|
+
# Output only. Describes the reason the mode stopped generating tokens in more
|
69
|
+
# detail. This is only filled when `finish_reason` is set.
|
70
|
+
# Corresponds to the JSON property `finishMessage`
|
71
|
+
# @return [String]
|
72
|
+
attr_accessor :finish_message
|
73
|
+
|
74
|
+
# Output only. The reason why the model stopped generating tokens. If empty, the
|
75
|
+
# model has not stopped generating the tokens.
|
76
|
+
# Corresponds to the JSON property `finishReason`
|
77
|
+
# @return [String]
|
78
|
+
attr_accessor :finish_reason
|
79
|
+
|
80
|
+
# Metadata returned to client when grounding is enabled.
|
81
|
+
# Corresponds to the JSON property `groundingMetadata`
|
82
|
+
# @return [Google::Apis::FirebasemlV2beta::GroundingMetadata]
|
83
|
+
attr_accessor :grounding_metadata
|
84
|
+
|
85
|
+
# Output only. Index of the candidate.
|
86
|
+
# Corresponds to the JSON property `index`
|
87
|
+
# @return [Fixnum]
|
88
|
+
attr_accessor :index
|
89
|
+
|
90
|
+
# Output only. List of ratings for the safety of a response candidate. There is
|
91
|
+
# at most one rating per category.
|
92
|
+
# Corresponds to the JSON property `safetyRatings`
|
93
|
+
# @return [Array<Google::Apis::FirebasemlV2beta::SafetyRating>]
|
94
|
+
attr_accessor :safety_ratings
|
95
|
+
|
96
|
+
def initialize(**args)
|
97
|
+
update!(**args)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Update properties of this object
|
101
|
+
def update!(**args)
|
102
|
+
@citation_metadata = args[:citation_metadata] if args.key?(:citation_metadata)
|
103
|
+
@content = args[:content] if args.key?(:content)
|
104
|
+
@finish_message = args[:finish_message] if args.key?(:finish_message)
|
105
|
+
@finish_reason = args[:finish_reason] if args.key?(:finish_reason)
|
106
|
+
@grounding_metadata = args[:grounding_metadata] if args.key?(:grounding_metadata)
|
107
|
+
@index = args[:index] if args.key?(:index)
|
108
|
+
@safety_ratings = args[:safety_ratings] if args.key?(:safety_ratings)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# Source attributions for content.
|
113
|
+
class Citation
|
114
|
+
include Google::Apis::Core::Hashable
|
115
|
+
|
116
|
+
# Output only. End index into the content.
|
117
|
+
# Corresponds to the JSON property `endIndex`
|
118
|
+
# @return [Fixnum]
|
119
|
+
attr_accessor :end_index
|
120
|
+
|
121
|
+
# Output only. License of the attribution.
|
122
|
+
# Corresponds to the JSON property `license`
|
123
|
+
# @return [String]
|
124
|
+
attr_accessor :license
|
125
|
+
|
126
|
+
# Represents a whole or partial calendar date, such as a birthday. The time of
|
127
|
+
# day and time zone are either specified elsewhere or are insignificant. The
|
128
|
+
# date is relative to the Gregorian Calendar. This can represent one of the
|
129
|
+
# following: * A full date, with non-zero year, month, and day values. * A month
|
130
|
+
# and day, with a zero year (for example, an anniversary). * A year on its own,
|
131
|
+
# with a zero month and a zero day. * A year and month, with a zero day (for
|
132
|
+
# example, a credit card expiration date). Related types: * google.type.
|
133
|
+
# TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
|
134
|
+
# Corresponds to the JSON property `publicationDate`
|
135
|
+
# @return [Google::Apis::FirebasemlV2beta::Date]
|
136
|
+
attr_accessor :publication_date
|
137
|
+
|
138
|
+
# Output only. Start index into the content.
|
139
|
+
# Corresponds to the JSON property `startIndex`
|
140
|
+
# @return [Fixnum]
|
141
|
+
attr_accessor :start_index
|
142
|
+
|
143
|
+
# Output only. Title of the attribution.
|
144
|
+
# Corresponds to the JSON property `title`
|
145
|
+
# @return [String]
|
146
|
+
attr_accessor :title
|
147
|
+
|
148
|
+
# Output only. Url reference of the attribution.
|
149
|
+
# Corresponds to the JSON property `uri`
|
150
|
+
# @return [String]
|
151
|
+
attr_accessor :uri
|
152
|
+
|
153
|
+
def initialize(**args)
|
154
|
+
update!(**args)
|
155
|
+
end
|
156
|
+
|
157
|
+
# Update properties of this object
|
158
|
+
def update!(**args)
|
159
|
+
@end_index = args[:end_index] if args.key?(:end_index)
|
160
|
+
@license = args[:license] if args.key?(:license)
|
161
|
+
@publication_date = args[:publication_date] if args.key?(:publication_date)
|
162
|
+
@start_index = args[:start_index] if args.key?(:start_index)
|
163
|
+
@title = args[:title] if args.key?(:title)
|
164
|
+
@uri = args[:uri] if args.key?(:uri)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# A collection of source attributions for a piece of content.
|
169
|
+
class CitationMetadata
|
170
|
+
include Google::Apis::Core::Hashable
|
171
|
+
|
172
|
+
# Output only. List of citations.
|
173
|
+
# Corresponds to the JSON property `citations`
|
174
|
+
# @return [Array<Google::Apis::FirebasemlV2beta::Citation>]
|
175
|
+
attr_accessor :citations
|
176
|
+
|
177
|
+
def initialize(**args)
|
178
|
+
update!(**args)
|
179
|
+
end
|
180
|
+
|
181
|
+
# Update properties of this object
|
182
|
+
def update!(**args)
|
183
|
+
@citations = args[:citations] if args.key?(:citations)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
# The base structured datatype containing multi-part content of a message. A `
|
188
|
+
# Content` includes a `role` field designating the producer of the `Content` and
|
189
|
+
# a `parts` field containing multi-part data that contains the content of the
|
190
|
+
# message turn.
|
191
|
+
class Content
|
192
|
+
include Google::Apis::Core::Hashable
|
193
|
+
|
194
|
+
# Required. Ordered `Parts` that constitute a single message. Parts may have
|
195
|
+
# different IANA MIME types.
|
196
|
+
# Corresponds to the JSON property `parts`
|
197
|
+
# @return [Array<Google::Apis::FirebasemlV2beta::Part>]
|
198
|
+
attr_accessor :parts
|
199
|
+
|
200
|
+
# Optional. The producer of the content. Must be either 'user' or 'model'.
|
201
|
+
# Useful to set for multi-turn conversations, otherwise can be left blank or
|
202
|
+
# unset.
|
203
|
+
# Corresponds to the JSON property `role`
|
204
|
+
# @return [String]
|
205
|
+
attr_accessor :role
|
206
|
+
|
207
|
+
def initialize(**args)
|
208
|
+
update!(**args)
|
209
|
+
end
|
210
|
+
|
211
|
+
# Update properties of this object
|
212
|
+
def update!(**args)
|
213
|
+
@parts = args[:parts] if args.key?(:parts)
|
214
|
+
@role = args[:role] if args.key?(:role)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
# Request message for PredictionService.CountTokens.
|
219
|
+
class CountTokensRequest
|
220
|
+
include Google::Apis::Core::Hashable
|
221
|
+
|
222
|
+
# Required. Input content.
|
223
|
+
# Corresponds to the JSON property `contents`
|
224
|
+
# @return [Array<Google::Apis::FirebasemlV2beta::Content>]
|
225
|
+
attr_accessor :contents
|
226
|
+
|
227
|
+
# Required. The instances that are the input to token counting call. Schema is
|
228
|
+
# identical to the prediction schema of the underlying model.
|
229
|
+
# Corresponds to the JSON property `instances`
|
230
|
+
# @return [Array<Object>]
|
231
|
+
attr_accessor :instances
|
232
|
+
|
233
|
+
# Required. The name of the publisher model requested to serve the prediction.
|
234
|
+
# Format: `projects/`project`/locations/`location`/publishers/*/models/*`
|
235
|
+
# Corresponds to the JSON property `model`
|
236
|
+
# @return [String]
|
237
|
+
attr_accessor :model
|
238
|
+
|
239
|
+
def initialize(**args)
|
240
|
+
update!(**args)
|
241
|
+
end
|
242
|
+
|
243
|
+
# Update properties of this object
|
244
|
+
def update!(**args)
|
245
|
+
@contents = args[:contents] if args.key?(:contents)
|
246
|
+
@instances = args[:instances] if args.key?(:instances)
|
247
|
+
@model = args[:model] if args.key?(:model)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
# Response message for PredictionService.CountTokens.
|
252
|
+
class CountTokensResponse
|
253
|
+
include Google::Apis::Core::Hashable
|
254
|
+
|
255
|
+
# The total number of billable characters counted across all instances from the
|
256
|
+
# request.
|
257
|
+
# Corresponds to the JSON property `totalBillableCharacters`
|
258
|
+
# @return [Fixnum]
|
259
|
+
attr_accessor :total_billable_characters
|
260
|
+
|
261
|
+
# The total number of tokens counted across all instances from the request.
|
262
|
+
# Corresponds to the JSON property `totalTokens`
|
263
|
+
# @return [Fixnum]
|
264
|
+
attr_accessor :total_tokens
|
265
|
+
|
266
|
+
def initialize(**args)
|
267
|
+
update!(**args)
|
268
|
+
end
|
269
|
+
|
270
|
+
# Update properties of this object
|
271
|
+
def update!(**args)
|
272
|
+
@total_billable_characters = args[:total_billable_characters] if args.key?(:total_billable_characters)
|
273
|
+
@total_tokens = args[:total_tokens] if args.key?(:total_tokens)
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
# Represents a whole or partial calendar date, such as a birthday. The time of
|
278
|
+
# day and time zone are either specified elsewhere or are insignificant. The
|
279
|
+
# date is relative to the Gregorian Calendar. This can represent one of the
|
280
|
+
# following: * A full date, with non-zero year, month, and day values. * A month
|
281
|
+
# and day, with a zero year (for example, an anniversary). * A year on its own,
|
282
|
+
# with a zero month and a zero day. * A year and month, with a zero day (for
|
283
|
+
# example, a credit card expiration date). Related types: * google.type.
|
284
|
+
# TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
|
285
|
+
class Date
|
286
|
+
include Google::Apis::Core::Hashable
|
287
|
+
|
288
|
+
# Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to
|
289
|
+
# specify a year by itself or a year and month where the day isn't significant.
|
290
|
+
# Corresponds to the JSON property `day`
|
291
|
+
# @return [Fixnum]
|
292
|
+
attr_accessor :day
|
293
|
+
|
294
|
+
# Month of a year. Must be from 1 to 12, or 0 to specify a year without a month
|
295
|
+
# and day.
|
296
|
+
# Corresponds to the JSON property `month`
|
297
|
+
# @return [Fixnum]
|
298
|
+
attr_accessor :month
|
299
|
+
|
300
|
+
# Year of the date. Must be from 1 to 9999, or 0 to specify a date without a
|
301
|
+
# year.
|
302
|
+
# Corresponds to the JSON property `year`
|
303
|
+
# @return [Fixnum]
|
304
|
+
attr_accessor :year
|
305
|
+
|
306
|
+
def initialize(**args)
|
307
|
+
update!(**args)
|
308
|
+
end
|
309
|
+
|
310
|
+
# Update properties of this object
|
311
|
+
def update!(**args)
|
312
|
+
@day = args[:day] if args.key?(:day)
|
313
|
+
@month = args[:month] if args.key?(:month)
|
314
|
+
@year = args[:year] if args.key?(:year)
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
# URI based data.
|
319
|
+
class FileData
|
320
|
+
include Google::Apis::Core::Hashable
|
321
|
+
|
322
|
+
# Required. URI.
|
323
|
+
# Corresponds to the JSON property `fileUri`
|
324
|
+
# @return [String]
|
325
|
+
attr_accessor :file_uri
|
326
|
+
|
327
|
+
# Required. The IANA standard MIME type of the source data.
|
328
|
+
# Corresponds to the JSON property `mimeType`
|
329
|
+
# @return [String]
|
330
|
+
attr_accessor :mime_type
|
331
|
+
|
332
|
+
def initialize(**args)
|
333
|
+
update!(**args)
|
334
|
+
end
|
335
|
+
|
336
|
+
# Update properties of this object
|
337
|
+
def update!(**args)
|
338
|
+
@file_uri = args[:file_uri] if args.key?(:file_uri)
|
339
|
+
@mime_type = args[:mime_type] if args.key?(:mime_type)
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
343
|
+
# A predicted [FunctionCall] returned from the model that contains a string
|
344
|
+
# representing the [FunctionDeclaration.name] and a structured JSON object
|
345
|
+
# containing the parameters and their values.
|
346
|
+
class FunctionCall
|
347
|
+
include Google::Apis::Core::Hashable
|
348
|
+
|
349
|
+
# Optional. Required. The function parameters and values in JSON object format.
|
350
|
+
# See [FunctionDeclaration.parameters] for parameter details.
|
351
|
+
# Corresponds to the JSON property `args`
|
352
|
+
# @return [Hash<String,Object>]
|
353
|
+
attr_accessor :args
|
354
|
+
|
355
|
+
# Required. The name of the function to call. Matches [FunctionDeclaration.name].
|
356
|
+
# Corresponds to the JSON property `name`
|
357
|
+
# @return [String]
|
358
|
+
attr_accessor :name
|
359
|
+
|
360
|
+
def initialize(**args)
|
361
|
+
update!(**args)
|
362
|
+
end
|
363
|
+
|
364
|
+
# Update properties of this object
|
365
|
+
def update!(**args)
|
366
|
+
@args = args[:args] if args.key?(:args)
|
367
|
+
@name = args[:name] if args.key?(:name)
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
# Function calling config.
|
372
|
+
class FunctionCallingConfig
|
373
|
+
include Google::Apis::Core::Hashable
|
374
|
+
|
375
|
+
# Optional. Function names to call. Only set when the Mode is ANY. Function
|
376
|
+
# names should match [FunctionDeclaration.name]. With mode set to ANY, model
|
377
|
+
# will predict a function call from the set of function names provided.
|
378
|
+
# Corresponds to the JSON property `allowedFunctionNames`
|
379
|
+
# @return [Array<String>]
|
380
|
+
attr_accessor :allowed_function_names
|
381
|
+
|
382
|
+
# Optional. Function calling mode.
|
383
|
+
# Corresponds to the JSON property `mode`
|
384
|
+
# @return [String]
|
385
|
+
attr_accessor :mode
|
386
|
+
|
387
|
+
def initialize(**args)
|
388
|
+
update!(**args)
|
389
|
+
end
|
390
|
+
|
391
|
+
# Update properties of this object
|
392
|
+
def update!(**args)
|
393
|
+
@allowed_function_names = args[:allowed_function_names] if args.key?(:allowed_function_names)
|
394
|
+
@mode = args[:mode] if args.key?(:mode)
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
# Structured representation of a function declaration as defined by the [OpenAPI
|
399
|
+
# 3.0 specification](https://spec.openapis.org/oas/v3.0.3). Included in this
|
400
|
+
# declaration are the function name and parameters. This FunctionDeclaration is
|
401
|
+
# a representation of a block of code that can be used as a `Tool` by the model
|
402
|
+
# and executed by the client.
|
403
|
+
class FunctionDeclaration
|
404
|
+
include Google::Apis::Core::Hashable
|
405
|
+
|
406
|
+
# Optional. Description and purpose of the function. Model uses it to decide how
|
407
|
+
# and whether to call the function.
|
408
|
+
# Corresponds to the JSON property `description`
|
409
|
+
# @return [String]
|
410
|
+
attr_accessor :description
|
411
|
+
|
412
|
+
# Required. The name of the function to call. Must start with a letter or an
|
413
|
+
# underscore. Must be a-z, A-Z, 0-9, or contain underscores, dots and dashes,
|
414
|
+
# with a maximum length of 64.
|
415
|
+
# Corresponds to the JSON property `name`
|
416
|
+
# @return [String]
|
417
|
+
attr_accessor :name
|
418
|
+
|
419
|
+
# Schema is used to define the format of input/output data. Represents a select
|
420
|
+
# subset of an [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#
|
421
|
+
# schema). More fields may be added in the future as needed.
|
422
|
+
# Corresponds to the JSON property `parameters`
|
423
|
+
# @return [Google::Apis::FirebasemlV2beta::Schema]
|
424
|
+
attr_accessor :parameters
|
425
|
+
|
426
|
+
# Schema is used to define the format of input/output data. Represents a select
|
427
|
+
# subset of an [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#
|
428
|
+
# schema). More fields may be added in the future as needed.
|
429
|
+
# Corresponds to the JSON property `response`
|
430
|
+
# @return [Google::Apis::FirebasemlV2beta::Schema]
|
431
|
+
attr_accessor :response
|
432
|
+
|
433
|
+
def initialize(**args)
|
434
|
+
update!(**args)
|
435
|
+
end
|
436
|
+
|
437
|
+
# Update properties of this object
|
438
|
+
def update!(**args)
|
439
|
+
@description = args[:description] if args.key?(:description)
|
440
|
+
@name = args[:name] if args.key?(:name)
|
441
|
+
@parameters = args[:parameters] if args.key?(:parameters)
|
442
|
+
@response = args[:response] if args.key?(:response)
|
443
|
+
end
|
444
|
+
end
|
445
|
+
|
446
|
+
# The result output from a [FunctionCall] that contains a string representing
|
447
|
+
# the [FunctionDeclaration.name] and a structured JSON object containing any
|
448
|
+
# output from the function is used as context to the model. This should contain
|
449
|
+
# the result of a [FunctionCall] made based on model prediction.
|
450
|
+
class FunctionResponse
|
451
|
+
include Google::Apis::Core::Hashable
|
452
|
+
|
453
|
+
# Required. The name of the function to call. Matches [FunctionDeclaration.name]
|
454
|
+
# and [FunctionCall.name].
|
455
|
+
# Corresponds to the JSON property `name`
|
456
|
+
# @return [String]
|
457
|
+
attr_accessor :name
|
458
|
+
|
459
|
+
# Required. The function response in JSON object format.
|
460
|
+
# Corresponds to the JSON property `response`
|
461
|
+
# @return [Hash<String,Object>]
|
462
|
+
attr_accessor :response
|
463
|
+
|
464
|
+
def initialize(**args)
|
465
|
+
update!(**args)
|
466
|
+
end
|
467
|
+
|
468
|
+
# Update properties of this object
|
469
|
+
def update!(**args)
|
470
|
+
@name = args[:name] if args.key?(:name)
|
471
|
+
@response = args[:response] if args.key?(:response)
|
472
|
+
end
|
473
|
+
end
|
474
|
+
|
475
|
+
# Request message for [PredictionService.GenerateContent].
|
476
|
+
class GenerateContentRequest
|
477
|
+
include Google::Apis::Core::Hashable
|
478
|
+
|
479
|
+
# Required. The content of the current conversation with the model. For single-
|
480
|
+
# turn queries, this is a single instance. For multi-turn queries, this is a
|
481
|
+
# repeated field that contains conversation history + latest request.
|
482
|
+
# Corresponds to the JSON property `contents`
|
483
|
+
# @return [Array<Google::Apis::FirebasemlV2beta::Content>]
|
484
|
+
attr_accessor :contents
|
485
|
+
|
486
|
+
# Generation config.
|
487
|
+
# Corresponds to the JSON property `generationConfig`
|
488
|
+
# @return [Google::Apis::FirebasemlV2beta::GenerationConfig]
|
489
|
+
attr_accessor :generation_config
|
490
|
+
|
491
|
+
# Optional. Per request settings for blocking unsafe content. Enforced on
|
492
|
+
# GenerateContentResponse.candidates.
|
493
|
+
# Corresponds to the JSON property `safetySettings`
|
494
|
+
# @return [Array<Google::Apis::FirebasemlV2beta::SafetySetting>]
|
495
|
+
attr_accessor :safety_settings
|
496
|
+
|
497
|
+
# The base structured datatype containing multi-part content of a message. A `
|
498
|
+
# Content` includes a `role` field designating the producer of the `Content` and
|
499
|
+
# a `parts` field containing multi-part data that contains the content of the
|
500
|
+
# message turn.
|
501
|
+
# Corresponds to the JSON property `systemInstruction`
|
502
|
+
# @return [Google::Apis::FirebasemlV2beta::Content]
|
503
|
+
attr_accessor :system_instruction
|
504
|
+
|
505
|
+
# Tool config. This config is shared for all tools provided in the request.
|
506
|
+
# Corresponds to the JSON property `toolConfig`
|
507
|
+
# @return [Google::Apis::FirebasemlV2beta::ToolConfig]
|
508
|
+
attr_accessor :tool_config
|
509
|
+
|
510
|
+
# Optional. A list of `Tools` the model may use to generate the next response. A
|
511
|
+
# `Tool` is a piece of code that enables the system to interact with external
|
512
|
+
# systems to perform an action, or set of actions, outside of knowledge and
|
513
|
+
# scope of the model.
|
514
|
+
# Corresponds to the JSON property `tools`
|
515
|
+
# @return [Array<Google::Apis::FirebasemlV2beta::Tool>]
|
516
|
+
attr_accessor :tools
|
517
|
+
|
518
|
+
def initialize(**args)
|
519
|
+
update!(**args)
|
520
|
+
end
|
521
|
+
|
522
|
+
# Update properties of this object
|
523
|
+
def update!(**args)
|
524
|
+
@contents = args[:contents] if args.key?(:contents)
|
525
|
+
@generation_config = args[:generation_config] if args.key?(:generation_config)
|
526
|
+
@safety_settings = args[:safety_settings] if args.key?(:safety_settings)
|
527
|
+
@system_instruction = args[:system_instruction] if args.key?(:system_instruction)
|
528
|
+
@tool_config = args[:tool_config] if args.key?(:tool_config)
|
529
|
+
@tools = args[:tools] if args.key?(:tools)
|
530
|
+
end
|
531
|
+
end
|
532
|
+
|
533
|
+
# Response message for [PredictionService.GenerateContent].
|
534
|
+
class GenerateContentResponse
|
535
|
+
include Google::Apis::Core::Hashable
|
536
|
+
|
537
|
+
# Output only. Generated candidates.
|
538
|
+
# Corresponds to the JSON property `candidates`
|
539
|
+
# @return [Array<Google::Apis::FirebasemlV2beta::Candidate>]
|
540
|
+
attr_accessor :candidates
|
541
|
+
|
542
|
+
# Content filter results for a prompt sent in the request.
|
543
|
+
# Corresponds to the JSON property `promptFeedback`
|
544
|
+
# @return [Google::Apis::FirebasemlV2beta::PromptFeedback]
|
545
|
+
attr_accessor :prompt_feedback
|
546
|
+
|
547
|
+
# Usage metadata about response(s).
|
548
|
+
# Corresponds to the JSON property `usageMetadata`
|
549
|
+
# @return [Google::Apis::FirebasemlV2beta::UsageMetadata]
|
550
|
+
attr_accessor :usage_metadata
|
551
|
+
|
552
|
+
def initialize(**args)
|
553
|
+
update!(**args)
|
554
|
+
end
|
555
|
+
|
556
|
+
# Update properties of this object
|
557
|
+
def update!(**args)
|
558
|
+
@candidates = args[:candidates] if args.key?(:candidates)
|
559
|
+
@prompt_feedback = args[:prompt_feedback] if args.key?(:prompt_feedback)
|
560
|
+
@usage_metadata = args[:usage_metadata] if args.key?(:usage_metadata)
|
561
|
+
end
|
562
|
+
end
|
563
|
+
|
564
|
+
# Generation config.
|
565
|
+
class GenerationConfig
|
566
|
+
include Google::Apis::Core::Hashable
|
567
|
+
|
568
|
+
# Optional. Number of candidates to generate.
|
569
|
+
# Corresponds to the JSON property `candidateCount`
|
570
|
+
# @return [Fixnum]
|
571
|
+
attr_accessor :candidate_count
|
572
|
+
|
573
|
+
# Optional. Frequency penalties.
|
574
|
+
# Corresponds to the JSON property `frequencyPenalty`
|
575
|
+
# @return [Float]
|
576
|
+
attr_accessor :frequency_penalty
|
577
|
+
|
578
|
+
# Optional. The maximum number of output tokens to generate per message.
|
579
|
+
# Corresponds to the JSON property `maxOutputTokens`
|
580
|
+
# @return [Fixnum]
|
581
|
+
attr_accessor :max_output_tokens
|
582
|
+
|
583
|
+
# Optional. Positive penalties.
|
584
|
+
# Corresponds to the JSON property `presencePenalty`
|
585
|
+
# @return [Float]
|
586
|
+
attr_accessor :presence_penalty
|
587
|
+
|
588
|
+
# Optional. Output response mimetype of the generated candidate text. Supported
|
589
|
+
# mimetype: - `text/plain`: (default) Text output. - `application/json`: JSON
|
590
|
+
# response in the candidates. The model needs to be prompted to output the
|
591
|
+
# appropriate response type, otherwise the behavior is undefined. This is a
|
592
|
+
# preview feature.
|
593
|
+
# Corresponds to the JSON property `responseMimeType`
|
594
|
+
# @return [String]
|
595
|
+
attr_accessor :response_mime_type
|
596
|
+
|
597
|
+
# Optional. Stop sequences.
|
598
|
+
# Corresponds to the JSON property `stopSequences`
|
599
|
+
# @return [Array<String>]
|
600
|
+
attr_accessor :stop_sequences
|
601
|
+
|
602
|
+
# Optional. Controls the randomness of predictions.
|
603
|
+
# Corresponds to the JSON property `temperature`
|
604
|
+
# @return [Float]
|
605
|
+
attr_accessor :temperature
|
606
|
+
|
607
|
+
# Optional. If specified, top-k sampling will be used.
|
608
|
+
# Corresponds to the JSON property `topK`
|
609
|
+
# @return [Float]
|
610
|
+
attr_accessor :top_k
|
611
|
+
|
612
|
+
# Optional. If specified, nucleus sampling will be used.
|
613
|
+
# Corresponds to the JSON property `topP`
|
614
|
+
# @return [Float]
|
615
|
+
attr_accessor :top_p
|
616
|
+
|
617
|
+
def initialize(**args)
|
618
|
+
update!(**args)
|
619
|
+
end
|
620
|
+
|
621
|
+
# Update properties of this object
|
622
|
+
def update!(**args)
|
623
|
+
@candidate_count = args[:candidate_count] if args.key?(:candidate_count)
|
624
|
+
@frequency_penalty = args[:frequency_penalty] if args.key?(:frequency_penalty)
|
625
|
+
@max_output_tokens = args[:max_output_tokens] if args.key?(:max_output_tokens)
|
626
|
+
@presence_penalty = args[:presence_penalty] if args.key?(:presence_penalty)
|
627
|
+
@response_mime_type = args[:response_mime_type] if args.key?(:response_mime_type)
|
628
|
+
@stop_sequences = args[:stop_sequences] if args.key?(:stop_sequences)
|
629
|
+
@temperature = args[:temperature] if args.key?(:temperature)
|
630
|
+
@top_k = args[:top_k] if args.key?(:top_k)
|
631
|
+
@top_p = args[:top_p] if args.key?(:top_p)
|
632
|
+
end
|
633
|
+
end
|
634
|
+
|
635
|
+
# Grounding attribution.
|
636
|
+
class GroundingAttribution
|
637
|
+
include Google::Apis::Core::Hashable
|
638
|
+
|
639
|
+
# Optional. Output only. Confidence score of the attribution. Ranges from 0 to 1.
|
640
|
+
# 1 is the most confident.
|
641
|
+
# Corresponds to the JSON property `confidenceScore`
|
642
|
+
# @return [Float]
|
643
|
+
attr_accessor :confidence_score
|
644
|
+
|
645
|
+
# Attribution from context retrieved by the retrieval tools.
|
646
|
+
# Corresponds to the JSON property `retrievedContext`
|
647
|
+
# @return [Google::Apis::FirebasemlV2beta::RetrievedContext]
|
648
|
+
attr_accessor :retrieved_context
|
649
|
+
|
650
|
+
# Segment of the content.
|
651
|
+
# Corresponds to the JSON property `segment`
|
652
|
+
# @return [Google::Apis::FirebasemlV2beta::Segment]
|
653
|
+
attr_accessor :segment
|
654
|
+
|
655
|
+
# Attribution from the web.
|
656
|
+
# Corresponds to the JSON property `web`
|
657
|
+
# @return [Google::Apis::FirebasemlV2beta::Web]
|
658
|
+
attr_accessor :web
|
659
|
+
|
660
|
+
def initialize(**args)
|
661
|
+
update!(**args)
|
662
|
+
end
|
663
|
+
|
664
|
+
# Update properties of this object
|
665
|
+
def update!(**args)
|
666
|
+
@confidence_score = args[:confidence_score] if args.key?(:confidence_score)
|
667
|
+
@retrieved_context = args[:retrieved_context] if args.key?(:retrieved_context)
|
668
|
+
@segment = args[:segment] if args.key?(:segment)
|
669
|
+
@web = args[:web] if args.key?(:web)
|
670
|
+
end
|
671
|
+
end
|
672
|
+
|
673
|
+
# Metadata returned to client when grounding is enabled.
|
674
|
+
class GroundingMetadata
|
675
|
+
include Google::Apis::Core::Hashable
|
676
|
+
|
677
|
+
# Optional. List of grounding attributions.
|
678
|
+
# Corresponds to the JSON property `groundingAttributions`
|
679
|
+
# @return [Array<Google::Apis::FirebasemlV2beta::GroundingAttribution>]
|
680
|
+
attr_accessor :grounding_attributions
|
681
|
+
|
682
|
+
# Optional. Queries executed by the retrieval tools.
|
683
|
+
# Corresponds to the JSON property `retrievalQueries`
|
684
|
+
# @return [Array<String>]
|
685
|
+
attr_accessor :retrieval_queries
|
686
|
+
|
687
|
+
# Optional. Web search queries for the following-up web search.
|
688
|
+
# Corresponds to the JSON property `webSearchQueries`
|
689
|
+
# @return [Array<String>]
|
690
|
+
attr_accessor :web_search_queries
|
691
|
+
|
692
|
+
def initialize(**args)
|
693
|
+
update!(**args)
|
694
|
+
end
|
695
|
+
|
696
|
+
# Update properties of this object
|
697
|
+
def update!(**args)
|
698
|
+
@grounding_attributions = args[:grounding_attributions] if args.key?(:grounding_attributions)
|
699
|
+
@retrieval_queries = args[:retrieval_queries] if args.key?(:retrieval_queries)
|
700
|
+
@web_search_queries = args[:web_search_queries] if args.key?(:web_search_queries)
|
701
|
+
end
|
702
|
+
end
|
703
|
+
|
704
|
+
# This is returned in the longrunning operations for create/update.
|
705
|
+
class ModelOperationMetadata
|
706
|
+
include Google::Apis::Core::Hashable
|
707
|
+
|
708
|
+
#
|
709
|
+
# Corresponds to the JSON property `basicOperationStatus`
|
710
|
+
# @return [String]
|
711
|
+
attr_accessor :basic_operation_status
|
712
|
+
|
713
|
+
# The name of the model we are creating/updating The name must have the form `
|
714
|
+
# projects/`project_id`/models/`model_id``
|
715
|
+
# Corresponds to the JSON property `name`
|
716
|
+
# @return [String]
|
717
|
+
attr_accessor :name
|
718
|
+
|
719
|
+
def initialize(**args)
|
720
|
+
update!(**args)
|
721
|
+
end
|
722
|
+
|
723
|
+
# Update properties of this object
|
724
|
+
def update!(**args)
|
725
|
+
@basic_operation_status = args[:basic_operation_status] if args.key?(:basic_operation_status)
|
726
|
+
@name = args[:name] if args.key?(:name)
|
727
|
+
end
|
728
|
+
end
|
729
|
+
|
730
|
+
# A datatype containing media that is part of a multi-part `Content` message. A `
|
731
|
+
# Part` consists of data which has an associated datatype. A `Part` can only
|
732
|
+
# contain one of the accepted types in `Part.data`. A `Part` must have a fixed
|
733
|
+
# IANA MIME type identifying the type and subtype of the media if `inline_data`
|
734
|
+
# or `file_data` field is filled with raw bytes.
|
735
|
+
class Part
|
736
|
+
include Google::Apis::Core::Hashable
|
737
|
+
|
738
|
+
# URI based data.
|
739
|
+
# Corresponds to the JSON property `fileData`
|
740
|
+
# @return [Google::Apis::FirebasemlV2beta::FileData]
|
741
|
+
attr_accessor :file_data
|
742
|
+
|
743
|
+
# A predicted [FunctionCall] returned from the model that contains a string
|
744
|
+
# representing the [FunctionDeclaration.name] and a structured JSON object
|
745
|
+
# containing the parameters and their values.
|
746
|
+
# Corresponds to the JSON property `functionCall`
|
747
|
+
# @return [Google::Apis::FirebasemlV2beta::FunctionCall]
|
748
|
+
attr_accessor :function_call
|
749
|
+
|
750
|
+
# The result output from a [FunctionCall] that contains a string representing
|
751
|
+
# the [FunctionDeclaration.name] and a structured JSON object containing any
|
752
|
+
# output from the function is used as context to the model. This should contain
|
753
|
+
# the result of a [FunctionCall] made based on model prediction.
|
754
|
+
# Corresponds to the JSON property `functionResponse`
|
755
|
+
# @return [Google::Apis::FirebasemlV2beta::FunctionResponse]
|
756
|
+
attr_accessor :function_response
|
757
|
+
|
758
|
+
# Content blob. It's preferred to send as text directly rather than raw bytes.
|
759
|
+
# Corresponds to the JSON property `inlineData`
|
760
|
+
# @return [Google::Apis::FirebasemlV2beta::Blob]
|
761
|
+
attr_accessor :inline_data
|
762
|
+
|
763
|
+
# Optional. Text part (can be code).
|
764
|
+
# Corresponds to the JSON property `text`
|
765
|
+
# @return [String]
|
766
|
+
attr_accessor :text
|
767
|
+
|
768
|
+
# Metadata describes the input video content.
|
769
|
+
# Corresponds to the JSON property `videoMetadata`
|
770
|
+
# @return [Google::Apis::FirebasemlV2beta::VideoMetadata]
|
771
|
+
attr_accessor :video_metadata
|
772
|
+
|
773
|
+
def initialize(**args)
|
774
|
+
update!(**args)
|
775
|
+
end
|
776
|
+
|
777
|
+
# Update properties of this object
|
778
|
+
def update!(**args)
|
779
|
+
@file_data = args[:file_data] if args.key?(:file_data)
|
780
|
+
@function_call = args[:function_call] if args.key?(:function_call)
|
781
|
+
@function_response = args[:function_response] if args.key?(:function_response)
|
782
|
+
@inline_data = args[:inline_data] if args.key?(:inline_data)
|
783
|
+
@text = args[:text] if args.key?(:text)
|
784
|
+
@video_metadata = args[:video_metadata] if args.key?(:video_metadata)
|
785
|
+
end
|
786
|
+
end
|
787
|
+
|
788
|
+
# Content filter results for a prompt sent in the request.
|
789
|
+
class PromptFeedback
|
790
|
+
include Google::Apis::Core::Hashable
|
791
|
+
|
792
|
+
# Output only. Blocked reason.
|
793
|
+
# Corresponds to the JSON property `blockReason`
|
794
|
+
# @return [String]
|
795
|
+
attr_accessor :block_reason
|
796
|
+
|
797
|
+
# Output only. A readable block reason message.
|
798
|
+
# Corresponds to the JSON property `blockReasonMessage`
|
799
|
+
# @return [String]
|
800
|
+
attr_accessor :block_reason_message
|
801
|
+
|
802
|
+
# Output only. Safety ratings.
|
803
|
+
# Corresponds to the JSON property `safetyRatings`
|
804
|
+
# @return [Array<Google::Apis::FirebasemlV2beta::SafetyRating>]
|
805
|
+
attr_accessor :safety_ratings
|
806
|
+
|
807
|
+
def initialize(**args)
|
808
|
+
update!(**args)
|
809
|
+
end
|
810
|
+
|
811
|
+
# Update properties of this object
|
812
|
+
def update!(**args)
|
813
|
+
@block_reason = args[:block_reason] if args.key?(:block_reason)
|
814
|
+
@block_reason_message = args[:block_reason_message] if args.key?(:block_reason_message)
|
815
|
+
@safety_ratings = args[:safety_ratings] if args.key?(:safety_ratings)
|
816
|
+
end
|
817
|
+
end
|
818
|
+
|
819
|
+
# Defines a retrieval tool that model can call to access external knowledge.
|
820
|
+
class Retrieval
|
821
|
+
include Google::Apis::Core::Hashable
|
822
|
+
|
823
|
+
# Optional. Disable using the result from this tool in detecting grounding
|
824
|
+
# attribution. This does not affect how the result is given to the model for
|
825
|
+
# generation.
|
826
|
+
# Corresponds to the JSON property `disableAttribution`
|
827
|
+
# @return [Boolean]
|
828
|
+
attr_accessor :disable_attribution
|
829
|
+
alias_method :disable_attribution?, :disable_attribution
|
830
|
+
|
831
|
+
# Retrieve from Vertex AI Search datastore for grounding. See https://cloud.
|
832
|
+
# google.com/vertex-ai-search-and-conversation
|
833
|
+
# Corresponds to the JSON property `vertexAiSearch`
|
834
|
+
# @return [Google::Apis::FirebasemlV2beta::VertexAiSearch]
|
835
|
+
attr_accessor :vertex_ai_search
|
836
|
+
|
837
|
+
# Retrieve from Vertex RAG Store for grounding.
|
838
|
+
# Corresponds to the JSON property `vertexRagStore`
|
839
|
+
# @return [Google::Apis::FirebasemlV2beta::VertexRagStore]
|
840
|
+
attr_accessor :vertex_rag_store
|
841
|
+
|
842
|
+
def initialize(**args)
|
843
|
+
update!(**args)
|
844
|
+
end
|
845
|
+
|
846
|
+
# Update properties of this object
|
847
|
+
def update!(**args)
|
848
|
+
@disable_attribution = args[:disable_attribution] if args.key?(:disable_attribution)
|
849
|
+
@vertex_ai_search = args[:vertex_ai_search] if args.key?(:vertex_ai_search)
|
850
|
+
@vertex_rag_store = args[:vertex_rag_store] if args.key?(:vertex_rag_store)
|
851
|
+
end
|
852
|
+
end
|
853
|
+
|
854
|
+
# Attribution from context retrieved by the retrieval tools.
|
855
|
+
class RetrievedContext
|
856
|
+
include Google::Apis::Core::Hashable
|
857
|
+
|
858
|
+
# Output only. Title of the attribution.
|
859
|
+
# Corresponds to the JSON property `title`
|
860
|
+
# @return [String]
|
861
|
+
attr_accessor :title
|
862
|
+
|
863
|
+
# Output only. URI reference of the attribution.
|
864
|
+
# Corresponds to the JSON property `uri`
|
865
|
+
# @return [String]
|
866
|
+
attr_accessor :uri
|
867
|
+
|
868
|
+
def initialize(**args)
|
869
|
+
update!(**args)
|
870
|
+
end
|
871
|
+
|
872
|
+
# Update properties of this object
|
873
|
+
def update!(**args)
|
874
|
+
@title = args[:title] if args.key?(:title)
|
875
|
+
@uri = args[:uri] if args.key?(:uri)
|
876
|
+
end
|
877
|
+
end
|
878
|
+
|
879
|
+
# Safety rating corresponding to the generated content.
|
880
|
+
class SafetyRating
|
881
|
+
include Google::Apis::Core::Hashable
|
882
|
+
|
883
|
+
# Output only. Indicates whether the content was filtered out because of this
|
884
|
+
# rating.
|
885
|
+
# Corresponds to the JSON property `blocked`
|
886
|
+
# @return [Boolean]
|
887
|
+
attr_accessor :blocked
|
888
|
+
alias_method :blocked?, :blocked
|
889
|
+
|
890
|
+
# Output only. Harm category.
|
891
|
+
# Corresponds to the JSON property `category`
|
892
|
+
# @return [String]
|
893
|
+
attr_accessor :category
|
894
|
+
|
895
|
+
# Output only. Harm probability levels in the content.
|
896
|
+
# Corresponds to the JSON property `probability`
|
897
|
+
# @return [String]
|
898
|
+
attr_accessor :probability
|
899
|
+
|
900
|
+
# Output only. Harm probability score.
|
901
|
+
# Corresponds to the JSON property `probabilityScore`
|
902
|
+
# @return [Float]
|
903
|
+
attr_accessor :probability_score
|
904
|
+
|
905
|
+
# Output only. Harm severity levels in the content.
|
906
|
+
# Corresponds to the JSON property `severity`
|
907
|
+
# @return [String]
|
908
|
+
attr_accessor :severity
|
909
|
+
|
910
|
+
# Output only. Harm severity score.
|
911
|
+
# Corresponds to the JSON property `severityScore`
|
912
|
+
# @return [Float]
|
913
|
+
attr_accessor :severity_score
|
914
|
+
|
915
|
+
def initialize(**args)
|
916
|
+
update!(**args)
|
917
|
+
end
|
918
|
+
|
919
|
+
# Update properties of this object
|
920
|
+
def update!(**args)
|
921
|
+
@blocked = args[:blocked] if args.key?(:blocked)
|
922
|
+
@category = args[:category] if args.key?(:category)
|
923
|
+
@probability = args[:probability] if args.key?(:probability)
|
924
|
+
@probability_score = args[:probability_score] if args.key?(:probability_score)
|
925
|
+
@severity = args[:severity] if args.key?(:severity)
|
926
|
+
@severity_score = args[:severity_score] if args.key?(:severity_score)
|
927
|
+
end
|
928
|
+
end
|
929
|
+
|
930
|
+
# Safety settings.
|
931
|
+
class SafetySetting
|
932
|
+
include Google::Apis::Core::Hashable
|
933
|
+
|
934
|
+
# Required. Harm category.
|
935
|
+
# Corresponds to the JSON property `category`
|
936
|
+
# @return [String]
|
937
|
+
attr_accessor :category
|
938
|
+
|
939
|
+
# Optional. Specify if the threshold is used for probability or severity score.
|
940
|
+
# If not specified, the threshold is used for probability score.
|
941
|
+
# Corresponds to the JSON property `method`
|
942
|
+
# @return [String]
|
943
|
+
attr_accessor :method_prop
|
944
|
+
|
945
|
+
# Required. The harm block threshold.
|
946
|
+
# Corresponds to the JSON property `threshold`
|
947
|
+
# @return [String]
|
948
|
+
attr_accessor :threshold
|
949
|
+
|
950
|
+
def initialize(**args)
|
951
|
+
update!(**args)
|
952
|
+
end
|
953
|
+
|
954
|
+
# Update properties of this object
|
955
|
+
def update!(**args)
|
956
|
+
@category = args[:category] if args.key?(:category)
|
957
|
+
@method_prop = args[:method_prop] if args.key?(:method_prop)
|
958
|
+
@threshold = args[:threshold] if args.key?(:threshold)
|
959
|
+
end
|
960
|
+
end
|
961
|
+
|
962
|
+
# Schema is used to define the format of input/output data. Represents a select
|
963
|
+
# subset of an [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#
|
964
|
+
# schema). More fields may be added in the future as needed.
|
965
|
+
class Schema
|
966
|
+
include Google::Apis::Core::Hashable
|
967
|
+
|
968
|
+
# Optional. Default value of the data.
|
969
|
+
# Corresponds to the JSON property `default`
|
970
|
+
# @return [Object]
|
971
|
+
attr_accessor :default
|
972
|
+
|
973
|
+
# Optional. The description of the data.
|
974
|
+
# Corresponds to the JSON property `description`
|
975
|
+
# @return [String]
|
976
|
+
attr_accessor :description
|
977
|
+
|
978
|
+
# Optional. Possible values of the element of Type.STRING with enum format. For
|
979
|
+
# example we can define an Enum Direction as : `type:STRING, format:enum, enum:["
|
980
|
+
# EAST", NORTH", "SOUTH", "WEST"]`
|
981
|
+
# Corresponds to the JSON property `enum`
|
982
|
+
# @return [Array<String>]
|
983
|
+
attr_accessor :enum
|
984
|
+
|
985
|
+
# Optional. Example of the object. Will only populated when the object is the
|
986
|
+
# root.
|
987
|
+
# Corresponds to the JSON property `example`
|
988
|
+
# @return [Object]
|
989
|
+
attr_accessor :example
|
990
|
+
|
991
|
+
# Optional. The format of the data. Supported formats: for NUMBER type: "float",
|
992
|
+
# "double" for INTEGER type: "int32", "int64" for STRING type: "email", "byte",
|
993
|
+
# etc
|
994
|
+
# Corresponds to the JSON property `format`
|
995
|
+
# @return [String]
|
996
|
+
attr_accessor :format
|
997
|
+
|
998
|
+
# Schema is used to define the format of input/output data. Represents a select
|
999
|
+
# subset of an [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#
|
1000
|
+
# schema). More fields may be added in the future as needed.
|
1001
|
+
# Corresponds to the JSON property `items`
|
1002
|
+
# @return [Google::Apis::FirebasemlV2beta::Schema]
|
1003
|
+
attr_accessor :items
|
1004
|
+
|
1005
|
+
# Optional. Maximum number of the elements for Type.ARRAY.
|
1006
|
+
# Corresponds to the JSON property `maxItems`
|
1007
|
+
# @return [Fixnum]
|
1008
|
+
attr_accessor :max_items
|
1009
|
+
|
1010
|
+
# Optional. Maximum length of the Type.STRING
|
1011
|
+
# Corresponds to the JSON property `maxLength`
|
1012
|
+
# @return [Fixnum]
|
1013
|
+
attr_accessor :max_length
|
1014
|
+
|
1015
|
+
# Optional. Maximum number of the properties for Type.OBJECT.
|
1016
|
+
# Corresponds to the JSON property `maxProperties`
|
1017
|
+
# @return [Fixnum]
|
1018
|
+
attr_accessor :max_properties
|
1019
|
+
|
1020
|
+
# Optional. Maximum value of the Type.INTEGER and Type.NUMBER
|
1021
|
+
# Corresponds to the JSON property `maximum`
|
1022
|
+
# @return [Float]
|
1023
|
+
attr_accessor :maximum
|
1024
|
+
|
1025
|
+
# Optional. Minimum number of the elements for Type.ARRAY.
|
1026
|
+
# Corresponds to the JSON property `minItems`
|
1027
|
+
# @return [Fixnum]
|
1028
|
+
attr_accessor :min_items
|
1029
|
+
|
1030
|
+
# Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING
|
1031
|
+
# Corresponds to the JSON property `minLength`
|
1032
|
+
# @return [Fixnum]
|
1033
|
+
attr_accessor :min_length
|
1034
|
+
|
1035
|
+
# Optional. Minimum number of the properties for Type.OBJECT.
|
1036
|
+
# Corresponds to the JSON property `minProperties`
|
1037
|
+
# @return [Fixnum]
|
1038
|
+
attr_accessor :min_properties
|
1039
|
+
|
1040
|
+
# Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the Type.
|
1041
|
+
# INTEGER and Type.NUMBER
|
1042
|
+
# Corresponds to the JSON property `minimum`
|
1043
|
+
# @return [Float]
|
1044
|
+
attr_accessor :minimum
|
1045
|
+
|
1046
|
+
# Optional. Indicates if the value may be null.
|
1047
|
+
# Corresponds to the JSON property `nullable`
|
1048
|
+
# @return [Boolean]
|
1049
|
+
attr_accessor :nullable
|
1050
|
+
alias_method :nullable?, :nullable
|
1051
|
+
|
1052
|
+
# Optional. Pattern of the Type.STRING to restrict a string to a regular
|
1053
|
+
# expression.
|
1054
|
+
# Corresponds to the JSON property `pattern`
|
1055
|
+
# @return [String]
|
1056
|
+
attr_accessor :pattern
|
1057
|
+
|
1058
|
+
# Optional. SCHEMA FIELDS FOR TYPE OBJECT Properties of Type.OBJECT.
|
1059
|
+
# Corresponds to the JSON property `properties`
|
1060
|
+
# @return [Hash<String,Google::Apis::FirebasemlV2beta::Schema>]
|
1061
|
+
attr_accessor :properties
|
1062
|
+
|
1063
|
+
# Optional. Required properties of Type.OBJECT.
|
1064
|
+
# Corresponds to the JSON property `required`
|
1065
|
+
# @return [Array<String>]
|
1066
|
+
attr_accessor :required
|
1067
|
+
|
1068
|
+
# Optional. The title of the Schema.
|
1069
|
+
# Corresponds to the JSON property `title`
|
1070
|
+
# @return [String]
|
1071
|
+
attr_accessor :title
|
1072
|
+
|
1073
|
+
# Optional. The type of the data.
|
1074
|
+
# Corresponds to the JSON property `type`
|
1075
|
+
# @return [String]
|
1076
|
+
attr_accessor :type
|
1077
|
+
|
1078
|
+
def initialize(**args)
|
1079
|
+
update!(**args)
|
1080
|
+
end
|
1081
|
+
|
1082
|
+
# Update properties of this object
|
1083
|
+
def update!(**args)
|
1084
|
+
@default = args[:default] if args.key?(:default)
|
1085
|
+
@description = args[:description] if args.key?(:description)
|
1086
|
+
@enum = args[:enum] if args.key?(:enum)
|
1087
|
+
@example = args[:example] if args.key?(:example)
|
1088
|
+
@format = args[:format] if args.key?(:format)
|
1089
|
+
@items = args[:items] if args.key?(:items)
|
1090
|
+
@max_items = args[:max_items] if args.key?(:max_items)
|
1091
|
+
@max_length = args[:max_length] if args.key?(:max_length)
|
1092
|
+
@max_properties = args[:max_properties] if args.key?(:max_properties)
|
1093
|
+
@maximum = args[:maximum] if args.key?(:maximum)
|
1094
|
+
@min_items = args[:min_items] if args.key?(:min_items)
|
1095
|
+
@min_length = args[:min_length] if args.key?(:min_length)
|
1096
|
+
@min_properties = args[:min_properties] if args.key?(:min_properties)
|
1097
|
+
@minimum = args[:minimum] if args.key?(:minimum)
|
1098
|
+
@nullable = args[:nullable] if args.key?(:nullable)
|
1099
|
+
@pattern = args[:pattern] if args.key?(:pattern)
|
1100
|
+
@properties = args[:properties] if args.key?(:properties)
|
1101
|
+
@required = args[:required] if args.key?(:required)
|
1102
|
+
@title = args[:title] if args.key?(:title)
|
1103
|
+
@type = args[:type] if args.key?(:type)
|
1104
|
+
end
|
1105
|
+
end
|
1106
|
+
|
1107
|
+
# Segment of the content.
|
1108
|
+
class Segment
|
1109
|
+
include Google::Apis::Core::Hashable
|
1110
|
+
|
1111
|
+
# Output only. End index in the given Part, measured in bytes. Offset from the
|
1112
|
+
# start of the Part, exclusive, starting at zero.
|
1113
|
+
# Corresponds to the JSON property `endIndex`
|
1114
|
+
# @return [Fixnum]
|
1115
|
+
attr_accessor :end_index
|
1116
|
+
|
1117
|
+
# Output only. The index of a Part object within its parent Content object.
|
1118
|
+
# Corresponds to the JSON property `partIndex`
|
1119
|
+
# @return [Fixnum]
|
1120
|
+
attr_accessor :part_index
|
1121
|
+
|
1122
|
+
# Output only. Start index in the given Part, measured in bytes. Offset from the
|
1123
|
+
# start of the Part, inclusive, starting at zero.
|
1124
|
+
# Corresponds to the JSON property `startIndex`
|
1125
|
+
# @return [Fixnum]
|
1126
|
+
attr_accessor :start_index
|
1127
|
+
|
1128
|
+
def initialize(**args)
|
1129
|
+
update!(**args)
|
1130
|
+
end
|
1131
|
+
|
1132
|
+
# Update properties of this object
|
1133
|
+
def update!(**args)
|
1134
|
+
@end_index = args[:end_index] if args.key?(:end_index)
|
1135
|
+
@part_index = args[:part_index] if args.key?(:part_index)
|
1136
|
+
@start_index = args[:start_index] if args.key?(:start_index)
|
1137
|
+
end
|
1138
|
+
end
|
1139
|
+
|
1140
|
+
# Tool details that the model may use to generate response. A `Tool` is a piece
|
1141
|
+
# of code that enables the system to interact with external systems to perform
|
1142
|
+
# an action, or set of actions, outside of knowledge and scope of the model. A
|
1143
|
+
# Tool object should contain exactly one type of Tool (e.g FunctionDeclaration,
|
1144
|
+
# Retrieval or GoogleSearchRetrieval).
|
1145
|
+
class Tool
|
1146
|
+
include Google::Apis::Core::Hashable
|
1147
|
+
|
1148
|
+
# Optional. Function tool type. One or more function declarations to be passed
|
1149
|
+
# to the model along with the current user query. Model may decide to call a
|
1150
|
+
# subset of these functions by populating FunctionCall in the response. User
|
1151
|
+
# should provide a FunctionResponse for each function call in the next turn.
|
1152
|
+
# Based on the function responses, Model will generate the final response back
|
1153
|
+
# to the user. Maximum 64 function declarations can be provided.
|
1154
|
+
# Corresponds to the JSON property `functionDeclarations`
|
1155
|
+
# @return [Array<Google::Apis::FirebasemlV2beta::FunctionDeclaration>]
|
1156
|
+
attr_accessor :function_declarations
|
1157
|
+
|
1158
|
+
# Defines a retrieval tool that model can call to access external knowledge.
|
1159
|
+
# Corresponds to the JSON property `retrieval`
|
1160
|
+
# @return [Google::Apis::FirebasemlV2beta::Retrieval]
|
1161
|
+
attr_accessor :retrieval
|
1162
|
+
|
1163
|
+
def initialize(**args)
|
1164
|
+
update!(**args)
|
1165
|
+
end
|
1166
|
+
|
1167
|
+
# Update properties of this object
|
1168
|
+
def update!(**args)
|
1169
|
+
@function_declarations = args[:function_declarations] if args.key?(:function_declarations)
|
1170
|
+
@retrieval = args[:retrieval] if args.key?(:retrieval)
|
1171
|
+
end
|
1172
|
+
end
|
1173
|
+
|
1174
|
+
# Tool config. This config is shared for all tools provided in the request.
|
1175
|
+
class ToolConfig
|
1176
|
+
include Google::Apis::Core::Hashable
|
1177
|
+
|
1178
|
+
# Function calling config.
|
1179
|
+
# Corresponds to the JSON property `functionCallingConfig`
|
1180
|
+
# @return [Google::Apis::FirebasemlV2beta::FunctionCallingConfig]
|
1181
|
+
attr_accessor :function_calling_config
|
1182
|
+
|
1183
|
+
def initialize(**args)
|
1184
|
+
update!(**args)
|
1185
|
+
end
|
1186
|
+
|
1187
|
+
# Update properties of this object
|
1188
|
+
def update!(**args)
|
1189
|
+
@function_calling_config = args[:function_calling_config] if args.key?(:function_calling_config)
|
1190
|
+
end
|
1191
|
+
end
|
1192
|
+
|
1193
|
+
# Usage metadata about response(s).
|
1194
|
+
class UsageMetadata
|
1195
|
+
include Google::Apis::Core::Hashable
|
1196
|
+
|
1197
|
+
# Number of tokens in the response(s).
|
1198
|
+
# Corresponds to the JSON property `candidatesTokenCount`
|
1199
|
+
# @return [Fixnum]
|
1200
|
+
attr_accessor :candidates_token_count
|
1201
|
+
|
1202
|
+
# Number of tokens in the request.
|
1203
|
+
# Corresponds to the JSON property `promptTokenCount`
|
1204
|
+
# @return [Fixnum]
|
1205
|
+
attr_accessor :prompt_token_count
|
1206
|
+
|
1207
|
+
#
|
1208
|
+
# Corresponds to the JSON property `totalTokenCount`
|
1209
|
+
# @return [Fixnum]
|
1210
|
+
attr_accessor :total_token_count
|
1211
|
+
|
1212
|
+
def initialize(**args)
|
1213
|
+
update!(**args)
|
1214
|
+
end
|
1215
|
+
|
1216
|
+
# Update properties of this object
|
1217
|
+
def update!(**args)
|
1218
|
+
@candidates_token_count = args[:candidates_token_count] if args.key?(:candidates_token_count)
|
1219
|
+
@prompt_token_count = args[:prompt_token_count] if args.key?(:prompt_token_count)
|
1220
|
+
@total_token_count = args[:total_token_count] if args.key?(:total_token_count)
|
1221
|
+
end
|
1222
|
+
end
|
1223
|
+
|
1224
|
+
# Retrieve from Vertex AI Search datastore for grounding. See https://cloud.
|
1225
|
+
# google.com/vertex-ai-search-and-conversation
|
1226
|
+
class VertexAiSearch
|
1227
|
+
include Google::Apis::Core::Hashable
|
1228
|
+
|
1229
|
+
# Required. Fully-qualified Vertex AI Search's datastore resource ID. Format: `
|
1230
|
+
# projects/`project`/locations/`location`/collections/`collection`/dataStores/`
|
1231
|
+
# dataStore``
|
1232
|
+
# Corresponds to the JSON property `datastore`
|
1233
|
+
# @return [String]
|
1234
|
+
attr_accessor :datastore
|
1235
|
+
|
1236
|
+
def initialize(**args)
|
1237
|
+
update!(**args)
|
1238
|
+
end
|
1239
|
+
|
1240
|
+
# Update properties of this object
|
1241
|
+
def update!(**args)
|
1242
|
+
@datastore = args[:datastore] if args.key?(:datastore)
|
1243
|
+
end
|
1244
|
+
end
|
1245
|
+
|
1246
|
+
# Retrieve from Vertex RAG Store for grounding.
|
1247
|
+
class VertexRagStore
|
1248
|
+
include Google::Apis::Core::Hashable
|
1249
|
+
|
1250
|
+
# Required. Vertex RAG Store corpus resource name: `projects/`project`/locations/
|
1251
|
+
# `location`/ragCorpora/`ragCorpus`` Currently only one corpus is allowed. In
|
1252
|
+
# the future we may open up multiple corpora support. However, they should be
|
1253
|
+
# from the same project and location.
|
1254
|
+
# Corresponds to the JSON property `ragCorpora`
|
1255
|
+
# @return [Array<String>]
|
1256
|
+
attr_accessor :rag_corpora
|
1257
|
+
|
1258
|
+
# Optional. Number of top k results to return from the selected corpora.
|
1259
|
+
# Corresponds to the JSON property `similarityTopK`
|
1260
|
+
# @return [Fixnum]
|
1261
|
+
attr_accessor :similarity_top_k
|
1262
|
+
|
1263
|
+
# Optional. Only return results with vector distance smaller than the threshold.
|
1264
|
+
# Corresponds to the JSON property `vectorDistanceThreshold`
|
1265
|
+
# @return [Float]
|
1266
|
+
attr_accessor :vector_distance_threshold
|
1267
|
+
|
1268
|
+
def initialize(**args)
|
1269
|
+
update!(**args)
|
1270
|
+
end
|
1271
|
+
|
1272
|
+
# Update properties of this object
|
1273
|
+
def update!(**args)
|
1274
|
+
@rag_corpora = args[:rag_corpora] if args.key?(:rag_corpora)
|
1275
|
+
@similarity_top_k = args[:similarity_top_k] if args.key?(:similarity_top_k)
|
1276
|
+
@vector_distance_threshold = args[:vector_distance_threshold] if args.key?(:vector_distance_threshold)
|
1277
|
+
end
|
1278
|
+
end
|
1279
|
+
|
1280
|
+
# Metadata describes the input video content.
|
1281
|
+
class VideoMetadata
|
1282
|
+
include Google::Apis::Core::Hashable
|
1283
|
+
|
1284
|
+
# Optional. The end offset of the video.
|
1285
|
+
# Corresponds to the JSON property `endOffset`
|
1286
|
+
# @return [String]
|
1287
|
+
attr_accessor :end_offset
|
1288
|
+
|
1289
|
+
# Optional. The start offset of the video.
|
1290
|
+
# Corresponds to the JSON property `startOffset`
|
1291
|
+
# @return [String]
|
1292
|
+
attr_accessor :start_offset
|
1293
|
+
|
1294
|
+
def initialize(**args)
|
1295
|
+
update!(**args)
|
1296
|
+
end
|
1297
|
+
|
1298
|
+
# Update properties of this object
|
1299
|
+
def update!(**args)
|
1300
|
+
@end_offset = args[:end_offset] if args.key?(:end_offset)
|
1301
|
+
@start_offset = args[:start_offset] if args.key?(:start_offset)
|
1302
|
+
end
|
1303
|
+
end
|
1304
|
+
|
1305
|
+
# Attribution from the web.
|
1306
|
+
class Web
|
1307
|
+
include Google::Apis::Core::Hashable
|
1308
|
+
|
1309
|
+
# Output only. Title of the attribution.
|
1310
|
+
# Corresponds to the JSON property `title`
|
1311
|
+
# @return [String]
|
1312
|
+
attr_accessor :title
|
1313
|
+
|
1314
|
+
# Output only. URI reference of the attribution.
|
1315
|
+
# Corresponds to the JSON property `uri`
|
1316
|
+
# @return [String]
|
1317
|
+
attr_accessor :uri
|
1318
|
+
|
1319
|
+
def initialize(**args)
|
1320
|
+
update!(**args)
|
1321
|
+
end
|
1322
|
+
|
1323
|
+
# Update properties of this object
|
1324
|
+
def update!(**args)
|
1325
|
+
@title = args[:title] if args.key?(:title)
|
1326
|
+
@uri = args[:uri] if args.key?(:uri)
|
1327
|
+
end
|
1328
|
+
end
|
1329
|
+
end
|
1330
|
+
end
|
1331
|
+
end
|