- Resource: CachedContent
- Content
- Part
- Blob
- FunctionCall
- FunctionResponse
- FileData
- Tool
- FunctionDeclaration
- Schema
- Type
- ToolConfig
- FunctionCallingConfig
- Mode
- UsageMetadata
- Methods
Resource: CachedContent
Content that has been preprocessed and can be used in subsequent request to GenerativeService.
Cached content can be only used with model it was created for.
JSON representation |
---|
{ "contents": [ { object ( |
Fields | |
---|---|
contents[] |
Optional. Input only. Immutable. The content to cache. |
tools[] |
Optional. Input only. Immutable. A list of |
createTime |
Output only. Creation time of the cache entry. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
updateTime |
Output only. When the cache entry was last updated in UTC time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
usageMetadata |
Output only. Metadata on the usage of the cached content. |
Union field expiration . Specifies when this resource will expire. expiration can be only one of the following: |
|
expireTime |
Timestamp in UTC of when this resource is considered expired. This is always provided on output, regardless of what was sent on input. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
ttl |
Input only. New TTL for this resource, input only. A duration in seconds with up to nine fractional digits, ending with ' |
name |
Optional. Identifier. The resource name referring to the cached content. Format: |
displayName |
Optional. Immutable. The user-generated meaningful display name of the cached content. Maximum 128 Unicode characters. |
model |
Required. Immutable. The name of the |
systemInstruction |
Optional. Input only. Immutable. Developer set system instruction. Currently text only. |
toolConfig |
Optional. Input only. Immutable. Tool config. This config is shared for all tools. |
Content
The base structured datatype containing multi-part content of a message.
A Content
includes a role
field designating the producer of the Content
and a parts
field containing multi-part data that contains the content of the message turn.
JSON representation |
---|
{
"parts": [
{
object ( |
Fields | |
---|---|
parts[] |
Ordered |
role |
Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset. |
Part
A datatype containing media that is part of a multi-part Content
message.
A Part
consists of data which has an associated datatype. A Part
can only contain one of the accepted types in Part.data
.
A Part
must have a fixed IANA MIME type identifying the type and subtype of the media if the inlineData
field is filled with raw bytes.
JSON representation |
---|
{ // Union field |
Fields | |
---|---|
Union field
|
|
text |
Inline text. |
inlineData |
Inline media bytes. |
functionCall |
A predicted |
functionResponse |
The result output of a |
fileData |
URI based data. |
Blob
Raw media bytes.
Text should not be sent as raw bytes, use the 'text' field.
JSON representation |
---|
{ "mimeType": string, "data": string } |
Fields | |
---|---|
mimeType |
The IANA standard MIME type of the source data. 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. |
data |
Raw bytes for media formats. A base64-encoded string. |
FunctionCall
A predicted FunctionCall
returned from the model that contains a string representing the FunctionDeclaration.name
with the arguments and their values.
JSON representation |
---|
{ "name": string, "args": { object } } |
Fields | |
---|---|
name |
Required. The name of the function to call. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 63. |
args |
Optional. The function parameters and values in JSON object format. |
FunctionResponse
The result output from a FunctionCall
that contains a string representing the FunctionDeclaration.name
and a structured JSON object containing any output from the function is used as context to the model. This should contain the result of aFunctionCall
made based on model prediction.
JSON representation |
---|
{ "name": string, "response": { object } } |
Fields | |
---|---|
name |
Required. The name of the function to call. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 63. |
response |
Required. The function response in JSON object format. |
FileData
URI based data.
JSON representation |
---|
{ "mimeType": string, "fileUri": string } |
Fields | |
---|---|
mimeType |
Optional. The IANA standard MIME type of the source data. |
fileUri |
Required. URI. |
Tool
Tool details that the model may use to generate response.
A Tool
is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.
JSON representation |
---|
{
"functionDeclarations": [
{
object ( |
Fields | |
---|---|
functionDeclarations[] |
Optional. A list of The model or system does not execute the function. Instead the defined function may be returned as a [FunctionCall][content.part.function_call] with arguments to the client side for execution. The model may decide to call a subset of these functions by populating [FunctionCall][content.part.function_call] in the response. The next conversation turn may contain a [FunctionResponse][content.part.function_response] with the [content.role] "function" generation context for the next model turn. |
FunctionDeclaration
Structured representation of a function declaration as defined by the OpenAPI 3.03 specification. Included in this declaration are the function name and parameters. This FunctionDeclaration is a representation of a block of code that can be used as a Tool
by the model and executed by the client.
JSON representation |
---|
{
"name": string,
"description": string,
"parameters": {
object ( |
Fields | |
---|---|
name |
Required. The name of the function. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 63. |
description |
Required. A brief description of the function. |
parameters |
Optional. Describes the parameters to this function. Reflects the Open API 3.03 Parameter Object string Key: the name of the parameter. Parameter names are case sensitive. Schema Value: the Schema defining the type used for the parameter. |
Schema
The Schema
object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. Represents a select subset of an OpenAPI 3.0 schema object.
JSON representation |
---|
{ "type": enum ( |
Fields | |
---|---|
type |
Required. Data type. |
format |
Optional. The format of the data. This is used only for primitive datatypes. Supported formats: for NUMBER type: float, double for INTEGER type: int32, int64 |
description |
Optional. A brief description of the parameter. This could contain examples of use. Parameter description may be formatted as Markdown. |
nullable |
Optional. Indicates if the value may be null. |
enum[] |
Optional. Possible values of the element of Type.STRING with enum format. For example we can define an Enum Direction as : {type:STRING, format:enum, enum:["EAST", NORTH", "SOUTH", "WEST"]} |
properties |
Optional. Properties of Type.OBJECT. An object containing a list of |
required[] |
Optional. Required properties of Type.OBJECT. |
items |
Optional. Schema of the elements of Type.ARRAY. |
Type
Type contains the list of OpenAPI data types as defined by https://spec.openapis.org/oas/v3.0.3#data-types
Enums | |
---|---|
TYPE_UNSPECIFIED |
Not specified, should not be used. |
STRING |
String type. |
NUMBER |
Number type. |
INTEGER |
Integer type. |
BOOLEAN |
Boolean type. |
ARRAY |
Array type. |
OBJECT |
Object type. |
ToolConfig
The Tool configuration containing parameters for specifying Tool
use in the request.
JSON representation |
---|
{
"functionCallingConfig": {
object ( |
Fields | |
---|---|
functionCallingConfig |
Optional. Function calling config. |
FunctionCallingConfig
Configuration for specifying function calling behavior.
JSON representation |
---|
{
"mode": enum ( |
Fields | |
---|---|
mode |
Optional. Specifies the mode in which function calling should execute. If unspecified, the default value will be set to AUTO. |
allowedFunctionNames[] |
Optional. A set of function names that, when provided, limits the functions the model will call. This should only be set when the Mode is ANY. Function names should match [FunctionDeclaration.name]. With mode set to ANY, model will predict a function call from the set of function names provided. |
Mode
Defines the execution behavior for function calling by defining the execution mode.
Enums | |
---|---|
MODE_UNSPECIFIED |
Unspecified function calling mode. This value should not be used. |
AUTO |
Default model behavior, model decides to predict either a function call or a natural language response. |
ANY |
Model is constrained to always predicting a function call only. If "allowedFunctionNames" are set, the predicted function call will be limited to any one of "allowedFunctionNames", else the predicted function call will be any one of the provided "functionDeclarations". |
NONE |
Model will not predict any function call. Model behavior is same as when not passing any function declarations. |
UsageMetadata
Metadata on the usage of the cached content.
JSON representation |
---|
{ "totalTokenCount": integer } |
Fields | |
---|---|
totalTokenCount |
Total number of tokens that the cached content consumes. |
Methods |
|
---|---|
|
Creates CachedContent resource. |
|
Deletes CachedContent resource. |
|
Reads CachedContent resource. |
|
Lists CachedContents. |
|
Updates CachedContent resource (only expiration is updatable). |