Кэширование контекста позволяет сохранять и повторно использовать предварительно вычисленные входные токены, которые вы хотите использовать повторно, например, при постановке разных вопросов об одном и том же медиафайле. Это может привести к экономии средств и повышению скорости, в зависимости от использования. Подробное введение см. в руководстве по кэшированию контекста .
Метод: cachedContents.create
Создает ресурс CachedContent.
Конечная точка
постhttps: / /generativelanguage.googleapis.com /v1beta /cachedContents
Текст запроса
Тело запроса содержит экземпляр CachedContent
.
contents[]
object ( Content
)
Необязательно. Только ввод. Неизменяемо. Содержимое для кэширования.
tools[]
object ( Tool
)
Необязательный. Только входные данные. Неизменяемый. Список Tools
модель может использовать для генерации следующего ответа.
expiration
Union type
expiration
может быть только одним из следующих: expireTime
string ( Timestamp
format)
Временная метка в формате UTC, когда ресурс считается истёкшим. Она всегда указывается на выходе, независимо от того, что было отправлено на входе.
Использует RFC 3339, согласно которому сгенерированный вывод всегда будет нормализован по оси Z и содержать 0, 3, 6 или 9 знаков после запятой. Также допускаются смещения, отличные от «Z». Примеры: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
или "2014-10-02T15:01:23+05:30"
.
ttl
string ( Duration
format)
Только ввод. Новый TTL для этого ресурса, только ввод.
Длительность в секундах, содержащая до девяти знаков после запятой, заканчивается на « s
». Пример: "3.5s"
.
string
displayName
Необязательно. Неизменяемо. Созданное пользователем осмысленное отображаемое имя кэшированного контента. Максимум 128 символов Unicode.
string
model
Обязательно. Неизменяемо. Имя Model
, используемой для кэшированного контента. Формат: models/{model}
object ( Content )
systemInstruction
Необязательно. Только ввод. Неизменяемо. Системная инструкция, заданная разработчиком. В настоящее время только текст.
toolConfig
object ( ToolConfig
)
Необязательно. Только ввод. Неизменяемо. Конфигурация инструмента. Эта конфигурация общая для всех инструментов.
Пример запроса
Базовый
Питон
Node.js
Идти
Оболочка
От имени
Питон
Node.js
Идти
Из чата
Питон
Node.js
Идти
Тело ответа
В случае успеха тело ответа содержит вновь созданный экземпляр CachedContent
.
Метод: cachedContents.list
Списки кэшированного содержимого.
Конечная точка
получитьhttps: / /generativelanguage.googleapis.com /v1beta /cachedContents
Параметры запроса
pageSize
integer
Необязательно. Максимальное количество возвращаемых кэшированных элементов. Служба может вернуть меньше этого значения. Если не указано, будет возвращено некоторое количество элементов по умолчанию (меньше максимального). Максимальное значение — 1000; значения выше 1000 будут приведены к 1000.
string
pageToken
Необязательно. Токен страницы, полученный из предыдущего вызова cachedContents.list
. Укажите его для получения следующей страницы.
При пагинации все остальные параметры, предоставленные cachedContents.list
, должны соответствовать вызову, который предоставил токен страницы.
Текст запроса
Тело запроса должно быть пустым.
Тело ответа
Ответ со списком CachedContents.
В случае успеха тело ответа содержит данные со следующей структурой:
cachedContents[]
object ( CachedContent
)
Список кэшированного содержимого.
string
nextPageToken
Токен, который можно отправить как pageToken
для получения следующей страницы. Если это поле пропущено, последующих страниц не будет.
JSON-представление |
---|
{
"cachedContents": [
{
object ( |
Метод: cachedContents.get
Читает ресурс CachedContent.
Конечная точка
получитьhttps: / /generativelanguage.googleapis.com /v1beta /{name=cachedContents /*}
Параметры пути
string
name
Обязательно. Имя ресурса, ссылающегося на запись кэша контента. Формат: cachedContents/{id}
Имеет вид cachedContents/{cachedcontent}
.
Текст запроса
Тело запроса должно быть пустым.
Пример запроса
Питон
Node.js
Идти
Оболочка
Тело ответа
В случае успеха тело ответа содержит экземпляр CachedContent
.
Метод: cachedContents.patch
Обновляет ресурс CachedContent (обновляется только срок действия).
Конечная точка
патчhttps: / /generativelanguage.googleapis.com /v1beta /{cachedContent.name=cachedContents /*}
PATCH https://generativelanguage.googleapis.com/v1beta/{cachedContent.name=cachedContents/*}
Параметры пути
string
cachedContent.name
Только вывод. Идентификатор. Имя ресурса, относящегося к кэшированному содержимому. Формат: cachedContents/{id}
Имеет вид cachedContents/{cachedcontent}
.
Параметры запроса
string ( FieldMask format)
updateMask
Список полей для обновления.
Это список полных имён полей, разделённых запятыми. Пример: "user.displayName,photo"
.
Текст запроса
Тело запроса содержит экземпляр CachedContent
.
expiration
Union type
expiration
может быть только одним из следующих: expireTime
string ( Timestamp
format)
Временная метка в формате UTC, когда ресурс считается истёкшим. Она всегда указывается на выходе, независимо от того, что было отправлено на входе.
Использует RFC 3339, согласно которому сгенерированный вывод всегда будет нормализован по оси Z и содержать 0, 3, 6 или 9 знаков после запятой. Также допускаются смещения, отличные от «Z». Примеры: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
или "2014-10-02T15:01:23+05:30"
.
ttl
string ( Duration
format)
Только ввод. Новый TTL для этого ресурса, только ввод.
Длительность в секундах, содержащая до девяти знаков после запятой, заканчивается на « s
». Пример: "3.5s"
.
Пример запроса
Питон
Node.js
Идти
Оболочка
Тело ответа
В случае успеха тело ответа содержит экземпляр CachedContent
.
Метод: cachedContents.delete
Удаляет ресурс CachedContent.
Конечная точка
удалитьhttps: / /generativelanguage.googleapis.com /v1beta /{name=cachedContents /*}
Параметры пути
string
name
Обязательно. Имя ресурса, ссылающегося на запись кэша контента. Формат: cachedContents/{id}
Имеет вид cachedContents/{cachedcontent}
.
Текст запроса
Тело запроса должно быть пустым.
Пример запроса
Питон
Node.js
Идти
Оболочка
Тело ответа
В случае успеха тело ответа представляет собой пустой объект JSON.
Ресурс REST: cachedContents
- Ресурс: CachedContent
- Содержание
- Часть
- Клякса
- FunctionCall
- ФункцияОтвет
- ФункцияОтветЧасть
- ФункцияResponseBlob
- Планирование
- FileData
- ИсполняемыйКод
- Язык
- CodeExecutionResult
- Исход
- ВидеоМетаданные
- Инструмент
- Объявление функции
- Схема
- Тип
- Поведение
- GoogleSearchRetrieval
- DynamicRetrievalConfig
- Режим
- CodeExecution
- GoogleSearch
- Интервал
- ComputerUse
- Среда
- UrlContext
- FileSearch
- RetrievalResource
- RetrievalConfig
- ToolConfig
- FunctionCallingConfig
- Режим
- ИспользованиеМетаданных
- Методы
Ресурс: CachedContent
Контент, который был предварительно обработан и может быть использован в последующем запросе к GenerativeService.
Кэшированный контент можно использовать только с той моделью, для которой он был создан.
contents[]
object ( Content
)
Необязательно. Только ввод. Неизменяемо. Содержимое для кэширования.
tools[]
object ( Tool
)
Необязательный. Только входные данные. Неизменяемый. Список Tools
модель может использовать для генерации следующего ответа.
createTime
string ( Timestamp
format)
Только вывод. Время создания записи в кэше.
Использует RFC 3339, согласно которому сгенерированный вывод всегда будет нормализован по оси Z и содержать 0, 3, 6 или 9 знаков после запятой. Также допускаются смещения, отличные от «Z». Примеры: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
или "2014-10-02T15:01:23+05:30"
.
updateTime
string ( Timestamp
format)
Только вывод. Время последнего обновления записи в кэше (по UTC).
Использует RFC 3339, согласно которому сгенерированный вывод всегда будет нормализован по оси Z и содержать 0, 3, 6 или 9 знаков после запятой. Также допускаются смещения, отличные от «Z». Примеры: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
или "2014-10-02T15:01:23+05:30"
.
usageMetadata
object ( UsageMetadata
)
Только вывод. Метаданные об использовании кэшированного контента.
expiration
Union type
expiration
может быть только одним из следующих: expireTime
string ( Timestamp
format)
Временная метка в формате UTC, когда ресурс считается истёкшим. Она всегда указывается на выходе, независимо от того, что было отправлено на входе.
Использует RFC 3339, согласно которому сгенерированный вывод всегда будет нормализован по оси Z и содержать 0, 3, 6 или 9 знаков после запятой. Также допускаются смещения, отличные от «Z». Примеры: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
или "2014-10-02T15:01:23+05:30"
.
ttl
string ( Duration
format)
Только ввод. Новый TTL для этого ресурса, только ввод.
Длительность в секундах, содержащая до девяти знаков после запятой, заканчивается на « s
». Пример: "3.5s"
.
string
name
Только вывод. Идентификатор. Имя ресурса, относящегося к кэшированному содержимому. Формат: cachedContents/{id}
string
displayName
Необязательно. Неизменяемо. Созданное пользователем осмысленное отображаемое имя кэшированного контента. Максимум 128 символов Unicode.
string
model
Обязательно. Неизменяемо. Имя Model
, используемой для кэшированного контента. Формат: models/{model}
object ( Content )
systemInstruction
Необязательно. Только ввод. Неизменяемо. Системная инструкция, заданная разработчиком. В настоящее время только текст.
toolConfig
object ( ToolConfig
)
Необязательно. Только ввод. Неизменяемо. Конфигурация инструмента. Эта конфигурация общая для всех инструментов.
JSON-представление |
---|
{ "contents": [ { object ( |
Содержание
Базовый структурированный тип данных, содержащий многочастное содержимое сообщения.
Content
включает поле role
, обозначающее производителя Content
, и поле parts
, содержащее многокомпонентные данные, включающие содержимое поворота сообщения.
parts[]
object ( Part
)
Упорядоченные Parts
, составляющие единое сообщение. Части могут иметь разные типы MIME.
string
role
Необязательно. Производитель контента. Должен быть либо «пользователь», либо «модель».
Полезно устанавливать для многооборотных разговоров, в противном случае можно оставить пустым или не устанавливать.
JSON-представление |
---|
{
"parts": [
{
object ( |
Часть
Тип данных, содержащий медиа-данные, являющиеся частью многокомпонентного сообщения Content
.
Part
состоит из данных, имеющих связанный тип данных. Part
может содержать только один из допустимых типов в Part.data
.
Part
должна иметь фиксированный тип IANA MIME, определяющий тип и подтип носителя, если поле inlineData
заполнено необработанными байтами.
thought
boolean
Необязательно. Указывает, была ли деталь разработана на основе модели.
string ( bytes format)
thoughtSignature
Необязательно. Непрозрачная подпись для мысли, чтобы её можно было использовать повторно в последующих запросах.
Строка в кодировке base64.
partMetadata
object ( Struct
format)
Пользовательские метаданные, связанные с частью. Агентам, использующим genai.Part в качестве представления контента, может потребоваться отслеживать дополнительную информацию. Например, это может быть имя файла/источника, из которого получена часть, или способ мультиплексирования нескольких потоков частей.
Union type
data
data
могут быть только одним из следующих:text
string
Встроенный текст.
inlineData
object ( Blob
)
Встроенные медиа-байты.
object ( FunctionCall )
functionCall
Предсказанный FunctionCall
возвращаемый из модели, содержащий строку, представляющую FunctionDeclaration.name
с аргументами и их значениями.
object ( FunctionResponse )
functionResponse
Результат вывода FunctionCall
, содержащий строку, представляющую FunctionDeclaration.name
, и структурированный объект JSON, содержащий любые выходные данные функции, используется в качестве контекста для модели.
fileData
object ( FileData
)
Данные на основе URI.
object ( ExecutableCode )
executableCode
Код, сгенерированный моделью и предназначенный для выполнения.
object ( CodeExecutionResult )
codeExecutionResult
Результат выполнения ExecutableCode
.
metadata
Union type
metadata
могут быть только одними из следующих:object ( VideoMetadata )
videoMetadata
Необязательно. Метаданные видео. Метаданные следует указывать только в том случае, если видеоданные представлены в inlineData или fileData.
JSON-представление |
---|
{ "thought": boolean, "thoughtSignature": string, "partMetadata": { object }, // data "text": string, "inlineData": { object ( |
Клякса
Необработанные медиа-байты.
Текст не следует отправлять в виде необработанных байтов, используйте поле «текст».
string
mimeType
Стандартный тип MIME IANA для исходных данных. Примеры: - image/png - image/jpeg. Если указан неподдерживаемый тип MIME, будет возвращена ошибка. Полный список поддерживаемых типов см. в разделе «Поддерживаемые форматы файлов» .
string ( bytes format)
data
Необработанные байты для медиаформатов.
Строка в кодировке base64.
JSON-представление |
---|
{ "mimeType": string, "data": string } |
FunctionCall
Предсказанный FunctionCall
возвращаемый из модели, содержащий строку, представляющую FunctionDeclaration.name
с аргументами и их значениями.
string
id
Необязательно. Уникальный идентификатор вызова функции. Если он заполнен, клиент выполнит functionCall
и вернет ответ с соответствующим id
.
string
name
Обязательно. Имя вызываемой функции. Имя должно содержать символы az, AZ, 0-9 или символы подчеркивания и тире. Максимальная длина — 64 символа.
args
object ( Struct
format)
Необязательно. Параметры и значения функции в формате JSON-объекта.
JSON-представление |
---|
{ "id": string, "name": string, "args": { object } } |
ФункцияОтвет
Результат вызова FunctionCall
, содержащий строку, представляющую FunctionDeclaration.name
, и структурированный JSON-объект, содержащий все выходные данные функции, используется в качестве контекста для модели. Он должен содержать результат вызова FunctionCall
, выполненного на основе прогноза модели.
string
id
Необязательно. Идентификатор вызова функции, для которой предназначен этот ответ. Заполняется клиентом в соответствии с id
вызова функции.
string
name
Обязательно. Имя вызываемой функции. Имя должно содержать символы az, AZ, 0-9 или символы подчеркивания и тире. Максимальная длина — 64 символа.
object ( Struct format)
response
Обязательно. Ответ функции в формате JSON-объекта. Вызывающие могут использовать любые ключи по своему выбору, соответствующие синтаксису функции, для возврата выходных данных функции, например, «output», «result» и т. д. В частности, если вызов функции не удалось выполнить, ответ может содержать ключ «error» для возврата информации об ошибке в модель.
parts[]
object ( FunctionResponsePart
)
Необязательные. Упорядоченные Parts
, составляющие ответ функции. Части могут иметь разные типы MIME IANA.
willContinue
boolean
Необязательно. Сигнализирует о продолжении вызова функции и о том, что будут возвращены дополнительные ответы, превращая вызов функции в генератор. Применимо только к вызовам функций NON_BLOCKING, в противном случае игнорируется. Если установлено значение false, последующие ответы не будут учитываться. Разрешается возвращать пустой response
с willContinue=False
чтобы сигнализировать о завершении вызова функции. Это может привести к запуску генерации модели. Чтобы избежать запуска генерации и завершить вызов функции, дополнительно установите scheduling
значение SILENT
.
scheduling
enum ( Scheduling
)
Необязательно. Указывает, как следует планировать ответ в диалоге. Применимо только к вызовам функций NON_BLOCKING, в противном случае игнорируется. По умолчанию WHEN_IDLE.
JSON-представление |
---|
{ "id": string, "name": string, "response": { object }, "parts": [ { object ( |
ФункцияОтветЧасть
Тип данных, содержащий медиа, являющийся частью сообщения FunctionResponse
.
FunctionResponsePart
состоит из данных, имеющих связанный тип данных. FunctionResponsePart
может содержать только один из допустимых типов в FunctionResponsePart.data
.
FunctionResponsePart
должен иметь фиксированный тип IANA MIME, определяющий тип и подтип носителя, если поле inlineData
заполнено необработанными байтами.
Union type
data
data
могут быть только одними из следующих: inlineData
object ( FunctionResponseBlob
)
Встроенные медиа-байты.
JSON-представление |
---|
{
// data
"inlineData": {
object ( |
ФункцияResponseBlob
Необработанные медиа-байты для ответа функции.
Текст не следует отправлять в виде необработанных байтов, используйте поле «FunctionResponse.response».
string
mimeType
Стандартный тип MIME IANA для исходных данных. Примеры: - image/png - image/jpeg. Если указан неподдерживаемый тип MIME, будет возвращена ошибка. Полный список поддерживаемых типов см. в разделе «Поддерживаемые форматы файлов» .
string ( bytes format)
data
Необработанные байты для медиаформатов.
Строка в кодировке base64.
JSON-представление |
---|
{ "mimeType": string, "data": string } |
Планирование
Указывает, как следует планировать ответ в разговоре.
Перечисления | |
---|---|
SCHEDULING_UNSPECIFIED | Это значение не используется. |
SILENT | Только добавляйте результат в контекст беседы, не прерывайте и не запускайте генерацию. |
WHEN_IDLE | Добавьте результат в контекст беседы и подсказывайте, как сгенерировать вывод, не прерывая текущую генерацию. |
INTERRUPT | Добавить результат в контекст разговора, прервать текущую генерацию и предложить сгенерировать вывод. |
FileData
Данные на основе URI.
string
mimeType
Необязательно. Стандартный тип MIME IANA для исходных данных.
string
fileUri
Обязательно. URI.
JSON-представление |
---|
{ "mimeType": string, "fileUri": string } |
ИсполняемыйКод
Код, сгенерированный моделью, предназначенный для выполнения, и результат, возвращаемый модели.
Генерируется только при использовании инструмента CodeExecution
, в котором код будет автоматически выполнен, а также будет сгенерирован соответствующий CodeExecutionResult
.
language
enum ( Language
)
Обязательно. Язык программирования code
.
code
string
Обязательно. Код для выполнения.
JSON-представление |
---|
{
"language": enum ( |
Язык
Поддерживаемые языки программирования для сгенерированного кода.
Перечисления | |
---|---|
LANGUAGE_UNSPECIFIED | Язык не указан. Это значение не следует использовать. |
PYTHON | Python >= 3.10, с доступными numpy и simpy. |
CodeExecutionResult
Результат выполнения ExecutableCode
.
Генерируется только при использовании CodeExecution
и всегда следует за part
содержащей ExecutableCode
.
outcome
enum ( Outcome
)
Обязательно. Результат выполнения кода.
output
string
Необязательно. Содержит stdout при успешном выполнении кода, stderr или другое описание в противном случае.
JSON-представление |
---|
{
"outcome": enum ( |
Исход
Перечисление возможных результатов выполнения кода.
Перечисления | |
---|---|
OUTCOME_UNSPECIFIED | Статус не указан. Это значение не следует использовать. |
OUTCOME_OK | Выполнение кода завершено успешно. |
OUTCOME_FAILED | Выполнение кода завершено, но с ошибкой. stderr должен содержать причину. |
OUTCOME_DEADLINE_EXCEEDED | Выполнение кода заняло слишком много времени и было отменено. Возможно, присутствует частичный вывод, а возможно, и нет. |
ВидеоМетаданные
Метаданные описывают входной видеоконтент.
startOffset
string ( Duration
format)
Необязательно. Начальное смещение видео.
Длительность в секундах, содержащая до девяти знаков после запятой, заканчивается на « s
». Пример: "3.5s"
.
endOffset
string ( Duration
format)
Необязательно. Смещение конца видео.
Длительность в секундах, содержащая до девяти знаков после запятой, заканчивается на « s
». Пример: "3.5s"
.
number
fps
Необязательно. Частота кадров видео, отправляемого модели. Если не указано, по умолчанию будет использоваться значение 1,0. Диапазон кадров в секунду: (0,0, 24,0).
JSON-представление |
---|
{ "startOffset": string, "endOffset": string, "fps": number } |
Инструмент
Подробная информация об инструментах, которые модель может использовать для генерации ответа.
Tool
— это фрагмент кода, который позволяет системе взаимодействовать с внешними системами для выполнения действия или набора действий, выходящих за рамки знаний и области действия модели.
Следующий идентификатор: 12
functionDeclarations[]
object ( FunctionDeclaration
)
Необязательно. Список доступных модели FunctionDeclarations
, которые можно использовать для вызова функций.
Модель или система не выполняет функцию. Вместо этого определённая функция может быть возвращена как FunctionCall
с аргументами на клиентскую сторону для выполнения. Модель может принять решение о вызове подмножества этих функций, заполнив FunctionCall
в ответе. Следующий этап диалога может содержать FunctionResponse
с контекстом генерации Content.role
«function» для следующего этапа модели.
object ( GoogleSearchRetrieval )
googleSearchRetrieval
Необязательно. Инструмент поиска, работающий на основе поиска Google.
object ( CodeExecution )
codeExecution
Необязательно. Позволяет модели выполнять код в процессе генерации.
object ( GoogleSearch )
googleSearch
Необязательно. Тип инструмента GoogleSearch. Инструмент для поддержки поиска Google в модели. Работает на базе Google.
computerUse
object ( ComputerUse
)
Необязательный. Инструмент для поддержки прямого взаимодействия модели с компьютером. При включении он автоматически заполняет объявления функций, специфичные для конкретного компьютера.
object ( UrlContext )
urlContext
Необязательно. Инструмент для поддержки поиска контекста URL.
object ( FileSearch )
fileSearch
Необязательно. Тип инструмента FileSearch. Инструмент для извлечения знаний из корпусов семантического поиска.
JSON-представление |
---|
{ "functionDeclarations": [ { object ( |
Объявление функции
Структурированное представление объявления функции, как определено в спецификации OpenAPI 3.03 . В это объявление включены имя функции и параметры. Это объявление FunctionDeclaration представляет собой блок кода, который может использоваться моделью в качестве Tool
и выполняться клиентом.
string
name
Обязательно. Имя функции. Должно содержать символы az, AZ, 0-9 или символы подчеркивания, двоеточия, точки и тире. Максимальная длина — 64 символа.
string
description
Обязательно. Краткое описание функции.
behavior
enum ( Behavior
)
Необязательно. Задаёт поведение функции. В настоящее время поддерживается только методом BidiGenerateContent.
parameters
object ( Schema
)
Необязательно. Описывает параметры этой функции. Соответствует строке объекта параметра Open API 3.03. Ключ: имя параметра. Имена параметров чувствительны к регистру. Значение схемы: схема, определяющая тип, используемый для параметра.
parametersJsonSchema
value ( Value
format)
Необязательно. Описывает параметры функции в формате JSON-схемы. Схема должна описывать объект, свойства которого являются параметрами функции. Например:
{
"type": "object",
"properties": {
"name": { "type": "string" },
"age": { "type": "integer" }
},
"additionalProperties": false,
"required": ["name", "age"],
"propertyOrdering": ["name", "age"]
}
Это поле является взаимоисключающим с parameters
.
response
object ( Schema
)
Необязательно. Описывает выходные данные этой функции в формате схемы JSON. Соответствует объекту ответа Open API 3.03. Схема определяет тип, используемый для значения ответа функции.
responseJsonSchema
value ( Value
format)
Необязательно. Описывает выходные данные этой функции в формате схемы JSON. Значение, указанное в схеме, является значением ответа функции.
Это поле является взаимоисключающим с response
.
Схема
Объект Schema
позволяет определять типы входных и выходных данных. Эти типы могут быть объектами, а также примитивами и массивами. Представляет собой выбранное подмножество объекта схемы OpenAPI 3.0 .
type
enum ( Type
)
Обязательно. Тип данных.
string
format
Необязательно. Формат данных. Допускается любое значение, но большинство из них не активируют какую-либо специальную функциональность.
string
title
Необязательно. Название схемы.
string
description
Необязательно. Краткое описание параметра. Может содержать примеры использования. Описание параметра можно отформатировать в формате Markdown.
boolean
nullable
Необязательно. Указывает, может ли значение быть нулевым.
enum[]
string
Необязательно. Возможные значения элемента Type.STRING в формате enum. Например, мы можем определить Enum Direction следующим образом: {type:STRING, format:enum, enum:["EAST", NORTH", "SOUTH", "WEST"]}
string ( int64 format)
maxItems
Необязательно. Максимальное количество элементов для Type.ARRAY.
string ( int64 format)
minItems
Необязательно. Минимальное количество элементов для Type.ARRAY.
properties
map (key: string, value: object ( Schema
))
Необязательно. Свойства типа.OBJECT.
Объект, содержащий список пар "key": value
. Пример: { "name": "wrench", "mass": "1.3kg", "count": "3" }
.
required[]
string
Необязательно. Обязательные свойства Type.OBJECT.
string ( int64 format)
minProperties
Необязательно. Минимальное количество свойств для Type.OBJECT.
string ( int64 format)
maxProperties
Необязательно. Максимальное количество свойств для Type.OBJECT.
minLength
string ( int64 format)
Необязательно. ПОЛЯ СХЕМЫ ДЛЯ ТИПА STRING Минимальная длина Type.STRING
maxLength
string ( int64 format)
Необязательно. Максимальная длина Type.STRING
string
pattern
Необязательно. Шаблон Type.STRING для ограничения строки регулярным выражением.
example
value ( Value
format)
Необязательно. Пример объекта. Заполняется только в том случае, если объект является корневым.
anyOf[]
object ( Schema
)
Необязательно. Значение должно быть проверено по любой (одной или нескольким) подсхемам в списке.
propertyOrdering[]
string
Необязательно. Порядок свойств. Нестандартное поле в спецификации Open API. Используется для определения порядка свойств в ответе.
default
value ( Value
format)
Необязательное. Значение поля по умолчанию. Согласно схеме JSON, это поле предназначено для генераторов документации и не влияет на валидацию. Поэтому оно включено сюда и игнорируется, чтобы разработчики, отправляющие схемы с полем default
не получали ошибок неизвестного поля.
items
object ( Schema
)
Необязательно. Схема элементов Type.ARRAY.
minimum
number
Необязательно. ПОЛЯ СХЕМЫ ДЛЯ ТИПА INTEGER и NUMBER Минимальное значение Type.INTEGER и Type.NUMBER
maximum
number
Необязательно. Максимальное значение Type.INTEGER и Type.NUMBER.
JSON-представление |
---|
{ "type": enum ( |
Тип
Тип содержит список типов данных OpenAPI, как определено в https://spec.openapis.org/oas/v3.0.3#data-types
Перечисления | |
---|---|
TYPE_UNSPECIFIED | Не указано, не следует использовать. |
STRING | Тип строки. |
NUMBER | Тип числа. |
INTEGER | Целочисленный тип. |
BOOLEAN | Булевский тип. |
ARRAY | Тип массива. |
OBJECT | Тип объекта. |
NULL | Нулевой тип. |
Поведение
Определяет поведение функции. По умолчанию — BLOCKING
.
Перечисления | |
---|---|
UNSPECIFIED | Это значение не используется. |
BLOCKING | Если установлено, система будет ждать ответа функции, прежде чем продолжить разговор. |
NON_BLOCKING | Если установлено, система не будет дожидаться ответа функции. Вместо этого она будет пытаться обрабатывать ответы функций по мере их поступления, поддерживая при этом диалог между пользователем и моделью. |
GoogleSearchRetrieval
Инструмент для извлечения общедоступных веб-данных для заземления, работающий на базе Google.
object ( DynamicRetrievalConfig )
dynamicRetrievalConfig
Задает конфигурацию динамического извлечения для заданного источника.
JSON-представление |
---|
{
"dynamicRetrievalConfig": {
object ( |
DynamicRetrievalConfig
Описывает возможности настройки динамического поиска.
mode
enum ( Mode
)
Режим предиктора, который будет использоваться при динамическом поиске.
dynamicThreshold
number
Пороговое значение, используемое при динамическом поиске. Если не задано, используется системное значение по умолчанию.
JSON-представление |
---|
{
"mode": enum ( |
Режим
Режим предиктора, который будет использоваться при динамическом поиске.
Перечисления | |
---|---|
MODE_UNSPECIFIED | Всегда запускайте извлечение. |
MODE_DYNAMIC | Запускайте извлечение только тогда, когда система решит, что это необходимо. |
CodeExecution
Этот тип не имеет полей.
Инструмент, который выполняет код, сгенерированный моделью, и автоматически возвращает результат модели.
См. также ExecutableCode
и CodeExecutionResult
, которые генерируются только при использовании этого инструмента.
GoogleSearch
Тип инструмента GoogleSearch. Инструмент для поддержки поиска Google в модели. Работает на базе Google.
object ( Interval )
timeRangeFilter
Необязательно. Фильтрация результатов поиска по определённому временному диапазону. Если клиенты указали время начала, им необходимо указать время окончания (и наоборот).
JSON-представление |
---|
{
"timeRangeFilter": {
object ( |
Интервал
Представляет временной интервал, закодированный как начальная метка времени (включительно) и конечная метка времени (исключая).
Начало должно быть меньше или равно концу. Если начало равно концу, интервал пустой (не соответствует ни одному времени). Если ни начало, ни конец не указаны, интервал соответствует любому времени.
startTime
string ( Timestamp
format)
Необязательно. Начало интервала включено.
Если указано, то соответствующая этому интервалу временная метка должна быть такой же или более поздней.
Использует RFC 3339, согласно которому сгенерированный вывод всегда будет нормализован по оси Z и содержать 0, 3, 6 или 9 знаков после запятой. Также допускаются смещения, отличные от «Z». Примеры: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
или "2014-10-02T15:01:23+05:30"
.
endTime
string ( Timestamp
format)
Необязательно. Исключительный конец интервала.
Если указано, то соответствующая этому интервалу временная метка должна быть до конца.
Использует RFC 3339, согласно которому сгенерированный вывод всегда будет нормализован по оси Z и содержать 0, 3, 6 или 9 знаков после запятой. Также допускаются смещения, отличные от «Z». Примеры: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
или "2014-10-02T15:01:23+05:30"
.
JSON-представление |
---|
{ "startTime": string, "endTime": string } |
ComputerUse
Тип инструмента «Используйте компьютер».
environment
enum ( Environment
)
Обязательно. Среда, в которой будет осуществляться эксплуатация.
string
excludedPredefinedFunctions[]
Необязательно. По умолчанию предопределённые функции включаются в финальный вызов модели. Некоторые из них можно явно исключить из автоматического включения. Это может служить двум целям: 1. Использование более ограниченного/иного пространства действий. 2. Улучшение определений/инструкций предопределённых функций.
JSON-представление |
---|
{
"environment": enum ( |
Среда
Представляет собой рабочую среду, например веб-браузер.
Перечисления | |
---|---|
ENVIRONMENT_UNSPECIFIED | По умолчанию используется браузер. |
ENVIRONMENT_BROWSER | Работает в веб-браузере. |
UrlContext
Этот тип не имеет полей.
Инструмент для поддержки поиска контекста URL.
FileSearch
Инструмент FileSearch для извлечения информации из корпусов семантического поиска. Файлы импортируются в корпусы семантического поиска с помощью API ImportFile.
object ( RetrievalResource )
retrievalResources[]
Обязательно. Ресурсы семантического поиска. В настоящее время поддерживается только один корпус. В будущем мы можем добавить поддержку нескольких корпусов.
object ( RetrievalConfig )
retrievalConfig
Необязательно. Конфигурация для извлечения.
JSON-представление |
---|
{ "retrievalResources": [ { object ( |
RetrievalResource
Ресурс семантического поиска, из которого следует извлечь информацию.
string
ragStoreName
Обязательно. Имя семантического поискового ресурса, из которого нужно извлечь данные. Пример: ragStores/my-rag-store-123
JSON-представление |
---|
{ "ragStoreName": string } |
RetrievalConfig
Конфигурация семантического поиска.
metadataFilter
string
Необязательно. Фильтр метаданных для применения к документам и фрагментам семантического поиска.
topK
integer
Необязательно. Количество семантических фрагментов для извлечения.
JSON-представление |
---|
{ "metadataFilter": string, "topK": integer } |
ToolConfig
Конфигурация инструмента, содержащая параметры для указания использования Tool
в запросе.
object ( FunctionCallingConfig )
functionCallingConfig
Необязательно. Функция, вызывающая конфигурацию.
JSON-представление |
---|
{
"functionCallingConfig": {
object ( |
FunctionCallingConfig
Конфигурация для указания поведения вызова функций.
mode
enum ( Mode
)
Необязательный параметр. Указывает режим, в котором должен выполняться вызов функции. Если параметр не указан, по умолчанию будет установлено значение AUTO.
string
allowedFunctionNames[]
Необязательный. Набор имён функций, который, если указан, ограничивает функции, вызываемые моделью.
Этот параметр следует устанавливать только в том случае, если режим имеет значение ANY или VALIDATED. Имена функций должны соответствовать [FunctionDeclaration.name]. Если этот параметр установлен, модель будет предсказывать вызов функции только на основе разрешённых имён функций.
JSON-представление |
---|
{
"mode": enum ( |
Режим
Определяет поведение выполнения для вызова функции путем определения режима выполнения.
Перечисления | |
---|---|
MODE_UNSPECIFIED | Не указан режим вызова функции. Это значение не следует использовать. |
AUTO | Поведение модели по умолчанию: модель решает предсказать либо вызов функции, либо ответ на естественном языке. |
ANY | Модель ограничена тем, что всегда предсказывает только вызов функции. Если задано "allowedFunctionNames", то предсказанным вызовом функции будет любое из "allowedFunctionNames", в противном случае предсказанным вызовом функции будет любое из предоставленных "functionDeclarations". |
NONE | Модель не предскажет ни одного вызова функции. Поведение модели такое же, как и без объявления функций. |
VALIDATED | Модель решает предсказать либо вызов функции, либо ответ на естественном языке, но будет проверять вызовы функций с ограниченным декодированием. Если задано "allowedFunctionNames", предсказанный вызов функции будет ограничен любым из "allowedFunctionNames", в противном случае предсказанный вызов функции будет любым из предоставленных "functionDeclarations". |
ИспользованиеМетаданных
Метаданные об использовании кэшированного контента.
totalTokenCount
integer
Общее количество токенов, потребляемых кэшированным контентом.
JSON-представление |
---|
{ "totalTokenCount": integer } |
Кэширование контекста позволяет сохранять и повторно использовать предварительно вычисленные входные токены, которые вы хотите использовать повторно, например, при постановке разных вопросов об одном и том же медиафайле. Это может привести к экономии средств и повышению скорости, в зависимости от использования. Подробное введение см. в руководстве по кэшированию контекста .
Метод: cachedContents.create
Создает ресурс CachedContent.
Конечная точка
постhttps: / /generativelanguage.googleapis.com /v1beta /cachedContents
Текст запроса
Тело запроса содержит экземпляр CachedContent
.
contents[]
object ( Content
)
Необязательно. Только ввод. Неизменяемо. Содержимое для кэширования.
tools[]
object ( Tool
)
Необязательный. Только входные данные. Неизменяемый. Список Tools
модель может использовать для генерации следующего ответа.
expiration
Union type
expiration
может быть только одним из следующих: expireTime
string ( Timestamp
format)
Временная метка в формате UTC, когда ресурс считается истёкшим. Она всегда указывается на выходе, независимо от того, что было отправлено на входе.
Использует RFC 3339, согласно которому сгенерированный вывод всегда будет нормализован по оси Z и содержать 0, 3, 6 или 9 знаков после запятой. Также допускаются смещения, отличные от «Z». Примеры: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
или "2014-10-02T15:01:23+05:30"
.
ttl
string ( Duration
format)
Только ввод. Новый TTL для этого ресурса, только ввод.
Длительность в секундах, содержащая до девяти знаков после запятой, заканчивается на « s
». Пример: "3.5s"
.
string
displayName
Необязательно. Неизменяемо. Созданное пользователем осмысленное отображаемое имя кэшированного контента. Максимум 128 символов Unicode.
string
model
Обязательно. Неизменяемо. Имя Model
, используемой для кэшированного контента. Формат: models/{model}
object ( Content )
systemInstruction
Необязательно. Только ввод. Неизменяемо. Системная инструкция, заданная разработчиком. В настоящее время только текст.
toolConfig
object ( ToolConfig
)
Optional. Input only. Immutable. Tool config. This config is shared for all tools.
Пример запроса
Базовый
Питон
Node.js
Идти
Оболочка
От имени
Питон
Node.js
Идти
From chat
Питон
Node.js
Идти
Тело ответа
If successful, the response body contains a newly created instance of CachedContent
.
Method: cachedContents.list
Lists CachedContents.
Конечная точка
gethttps: / /generativelanguage.googleapis.com /v1beta /cachedContents
Параметры запроса
pageSize
integer
Optional. The maximum number of cached contents to return. The service may return fewer than this value. If unspecified, some default (under maximum) number of items will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
pageToken
string
Optional. A page token, received from a previous cachedContents.list
call. Provide this to retrieve the subsequent page.
When paginating, all other parameters provided to cachedContents.list
must match the call that provided the page token.
Текст запроса
Тело запроса должно быть пустым.
Тело ответа
Response with CachedContents list.
В случае успеха тело ответа содержит данные со следующей структурой:
cachedContents[]
object ( CachedContent
)
List of cached contents.
nextPageToken
string
A token, which can be sent as pageToken
to retrieve the next page. If this field is omitted, there are no subsequent pages.
JSON-представление |
---|
{
"cachedContents": [
{
object ( |
Method: cachedContents.get
Reads CachedContent resource.
Конечная точка
gethttps: / /generativelanguage.googleapis.com /v1beta /{name=cachedContents /*}
Параметры пути
string
name
Required. The resource name referring to the content cache entry. Format: cachedContents/{id}
It takes the form cachedContents/{cachedcontent}
.
Текст запроса
Тело запроса должно быть пустым.
Пример запроса
Питон
Node.js
Идти
Оболочка
Тело ответа
If successful, the response body contains an instance of CachedContent
.
Method: cachedContents.patch
Updates CachedContent resource (only expiration is updatable).
Конечная точка
patchhttps: / /generativelanguage.googleapis.com /v1beta /{cachedContent.name=cachedContents /*}
PATCH https://generativelanguage.googleapis.com/v1beta/{cachedContent.name=cachedContents/*}
Параметры пути
cachedContent.name
string
Output only. Identifier. The resource name referring to the cached content. Format: cachedContents/{id}
It takes the form cachedContents/{cachedcontent}
.
Параметры запроса
updateMask
string ( FieldMask
format)
The list of fields to update.
This is a comma-separated list of fully qualified names of fields. Example: "user.displayName,photo"
.
Текст запроса
The request body contains an instance of CachedContent
.
expiration
Union type
expiration
can be only one of the following: expireTime
string ( Timestamp
format)
Timestamp in UTC of when this resource is considered expired. This is always provided on output, regardless of what was sent on input.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
ttl
string ( Duration
format)
Input only. New TTL for this resource, input only.
A duration in seconds with up to nine fractional digits, ending with ' s
'. Example: "3.5s"
.
Пример запроса
Питон
Node.js
Идти
Оболочка
Тело ответа
If successful, the response body contains an instance of CachedContent
.
Method: cachedContents.delete
Deletes CachedContent resource.
Конечная точка
deletehttps: / /generativelanguage.googleapis.com /v1beta /{name=cachedContents /*}
Параметры пути
string
name
Required. The resource name referring to the content cache entry Format: cachedContents/{id}
It takes the form cachedContents/{cachedcontent}
.
Текст запроса
Тело запроса должно быть пустым.
Пример запроса
Питон
Node.js
Идти
Оболочка
Тело ответа
В случае успеха тело ответа представляет собой пустой объект JSON.
REST Resource: cachedContents
- Resource: CachedContent
- Содержание
- Часть
- Клякса
- FunctionCall
- FunctionResponse
- ФункцияОтветЧасть
- FunctionResponseBlob
- Планирование
- FileData
- ExecutableCode
- Язык
- CodeExecutionResult
- Исход
- ВидеоМетаданные
- Инструмент
- Объявление функции
- Схема
- Тип
- Поведение
- GoogleSearchRetrieval
- DynamicRetrievalConfig
- Режим
- CodeExecution
- GoogleSearch
- Интервал
- ComputerUse
- Среда
- UrlContext
- FileSearch
- RetrievalResource
- RetrievalConfig
- ToolConfig
- FunctionCallingConfig
- Режим
- ИспользованиеМетаданных
- Методы
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.
contents[]
object ( Content
)
Optional. Input only. Immutable. The content to cache.
tools[]
object ( Tool
)
Optional. Input only. Immutable. A list of Tools
the model may use to generate the next response
createTime
string ( Timestamp
format)
Output only. Creation time of the cache entry.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
updateTime
string ( Timestamp
format)
Output only. When the cache entry was last updated in UTC time.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
usageMetadata
object ( UsageMetadata
)
Output only. Metadata on the usage of the cached content.
expiration
Union type
expiration
can be only one of the following: expireTime
string ( Timestamp
format)
Timestamp in UTC of when this resource is considered expired. This is always provided on output, regardless of what was sent on input.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
ttl
string ( Duration
format)
Input only. New TTL for this resource, input only.
A duration in seconds with up to nine fractional digits, ending with ' s
'. Example: "3.5s"
.
string
name
Output only. Identifier. The resource name referring to the cached content. Format: cachedContents/{id}
displayName
string
Optional. Immutable. The user-generated meaningful display name of the cached content. Maximum 128 Unicode characters.
model
string
Required. Immutable. The name of the Model
to use for cached content Format: models/{model}
systemInstruction
object ( Content
)
Optional. Input only. Immutable. Developer set system instruction. Currently text only.
toolConfig
object ( ToolConfig
)
Optional. Input only. Immutable. Tool config. This config is shared for all tools.
JSON-представление |
---|
{ "contents": [ { object ( |
Содержание
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.
parts[]
object ( Part
)
Ordered Parts
that constitute a single message. Parts may have different MIME types.
role
string
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.
JSON-представление |
---|
{
"parts": [
{
object ( |
Часть
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.
thought
boolean
Optional. Indicates if the part is thought from the model.
thoughtSignature
string ( bytes format)
Optional. An opaque signature for the thought so it can be reused in subsequent requests.
A base64-encoded string.
partMetadata
object ( Struct
format)
Custom metadata associated with the Part. Agents using genai.Part as content representation may need to keep track of the additional information. For example it can be name of a file/source from which the Part originates or a way to multiplex multiple Part streams.
data
Union type
data
can be only one of the following:text
string
Inline text.
inlineData
object ( Blob
)
Inline media bytes.
functionCall
object ( FunctionCall
)
A predicted FunctionCall
returned from the model that contains a string representing the FunctionDeclaration.name
with the arguments and their values.
functionResponse
object ( FunctionResponse
)
The result output of 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.
fileData
object ( FileData
)
URI based data.
executableCode
object ( ExecutableCode
)
Code generated by the model that is meant to be executed.
codeExecutionResult
object ( CodeExecutionResult
)
Result of executing the ExecutableCode
.
metadata
Union type
metadata
can be only one of the following:videoMetadata
object ( VideoMetadata
)
Optional. Video metadata. The metadata should only be specified while the video data is presented in inlineData or fileData.
JSON-представление |
---|
{ "thought": boolean, "thoughtSignature": string, "partMetadata": { object }, // data "text": string, "inlineData": { object ( |
Клякса
Raw media bytes.
Text should not be sent as raw bytes, use the 'text' field.
mimeType
string
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
string ( bytes format)
Raw bytes for media formats.
A base64-encoded string.
JSON-представление |
---|
{ "mimeType": string, "data": string } |
FunctionCall
A predicted FunctionCall
returned from the model that contains a string representing the FunctionDeclaration.name
with the arguments and their values.
string
id
Optional. The unique id of the function call. If populated, the client to execute the functionCall
and return the response with the matching id
.
string
name
Required. The name of the function to call. Must be az, AZ, 0-9, or contain underscores and dashes, with a maximum length of 64.
args
object ( Struct
format)
Optional. The function parameters and values in JSON object format.
JSON-представление |
---|
{ "id": string, "name": string, "args": { object } } |
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 a FunctionCall
made based on model prediction.
string
id
Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call id
.
string
name
Required. The name of the function to call. Must be az, AZ, 0-9, or contain underscores and dashes, with a maximum length of 64.
response
object ( Struct
format)
Required. The function response in JSON object format. Callers can use any keys of their choice that fit the function's syntax to return the function output, eg "output", "result", etc. In particular, if the function call failed to execute, the response can have an "error" key to return error details to the model.
parts[]
object ( FunctionResponsePart
)
Optional. Ordered Parts
that constitute a function response. Parts may have different IANA MIME types.
willContinue
boolean
Optional. Signals that function call continues, and more responses will be returned, turning the function call into a generator. Is only applicable to NON_BLOCKING function calls, is ignored otherwise. If set to false, future responses will not be considered. It is allowed to return empty response
with willContinue=False
to signal that the function call is finished. This may still trigger the model generation. To avoid triggering the generation and finish the function call, additionally set scheduling
to SILENT
.
scheduling
enum ( Scheduling
)
Optional. Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE.
JSON-представление |
---|
{ "id": string, "name": string, "response": { object }, "parts": [ { object ( |
ФункцияОтветЧасть
A datatype containing media that is part of a FunctionResponse
message.
A FunctionResponsePart
consists of data which has an associated datatype. A FunctionResponsePart
can only contain one of the accepted types in FunctionResponsePart.data
.
A FunctionResponsePart
must have a fixed IANA MIME type identifying the type and subtype of the media if the inlineData
field is filled with raw bytes.
data
Union type
data
can be only one of the following: inlineData
object ( FunctionResponseBlob
)
Inline media bytes.
JSON-представление |
---|
{
// data
"inlineData": {
object ( |
FunctionResponseBlob
Raw media bytes for function response.
Text should not be sent as raw bytes, use the 'FunctionResponse.response' field.
mimeType
string
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
string ( bytes format)
Raw bytes for media formats.
A base64-encoded string.
JSON-представление |
---|
{ "mimeType": string, "data": string } |
Планирование
Specifies how the response should be scheduled in the conversation.
Перечисления | |
---|---|
SCHEDULING_UNSPECIFIED | This value is unused. |
SILENT | Only add the result to the conversation context, do not interrupt or trigger generation. |
WHEN_IDLE | Add the result to the conversation context, and prompt to generate output without interrupting ongoing generation. |
INTERRUPT | Add the result to the conversation context, interrupt ongoing generation and prompt to generate output. |
FileData
URI based data.
mimeType
string
Optional. The IANA standard MIME type of the source data.
fileUri
string
Required. URI.
JSON-представление |
---|
{ "mimeType": string, "fileUri": string } |
ExecutableCode
Code generated by the model that is meant to be executed, and the result returned to the model.
Only generated when using the CodeExecution
tool, in which the code will be automatically executed, and a corresponding CodeExecutionResult
will also be generated.
language
enum ( Language
)
Required. Programming language of the code
.
code
string
Required. The code to be executed.
JSON-представление |
---|
{
"language": enum ( |
Язык
Supported programming languages for the generated code.
Перечисления | |
---|---|
LANGUAGE_UNSPECIFIED | Unspecified language. This value should not be used. |
PYTHON | Python >= 3.10, with numpy and simpy available. |
CodeExecutionResult
Result of executing the ExecutableCode
.
Only generated when using the CodeExecution
, and always follows a part
containing the ExecutableCode
.
outcome
enum ( Outcome
)
Required. Outcome of the code execution.
output
string
Optional. Contains stdout when code execution is successful, stderr or other description otherwise.
JSON-представление |
---|
{
"outcome": enum ( |
Исход
Enumeration of possible outcomes of the code execution.
Перечисления | |
---|---|
OUTCOME_UNSPECIFIED | Unspecified status. This value should not be used. |
OUTCOME_OK | Code execution completed successfully. |
OUTCOME_FAILED | Code execution finished but with a failure. stderr should contain the reason. |
OUTCOME_DEADLINE_EXCEEDED | Code execution ran for too long, and was cancelled. There may or may not be a partial output present. |
ВидеоМетаданные
Metadata describes the input video content.
startOffset
string ( Duration
format)
Optional. The start offset of the video.
A duration in seconds with up to nine fractional digits, ending with ' s
'. Example: "3.5s"
.
endOffset
string ( Duration
format)
Optional. The end offset of the video.
A duration in seconds with up to nine fractional digits, ending with ' s
'. Example: "3.5s"
.
fps
number
Optional. The frame rate of the video sent to the model. If not specified, the default value will be 1.0. The fps range is (0.0, 24.0].
JSON-представление |
---|
{ "startOffset": string, "endOffset": string, "fps": number } |
Инструмент
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.
Next ID: 12
functionDeclarations[]
object ( FunctionDeclaration
)
Optional. A list of FunctionDeclarations
available to the model that can be used for function calling.
The model or system does not execute the function. Instead the defined function may be returned as a FunctionCall
with arguments to the client side for execution. The model may decide to call a subset of these functions by populating FunctionCall
in the response. The next conversation turn may contain a FunctionResponse
with the Content.role
"function" generation context for the next model turn.
googleSearchRetrieval
object ( GoogleSearchRetrieval
)
Optional. Retrieval tool that is powered by Google search.
codeExecution
object ( CodeExecution
)
Optional. Enables the model to execute code as part of generation.
googleSearch
object ( GoogleSearch
)
Optional. GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google.
computerUse
object ( ComputerUse
)
Optional. Tool to support the model interacting directly with the computer. If enabled, it automatically populates computer-use specific Function Declarations.
urlContext
object ( UrlContext
)
Optional. Tool to support URL context retrieval.
fileSearch
object ( FileSearch
)
Optional. FileSearch tool type. Tool to retrieve knowledge from Semantic Retrieval corpora.
JSON-представление |
---|
{ "functionDeclarations": [ { object ( |
Объявление функции
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.
string
name
Required. The name of the function. Must be az, AZ, 0-9, or contain underscores, colons, dots, and dashes, with a maximum length of 64.
string
description
Required. A brief description of the function.
behavior
enum ( Behavior
)
Optional. Specifies the function Behavior. Currently only supported by the BidiGenerateContent method.
parameters
object ( Schema
)
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.
parametersJsonSchema
value ( Value
format)
Optional. Describes the parameters to the function in JSON Schema format. The schema must describe an object where the properties are the parameters to the function. For example:
{
"type": "object",
"properties": {
"name": { "type": "string" },
"age": { "type": "integer" }
},
"additionalProperties": false,
"required": ["name", "age"],
"propertyOrdering": ["name", "age"]
}
This field is mutually exclusive with parameters
.
response
object ( Schema
)
Optional. Describes the output from this function in JSON Schema format. Reflects the Open API 3.03 Response Object. The Schema defines the type used for the response value of the function.
responseJsonSchema
value ( Value
format)
Optional. Describes the output from this function in JSON Schema format. The value specified by the schema is the response value of the function.
This field is mutually exclusive with response
.
Схема
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 .
type
enum ( Type
)
Required. Data type.
format
string
Optional. The format of the data. Any value is allowed, but most do not trigger any special functionality.
string
title
Optional. The title of the schema.
string
description
Optional. A brief description of the parameter. This could contain examples of use. Parameter description may be formatted as Markdown.
boolean
nullable
Optional. Indicates if the value may be null.
enum[]
string
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"]}
maxItems
string ( int64 format)
Optional. Maximum number of the elements for Type.ARRAY.
minItems
string ( int64 format)
Optional. Minimum number of the elements for Type.ARRAY.
properties
map (key: string, value: object ( Schema
))
Optional. Properties of Type.OBJECT.
An object containing a list of "key": value
pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }
.
required[]
string
Optional. Required properties of Type.OBJECT.
minProperties
string ( int64 format)
Optional. Minimum number of the properties for Type.OBJECT.
maxProperties
string ( int64 format)
Optional. Maximum number of the properties for Type.OBJECT.
minLength
string ( int64 format)
Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING
maxLength
string ( int64 format)
Optional. Maximum length of the Type.STRING
pattern
string
Optional. Pattern of the Type.STRING to restrict a string to a regular expression.
example
value ( Value
format)
Optional. Example of the object. Will only populated when the object is the root.
anyOf[]
object ( Schema
)
Optional. The value should be validated against any (one or more) of the subschemas in the list.
propertyOrdering[]
string
Optional. The order of the properties. Not a standard field in open api spec. Used to determine the order of the properties in the response.
default
value ( Value
format)
Optional. Default value of the field. Per JSON Schema, this field is intended for documentation generators and doesn't affect validation. Thus it's included here and ignored so that developers who send schemas with a default
field don't get unknown-field errors.
items
object ( Schema
)
Optional. Schema of the elements of Type.ARRAY.
minimum
number
Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the Type.INTEGER and Type.NUMBER
maximum
number
Optional. Maximum value of the Type.INTEGER and Type.NUMBER
JSON-представление |
---|
{ "type": enum ( |
Тип
Type contains the list of OpenAPI data types as defined by https://spec.openapis.org/oas/v3.0.3#data-types
Перечисления | |
---|---|
TYPE_UNSPECIFIED | Not specified, should not be used. |
STRING | String type. |
NUMBER | Number type. |
INTEGER | Целочисленный тип. |
BOOLEAN | Булевский тип. |
ARRAY | Array type. |
OBJECT | Object type. |
NULL | Null type. |
Поведение
Defines the function behavior. Defaults to BLOCKING
.
Перечисления | |
---|---|
UNSPECIFIED | This value is unused. |
BLOCKING | If set, the system will wait to receive the function response before continuing the conversation. |
NON_BLOCKING | If set, the system will not wait to receive the function response. Instead, it will attempt to handle function responses as they become available while maintaining the conversation between the user and the model. |
GoogleSearchRetrieval
Tool to retrieve public web data for grounding, powered by Google.
dynamicRetrievalConfig
object ( DynamicRetrievalConfig
)
Specifies the dynamic retrieval configuration for the given source.
JSON-представление |
---|
{
"dynamicRetrievalConfig": {
object ( |
DynamicRetrievalConfig
Describes the options to customize dynamic retrieval.
mode
enum ( Mode
)
The mode of the predictor to be used in dynamic retrieval.
dynamicThreshold
number
The threshold to be used in dynamic retrieval. If not set, a system default value is used.
JSON-представление |
---|
{
"mode": enum ( |
Режим
The mode of the predictor to be used in dynamic retrieval.
Перечисления | |
---|---|
MODE_UNSPECIFIED | Always trigger retrieval. |
MODE_DYNAMIC | Run retrieval only when system decides it is necessary. |
CodeExecution
Этот тип не имеет полей.
Tool that executes code generated by the model, and automatically returns the result to the model.
See also ExecutableCode
and CodeExecutionResult
which are only generated when using this tool.
GoogleSearch
GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google.
timeRangeFilter
object ( Interval
)
Optional. Filter search results to a specific time range. If customers set a start time, they must set an end time (and vice versa).
JSON-представление |
---|
{
"timeRangeFilter": {
object ( |
Интервал
Представляет временной интервал, закодированный как начальная метка времени (включительно) и конечная метка времени (исключая).
Начало должно быть меньше или равно концу. Если начало равно концу, интервал пустой (не соответствует ни одному времени). Если ни начало, ни конец не указаны, интервал соответствует любому времени.
startTime
string ( Timestamp
format)
Необязательно. Начало интервала включено.
Если указано, то соответствующая этому интервалу временная метка должна быть такой же или более поздней.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
endTime
string ( Timestamp
format)
Необязательно. Исключительный конец интервала.
Если указано, то соответствующая этому интервалу временная метка должна быть до конца.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
JSON-представление |
---|
{ "startTime": string, "endTime": string } |
ComputerUse
Computer Use tool type.
environment
enum ( Environment
)
Required. The environment being operated.
excludedPredefinedFunctions[]
string
Optional. By default, predefined functions are included in the final model call. Some of them can be explicitly excluded from being automatically included. This can serve two purposes: 1. Using a more restricted / different action space. 2. Improving the definitions / instructions of predefined functions.
JSON-представление |
---|
{
"environment": enum ( |
Среда
Represents the environment being operated, such as a web browser.
Перечисления | |
---|---|
ENVIRONMENT_UNSPECIFIED | Defaults to browser. |
ENVIRONMENT_BROWSER | Operates in a web browser. |
UrlContext
Этот тип не имеет полей.
Tool to support URL context retrieval.
FileSearch
The FileSearch tool that retrieves knowledge from Semantic Retrieval corpora. Files are imported to Semantic Retrieval corpora using the ImportFile API.
retrievalResources[]
object ( RetrievalResource
)
Required. Semantic retrieval resources to retrieve from. Currently only supports one corpus. In the future we may open up multiple corpora support.
retrievalConfig
object ( RetrievalConfig
)
Optional. The configuration for the retrieval.
JSON-представление |
---|
{ "retrievalResources": [ { object ( |
RetrievalResource
The semantic retrieval resource to retrieve from.
ragStoreName
string
Required. The name of the semantic retrieval resource to retrieve from. Example: ragStores/my-rag-store-123
JSON-представление |
---|
{ "ragStoreName": string } |
RetrievalConfig
Semantic retrieval configuration.
metadataFilter
string
Optional. Metadata filter to apply to the semantic retrieval documents and chunks.
topK
integer
Optional. The number of semantic retrieval chunks to retrieve.
JSON-представление |
---|
{ "metadataFilter": string, "topK": integer } |
ToolConfig
The Tool configuration containing parameters for specifying Tool
use in the request.
functionCallingConfig
object ( FunctionCallingConfig
)
Optional. Function calling config.
JSON-представление |
---|
{
"functionCallingConfig": {
object ( |
FunctionCallingConfig
Configuration for specifying function calling behavior.
mode
enum ( Mode
)
Optional. Specifies the mode in which function calling should execute. If unspecified, the default value will be set to AUTO.
allowedFunctionNames[]
string
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 or VALIDATED. Function names should match [FunctionDeclaration.name]. When set, model will predict a function call from only allowed function names.
JSON-представление |
---|
{
"mode": enum ( |
Режим
Defines the execution behavior for function calling by defining the execution mode.
Перечисления | |
---|---|
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. |
VALIDATED | Model decides to predict either a function call or a natural language response, but will validate function calls with constrained decoding. 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". |
ИспользованиеМетаданных
Metadata on the usage of the cached content.
totalTokenCount
integer
Total number of tokens that the cached content consumes.
JSON-представление |
---|
{ "totalTokenCount": integer } |
Context caching allows you to save and reuse precomputed input tokens that you wish to use repeatedly, for example when asking different questions about the same media file. This can lead to cost and speed savings, depending on the usage. For a detailed introduction, see the Context caching guide.
Method: cachedContents.create
Creates CachedContent resource.
Конечная точка
posthttps: / /generativelanguage.googleapis.com /v1beta /cachedContents
Текст запроса
The request body contains an instance of CachedContent
.
contents[]
object ( Content
)
Optional. Input only. Immutable. The content to cache.
tools[]
object ( Tool
)
Optional. Input only. Immutable. A list of Tools
the model may use to generate the next response
expiration
Union type
expiration
can be only one of the following: expireTime
string ( Timestamp
format)
Timestamp in UTC of when this resource is considered expired. This is always provided on output, regardless of what was sent on input.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
ttl
string ( Duration
format)
Input only. New TTL for this resource, input only.
A duration in seconds with up to nine fractional digits, ending with ' s
'. Example: "3.5s"
.
displayName
string
Optional. Immutable. The user-generated meaningful display name of the cached content. Maximum 128 Unicode characters.
model
string
Required. Immutable. The name of the Model
to use for cached content Format: models/{model}
systemInstruction
object ( Content
)
Optional. Input only. Immutable. Developer set system instruction. Currently text only.
toolConfig
object ( ToolConfig
)
Optional. Input only. Immutable. Tool config. This config is shared for all tools.
Пример запроса
Базовый
Питон
Node.js
Идти
Оболочка
От имени
Питон
Node.js
Идти
From chat
Питон
Node.js
Идти
Тело ответа
If successful, the response body contains a newly created instance of CachedContent
.
Method: cachedContents.list
Lists CachedContents.
Конечная точка
gethttps: / /generativelanguage.googleapis.com /v1beta /cachedContents
Параметры запроса
pageSize
integer
Optional. The maximum number of cached contents to return. The service may return fewer than this value. If unspecified, some default (under maximum) number of items will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
pageToken
string
Optional. A page token, received from a previous cachedContents.list
call. Provide this to retrieve the subsequent page.
When paginating, all other parameters provided to cachedContents.list
must match the call that provided the page token.
Текст запроса
Тело запроса должно быть пустым.
Тело ответа
Response with CachedContents list.
В случае успеха тело ответа содержит данные со следующей структурой:
cachedContents[]
object ( CachedContent
)
List of cached contents.
nextPageToken
string
A token, which can be sent as pageToken
to retrieve the next page. If this field is omitted, there are no subsequent pages.
JSON-представление |
---|
{
"cachedContents": [
{
object ( |
Method: cachedContents.get
Reads CachedContent resource.
Конечная точка
gethttps: / /generativelanguage.googleapis.com /v1beta /{name=cachedContents /*}
Параметры пути
string
name
Required. The resource name referring to the content cache entry. Format: cachedContents/{id}
It takes the form cachedContents/{cachedcontent}
.
Текст запроса
Тело запроса должно быть пустым.
Пример запроса
Питон
Node.js
Идти
Оболочка
Тело ответа
If successful, the response body contains an instance of CachedContent
.
Method: cachedContents.patch
Updates CachedContent resource (only expiration is updatable).
Конечная точка
patchhttps: / /generativelanguage.googleapis.com /v1beta /{cachedContent.name=cachedContents /*}
PATCH https://generativelanguage.googleapis.com/v1beta/{cachedContent.name=cachedContents/*}
Параметры пути
cachedContent.name
string
Output only. Identifier. The resource name referring to the cached content. Format: cachedContents/{id}
It takes the form cachedContents/{cachedcontent}
.
Параметры запроса
updateMask
string ( FieldMask
format)
The list of fields to update.
This is a comma-separated list of fully qualified names of fields. Example: "user.displayName,photo"
.
Текст запроса
The request body contains an instance of CachedContent
.
expiration
Union type
expiration
can be only one of the following: expireTime
string ( Timestamp
format)
Timestamp in UTC of when this resource is considered expired. This is always provided on output, regardless of what was sent on input.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
ttl
string ( Duration
format)
Input only. New TTL for this resource, input only.
A duration in seconds with up to nine fractional digits, ending with ' s
'. Example: "3.5s"
.
Пример запроса
Питон
Node.js
Идти
Оболочка
Тело ответа
If successful, the response body contains an instance of CachedContent
.
Method: cachedContents.delete
Deletes CachedContent resource.
Конечная точка
deletehttps: / /generativelanguage.googleapis.com /v1beta /{name=cachedContents /*}
Параметры пути
string
name
Required. The resource name referring to the content cache entry Format: cachedContents/{id}
It takes the form cachedContents/{cachedcontent}
.
Текст запроса
Тело запроса должно быть пустым.
Пример запроса
Питон
Node.js
Идти
Оболочка
Тело ответа
В случае успеха тело ответа представляет собой пустой объект JSON.
REST Resource: cachedContents
- Resource: CachedContent
- Содержание
- Часть
- Клякса
- FunctionCall
- FunctionResponse
- ФункцияОтветЧасть
- FunctionResponseBlob
- Планирование
- FileData
- ExecutableCode
- Язык
- CodeExecutionResult
- Исход
- ВидеоМетаданные
- Инструмент
- Объявление функции
- Схема
- Тип
- Поведение
- GoogleSearchRetrieval
- DynamicRetrievalConfig
- Режим
- CodeExecution
- GoogleSearch
- Интервал
- ComputerUse
- Среда
- UrlContext
- FileSearch
- RetrievalResource
- RetrievalConfig
- ToolConfig
- FunctionCallingConfig
- Режим
- ИспользованиеМетаданных
- Методы
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.
contents[]
object ( Content
)
Optional. Input only. Immutable. The content to cache.
tools[]
object ( Tool
)
Optional. Input only. Immutable. A list of Tools
the model may use to generate the next response
createTime
string ( Timestamp
format)
Output only. Creation time of the cache entry.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
updateTime
string ( Timestamp
format)
Output only. When the cache entry was last updated in UTC time.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
usageMetadata
object ( UsageMetadata
)
Output only. Metadata on the usage of the cached content.
expiration
Union type
expiration
can be only one of the following: expireTime
string ( Timestamp
format)
Timestamp in UTC of when this resource is considered expired. This is always provided on output, regardless of what was sent on input.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
ttl
string ( Duration
format)
Input only. New TTL for this resource, input only.
A duration in seconds with up to nine fractional digits, ending with ' s
'. Example: "3.5s"
.
string
name
Output only. Identifier. The resource name referring to the cached content. Format: cachedContents/{id}
displayName
string
Optional. Immutable. The user-generated meaningful display name of the cached content. Maximum 128 Unicode characters.
model
string
Required. Immutable. The name of the Model
to use for cached content Format: models/{model}
systemInstruction
object ( Content
)
Optional. Input only. Immutable. Developer set system instruction. Currently text only.
toolConfig
object ( ToolConfig
)
Optional. Input only. Immutable. Tool config. This config is shared for all tools.
JSON-представление |
---|
{ "contents": [ { object ( |
Содержание
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.
parts[]
object ( Part
)
Ordered Parts
that constitute a single message. Parts may have different MIME types.
role
string
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.
JSON-представление |
---|
{
"parts": [
{
object ( |
Часть
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.
thought
boolean
Optional. Indicates if the part is thought from the model.
thoughtSignature
string ( bytes format)
Optional. An opaque signature for the thought so it can be reused in subsequent requests.
A base64-encoded string.
partMetadata
object ( Struct
format)
Custom metadata associated with the Part. Agents using genai.Part as content representation may need to keep track of the additional information. For example it can be name of a file/source from which the Part originates or a way to multiplex multiple Part streams.
data
Union type
data
can be only one of the following:text
string
Inline text.
inlineData
object ( Blob
)
Inline media bytes.
functionCall
object ( FunctionCall
)
A predicted FunctionCall
returned from the model that contains a string representing the FunctionDeclaration.name
with the arguments and their values.
functionResponse
object ( FunctionResponse
)
The result output of 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.
fileData
object ( FileData
)
URI based data.
executableCode
object ( ExecutableCode
)
Code generated by the model that is meant to be executed.
codeExecutionResult
object ( CodeExecutionResult
)
Result of executing the ExecutableCode
.
metadata
Union type
metadata
can be only one of the following:videoMetadata
object ( VideoMetadata
)
Optional. Video metadata. The metadata should only be specified while the video data is presented in inlineData or fileData.
JSON-представление |
---|
{ "thought": boolean, "thoughtSignature": string, "partMetadata": { object }, // data "text": string, "inlineData": { object ( |
Клякса
Raw media bytes.
Text should not be sent as raw bytes, use the 'text' field.
mimeType
string
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
string ( bytes format)
Raw bytes for media formats.
A base64-encoded string.
JSON-представление |
---|
{ "mimeType": string, "data": string } |
FunctionCall
A predicted FunctionCall
returned from the model that contains a string representing the FunctionDeclaration.name
with the arguments and their values.
string
id
Optional. The unique id of the function call. If populated, the client to execute the functionCall
and return the response with the matching id
.
string
name
Required. The name of the function to call. Must be az, AZ, 0-9, or contain underscores and dashes, with a maximum length of 64.
args
object ( Struct
format)
Optional. The function parameters and values in JSON object format.
JSON-представление |
---|
{ "id": string, "name": string, "args": { object } } |
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 a FunctionCall
made based on model prediction.
string
id
Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call id
.
string
name
Required. The name of the function to call. Must be az, AZ, 0-9, or contain underscores and dashes, with a maximum length of 64.
response
object ( Struct
format)
Required. The function response in JSON object format. Callers can use any keys of their choice that fit the function's syntax to return the function output, eg "output", "result", etc. In particular, if the function call failed to execute, the response can have an "error" key to return error details to the model.
parts[]
object ( FunctionResponsePart
)
Optional. Ordered Parts
that constitute a function response. Parts may have different IANA MIME types.
willContinue
boolean
Optional. Signals that function call continues, and more responses will be returned, turning the function call into a generator. Is only applicable to NON_BLOCKING function calls, is ignored otherwise. If set to false, future responses will not be considered. It is allowed to return empty response
with willContinue=False
to signal that the function call is finished. This may still trigger the model generation. To avoid triggering the generation and finish the function call, additionally set scheduling
to SILENT
.
scheduling
enum ( Scheduling
)
Optional. Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE.
JSON-представление |
---|
{ "id": string, "name": string, "response": { object }, "parts": [ { object ( |
ФункцияОтветЧасть
A datatype containing media that is part of a FunctionResponse
message.
A FunctionResponsePart
consists of data which has an associated datatype. A FunctionResponsePart
can only contain one of the accepted types in FunctionResponsePart.data
.
A FunctionResponsePart
must have a fixed IANA MIME type identifying the type and subtype of the media if the inlineData
field is filled with raw bytes.
data
Union type
data
can be only one of the following: inlineData
object ( FunctionResponseBlob
)
Inline media bytes.
JSON-представление |
---|
{
// data
"inlineData": {
object ( |
FunctionResponseBlob
Raw media bytes for function response.
Text should not be sent as raw bytes, use the 'FunctionResponse.response' field.
mimeType
string
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
string ( bytes format)
Raw bytes for media formats.
A base64-encoded string.
JSON-представление |
---|
{ "mimeType": string, "data": string } |
Планирование
Specifies how the response should be scheduled in the conversation.
Перечисления | |
---|---|
SCHEDULING_UNSPECIFIED | This value is unused. |
SILENT | Only add the result to the conversation context, do not interrupt or trigger generation. |
WHEN_IDLE | Add the result to the conversation context, and prompt to generate output without interrupting ongoing generation. |
INTERRUPT | Add the result to the conversation context, interrupt ongoing generation and prompt to generate output. |
FileData
URI based data.
mimeType
string
Optional. The IANA standard MIME type of the source data.
fileUri
string
Required. URI.
JSON-представление |
---|
{ "mimeType": string, "fileUri": string } |
ExecutableCode
Code generated by the model that is meant to be executed, and the result returned to the model.
Only generated when using the CodeExecution
tool, in which the code will be automatically executed, and a corresponding CodeExecutionResult
will also be generated.
language
enum ( Language
)
Required. Programming language of the code
.
code
string
Required. The code to be executed.
JSON-представление |
---|
{
"language": enum ( |
Язык
Supported programming languages for the generated code.
Перечисления | |
---|---|
LANGUAGE_UNSPECIFIED | Unspecified language. This value should not be used. |
PYTHON | Python >= 3.10, with numpy and simpy available. |
CodeExecutionResult
Result of executing the ExecutableCode
.
Only generated when using the CodeExecution
, and always follows a part
containing the ExecutableCode
.
outcome
enum ( Outcome
)
Required. Outcome of the code execution.
output
string
Optional. Contains stdout when code execution is successful, stderr or other description otherwise.
JSON-представление |
---|
{
"outcome": enum ( |
Исход
Enumeration of possible outcomes of the code execution.
Перечисления | |
---|---|
OUTCOME_UNSPECIFIED | Unspecified status. This value should not be used. |
OUTCOME_OK | Code execution completed successfully. |
OUTCOME_FAILED | Code execution finished but with a failure. stderr should contain the reason. |
OUTCOME_DEADLINE_EXCEEDED | Code execution ran for too long, and was cancelled. There may or may not be a partial output present. |
ВидеоМетаданные
Metadata describes the input video content.
startOffset
string ( Duration
format)
Optional. The start offset of the video.
A duration in seconds with up to nine fractional digits, ending with ' s
'. Example: "3.5s"
.
endOffset
string ( Duration
format)
Optional. The end offset of the video.
A duration in seconds with up to nine fractional digits, ending with ' s
'. Example: "3.5s"
.
fps
number
Optional. The frame rate of the video sent to the model. If not specified, the default value will be 1.0. The fps range is (0.0, 24.0].
JSON-представление |
---|
{ "startOffset": string, "endOffset": string, "fps": number } |
Инструмент
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.
Next ID: 12
functionDeclarations[]
object ( FunctionDeclaration
)
Optional. A list of FunctionDeclarations
available to the model that can be used for function calling.
The model or system does not execute the function. Instead the defined function may be returned as a FunctionCall
with arguments to the client side for execution. The model may decide to call a subset of these functions by populating FunctionCall
in the response. The next conversation turn may contain a FunctionResponse
with the Content.role
"function" generation context for the next model turn.
googleSearchRetrieval
object ( GoogleSearchRetrieval
)
Optional. Retrieval tool that is powered by Google search.
codeExecution
object ( CodeExecution
)
Optional. Enables the model to execute code as part of generation.
googleSearch
object ( GoogleSearch
)
Optional. GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google.
computerUse
object ( ComputerUse
)
Optional. Tool to support the model interacting directly with the computer. If enabled, it automatically populates computer-use specific Function Declarations.
urlContext
object ( UrlContext
)
Optional. Tool to support URL context retrieval.
fileSearch
object ( FileSearch
)
Optional. FileSearch tool type. Tool to retrieve knowledge from Semantic Retrieval corpora.
JSON-представление |
---|
{ "functionDeclarations": [ { object ( |
Объявление функции
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.
string
name
Required. The name of the function. Must be az, AZ, 0-9, or contain underscores, colons, dots, and dashes, with a maximum length of 64.
string
description
Required. A brief description of the function.
behavior
enum ( Behavior
)
Optional. Specifies the function Behavior. Currently only supported by the BidiGenerateContent method.
parameters
object ( Schema
)
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.
parametersJsonSchema
value ( Value
format)
Optional. Describes the parameters to the function in JSON Schema format. The schema must describe an object where the properties are the parameters to the function. For example:
{
"type": "object",
"properties": {
"name": { "type": "string" },
"age": { "type": "integer" }
},
"additionalProperties": false,
"required": ["name", "age"],
"propertyOrdering": ["name", "age"]
}
This field is mutually exclusive with parameters
.
response
object ( Schema
)
Optional. Describes the output from this function in JSON Schema format. Reflects the Open API 3.03 Response Object. The Schema defines the type used for the response value of the function.
responseJsonSchema
value ( Value
format)
Optional. Describes the output from this function in JSON Schema format. The value specified by the schema is the response value of the function.
This field is mutually exclusive with response
.
Схема
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 .
type
enum ( Type
)
Required. Data type.
format
string
Optional. The format of the data. Any value is allowed, but most do not trigger any special functionality.
string
title
Optional. The title of the schema.
string
description
Optional. A brief description of the parameter. This could contain examples of use. Parameter description may be formatted as Markdown.
boolean
nullable
Optional. Indicates if the value may be null.
enum[]
string
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"]}
maxItems
string ( int64 format)
Optional. Maximum number of the elements for Type.ARRAY.
minItems
string ( int64 format)
Optional. Minimum number of the elements for Type.ARRAY.
properties
map (key: string, value: object ( Schema
))
Optional. Properties of Type.OBJECT.
An object containing a list of "key": value
pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }
.
required[]
string
Optional. Required properties of Type.OBJECT.
minProperties
string ( int64 format)
Optional. Minimum number of the properties for Type.OBJECT.
maxProperties
string ( int64 format)
Optional. Maximum number of the properties for Type.OBJECT.
minLength
string ( int64 format)
Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING
maxLength
string ( int64 format)
Optional. Maximum length of the Type.STRING
pattern
string
Optional. Pattern of the Type.STRING to restrict a string to a regular expression.
example
value ( Value
format)
Optional. Example of the object. Will only populated when the object is the root.
anyOf[]
object ( Schema
)
Optional. The value should be validated against any (one or more) of the subschemas in the list.
propertyOrdering[]
string
Optional. The order of the properties. Not a standard field in open api spec. Used to determine the order of the properties in the response.
default
value ( Value
format)
Optional. Default value of the field. Per JSON Schema, this field is intended for documentation generators and doesn't affect validation. Thus it's included here and ignored so that developers who send schemas with a default
field don't get unknown-field errors.
items
object ( Schema
)
Optional. Schema of the elements of Type.ARRAY.
minimum
number
Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the Type.INTEGER and Type.NUMBER
maximum
number
Optional. Maximum value of the Type.INTEGER and Type.NUMBER
JSON-представление |
---|
{ "type": enum ( |
Тип
Type contains the list of OpenAPI data types as defined by https://spec.openapis.org/oas/v3.0.3#data-types
Перечисления | |
---|---|
TYPE_UNSPECIFIED | Not specified, should not be used. |
STRING | String type. |
NUMBER | Number type. |
INTEGER | Целочисленный тип. |
BOOLEAN | Булевский тип. |
ARRAY | Array type. |
OBJECT | Object type. |
NULL | Null type. |
Поведение
Defines the function behavior. Defaults to BLOCKING
.
Перечисления | |
---|---|
UNSPECIFIED | This value is unused. |
BLOCKING | If set, the system will wait to receive the function response before continuing the conversation. |
NON_BLOCKING | If set, the system will not wait to receive the function response. Instead, it will attempt to handle function responses as they become available while maintaining the conversation between the user and the model. |
GoogleSearchRetrieval
Tool to retrieve public web data for grounding, powered by Google.
dynamicRetrievalConfig
object ( DynamicRetrievalConfig
)
Specifies the dynamic retrieval configuration for the given source.
JSON representation |
---|
{
"dynamicRetrievalConfig": {
object ( |
DynamicRetrievalConfig
Describes the options to customize dynamic retrieval.
mode
enum ( Mode
)
The mode of the predictor to be used in dynamic retrieval.
dynamicThreshold
number
The threshold to be used in dynamic retrieval. If not set, a system default value is used.
JSON representation |
---|
{
"mode": enum ( |
Режим
The mode of the predictor to be used in dynamic retrieval.
Перечисления | |
---|---|
MODE_UNSPECIFIED | Always trigger retrieval. |
MODE_DYNAMIC | Run retrieval only when system decides it is necessary. |
CodeExecution
Этот тип не имеет полей.
Tool that executes code generated by the model, and automatically returns the result to the model.
See also ExecutableCode
and CodeExecutionResult
which are only generated when using this tool.
GoogleSearch
GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google.
timeRangeFilter
object ( Interval
)
Optional. Filter search results to a specific time range. If customers set a start time, they must set an end time (and vice versa).
JSON representation |
---|
{
"timeRangeFilter": {
object ( |
Интервал
Представляет временной интервал, закодированный как начальная метка времени (включительно) и конечная метка времени (исключая).
Начало должно быть меньше или равно концу. Если начало равно концу, интервал пустой (не соответствует ни одному времени). Если ни начало, ни конец не указаны, интервал соответствует любому времени.
startTime
string ( Timestamp
format)
Необязательно. Начало интервала включено.
Если указано, то соответствующая этому интервалу временная метка должна быть такой же или более поздней.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
endTime
string ( Timestamp
format)
Optional. Exclusive end of the interval.
Если указано, то соответствующая этому интервалу временная метка должна быть до конца.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
JSON-представление |
---|
{ "startTime": string, "endTime": string } |
ComputerUse
Computer Use tool type.
environment
enum ( Environment
)
Required. The environment being operated.
excludedPredefinedFunctions[]
string
Optional. By default, predefined functions are included in the final model call. Some of them can be explicitly excluded from being automatically included. This can serve two purposes: 1. Using a more restricted / different action space. 2. Improving the definitions / instructions of predefined functions.
JSON representation |
---|
{
"environment": enum ( |
Среда
Represents the environment being operated, such as a web browser.
Перечисления | |
---|---|
ENVIRONMENT_UNSPECIFIED | Defaults to browser. |
ENVIRONMENT_BROWSER | Operates in a web browser. |
UrlContext
Этот тип не имеет полей.
Tool to support URL context retrieval.
FileSearch
The FileSearch tool that retrieves knowledge from Semantic Retrieval corpora. Files are imported to Semantic Retrieval corpora using the ImportFile API.
retrievalResources[]
object ( RetrievalResource
)
Required. Semantic retrieval resources to retrieve from. Currently only supports one corpus. In the future we may open up multiple corpora support.
retrievalConfig
object ( RetrievalConfig
)
Optional. The configuration for the retrieval.
JSON representation |
---|
{ "retrievalResources": [ { object ( |
RetrievalResource
The semantic retrieval resource to retrieve from.
ragStoreName
string
Required. The name of the semantic retrieval resource to retrieve from. Example: ragStores/my-rag-store-123
JSON representation |
---|
{ "ragStoreName": string } |
RetrievalConfig
Semantic retrieval configuration.
metadataFilter
string
Optional. Metadata filter to apply to the semantic retrieval documents and chunks.
topK
integer
Optional. The number of semantic retrieval chunks to retrieve.
JSON representation |
---|
{ "metadataFilter": string, "topK": integer } |
ToolConfig
The Tool configuration containing parameters for specifying Tool
use in the request.
functionCallingConfig
object ( FunctionCallingConfig
)
Optional. Function calling config.
JSON representation |
---|
{
"functionCallingConfig": {
object ( |
FunctionCallingConfig
Configuration for specifying function calling behavior.
mode
enum ( Mode
)
Optional. Specifies the mode in which function calling should execute. If unspecified, the default value will be set to AUTO.
allowedFunctionNames[]
string
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 or VALIDATED. Function names should match [FunctionDeclaration.name]. When set, model will predict a function call from only allowed function names.
JSON representation |
---|
{
"mode": enum ( |
Режим
Defines the execution behavior for function calling by defining the execution mode.
Перечисления | |
---|---|
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. |
VALIDATED | Model decides to predict either a function call or a natural language response, but will validate function calls with constrained decoding. 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". |
ИспользованиеМетаданных
Metadata on the usage of the cached content.
totalTokenCount
integer
Total number of tokens that the cached content consumes.
JSON-представление |
---|
{ "totalTokenCount": integer } |
Context caching allows you to save and reuse precomputed input tokens that you wish to use repeatedly, for example when asking different questions about the same media file. This can lead to cost and speed savings, depending on the usage. For a detailed introduction, see the Context caching guide.
Method: cachedContents.create
Creates CachedContent resource.
Конечная точка
posthttps: / /generativelanguage.googleapis.com /v1beta /cachedContents
Текст запроса
The request body contains an instance of CachedContent
.
contents[]
object ( Content
)
Optional. Input only. Immutable. The content to cache.
tools[]
object ( Tool
)
Optional. Input only. Immutable. A list of Tools
the model may use to generate the next response
expiration
Union type
expiration
can be only one of the following: expireTime
string ( Timestamp
format)
Timestamp in UTC of when this resource is considered expired. This is always provided on output, regardless of what was sent on input.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
ttl
string ( Duration
format)
Input only. New TTL for this resource, input only.
A duration in seconds with up to nine fractional digits, ending with ' s
'. Example: "3.5s"
.
displayName
string
Optional. Immutable. The user-generated meaningful display name of the cached content. Maximum 128 Unicode characters.
model
string
Required. Immutable. The name of the Model
to use for cached content Format: models/{model}
systemInstruction
object ( Content
)
Optional. Input only. Immutable. Developer set system instruction. Currently text only.
toolConfig
object ( ToolConfig
)
Optional. Input only. Immutable. Tool config. This config is shared for all tools.
Пример запроса
Базовый
Питон
Node.js
Идти
Оболочка
От имени
Питон
Node.js
Идти
From chat
Питон
Node.js
Идти
Тело ответа
If successful, the response body contains a newly created instance of CachedContent
.
Method: cachedContents.list
Lists CachedContents.
Конечная точка
gethttps: / /generativelanguage.googleapis.com /v1beta /cachedContents
Параметры запроса
pageSize
integer
Optional. The maximum number of cached contents to return. The service may return fewer than this value. If unspecified, some default (under maximum) number of items will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
pageToken
string
Optional. A page token, received from a previous cachedContents.list
call. Provide this to retrieve the subsequent page.
When paginating, all other parameters provided to cachedContents.list
must match the call that provided the page token.
Текст запроса
Тело запроса должно быть пустым.
Тело ответа
Response with CachedContents list.
В случае успеха тело ответа содержит данные со следующей структурой:
cachedContents[]
object ( CachedContent
)
List of cached contents.
nextPageToken
string
A token, which can be sent as pageToken
to retrieve the next page. If this field is omitted, there are no subsequent pages.
JSON representation |
---|
{
"cachedContents": [
{
object ( |
Method: cachedContents.get
Reads CachedContent resource.
Конечная точка
gethttps: / /generativelanguage.googleapis.com /v1beta /{name=cachedContents /*}
Параметры пути
string
name
Required. The resource name referring to the content cache entry. Format: cachedContents/{id}
It takes the form cachedContents/{cachedcontent}
.
Текст запроса
Тело запроса должно быть пустым.
Пример запроса
Питон
Node.js
Идти
Оболочка
Тело ответа
If successful, the response body contains an instance of CachedContent
.
Method: cachedContents.patch
Updates CachedContent resource (only expiration is updatable).
Конечная точка
patchhttps: / /generativelanguage.googleapis.com /v1beta /{cachedContent.name=cachedContents /*}
PATCH https://generativelanguage.googleapis.com/v1beta/{cachedContent.name=cachedContents/*}
Параметры пути
cachedContent.name
string
Output only. Identifier. The resource name referring to the cached content. Format: cachedContents/{id}
It takes the form cachedContents/{cachedcontent}
.
Параметры запроса
updateMask
string ( FieldMask
format)
The list of fields to update.
This is a comma-separated list of fully qualified names of fields. Example: "user.displayName,photo"
.
Текст запроса
The request body contains an instance of CachedContent
.
expiration
Union type
expiration
can be only one of the following: expireTime
string ( Timestamp
format)
Timestamp in UTC of when this resource is considered expired. This is always provided on output, regardless of what was sent on input.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
ttl
string ( Duration
format)
Input only. New TTL for this resource, input only.
A duration in seconds with up to nine fractional digits, ending with ' s
'. Example: "3.5s"
.
Пример запроса
Питон
Node.js
Идти
Оболочка
Тело ответа
If successful, the response body contains an instance of CachedContent
.
Method: cachedContents.delete
Deletes CachedContent resource.
Конечная точка
deletehttps: / /generativelanguage.googleapis.com /v1beta /{name=cachedContents /*}
Параметры пути
string
name
Required. The resource name referring to the content cache entry Format: cachedContents/{id}
It takes the form cachedContents/{cachedcontent}
.
Текст запроса
Тело запроса должно быть пустым.
Пример запроса
Питон
Node.js
Идти
Оболочка
Тело ответа
В случае успеха тело ответа представляет собой пустой объект JSON.
REST Resource: cachedContents
- Resource: CachedContent
- Содержание
- Часть
- Клякса
- FunctionCall
- FunctionResponse
- ФункцияОтветЧасть
- FunctionResponseBlob
- Планирование
- FileData
- ExecutableCode
- Язык
- CodeExecutionResult
- Исход
- ВидеоМетаданные
- Инструмент
- Объявление функции
- Схема
- Тип
- Поведение
- GoogleSearchRetrieval
- DynamicRetrievalConfig
- Режим
- CodeExecution
- GoogleSearch
- Интервал
- ComputerUse
- Среда
- UrlContext
- FileSearch
- RetrievalResource
- RetrievalConfig
- ToolConfig
- FunctionCallingConfig
- Режим
- ИспользованиеМетаданных
- Методы
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.
contents[]
object ( Content
)
Optional. Input only. Immutable. The content to cache.
tools[]
object ( Tool
)
Optional. Input only. Immutable. A list of Tools
the model may use to generate the next response
createTime
string ( Timestamp
format)
Output only. Creation time of the cache entry.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
updateTime
string ( Timestamp
format)
Output only. When the cache entry was last updated in UTC time.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
usageMetadata
object ( UsageMetadata
)
Output only. Metadata on the usage of the cached content.
expiration
Union type
expiration
can be only one of the following: expireTime
string ( Timestamp
format)
Timestamp in UTC of when this resource is considered expired. This is always provided on output, regardless of what was sent on input.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
ttl
string ( Duration
format)
Input only. New TTL for this resource, input only.
A duration in seconds with up to nine fractional digits, ending with ' s
'. Example: "3.5s"
.
string
name
Output only. Identifier. The resource name referring to the cached content. Format: cachedContents/{id}
displayName
string
Optional. Immutable. The user-generated meaningful display name of the cached content. Maximum 128 Unicode characters.
model
string
Required. Immutable. The name of the Model
to use for cached content Format: models/{model}
systemInstruction
object ( Content
)
Optional. Input only. Immutable. Developer set system instruction. Currently text only.
toolConfig
object ( ToolConfig
)
Optional. Input only. Immutable. Tool config. This config is shared for all tools.
JSON representation |
---|
{ "contents": [ { object ( |
Содержание
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.
parts[]
object ( Part
)
Ordered Parts
that constitute a single message. Parts may have different MIME types.
role
string
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.
JSON representation |
---|
{
"parts": [
{
object ( |
Часть
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.
thought
boolean
Optional. Indicates if the part is thought from the model.
thoughtSignature
string ( bytes format)
Optional. An opaque signature for the thought so it can be reused in subsequent requests.
A base64-encoded string.
partMetadata
object ( Struct
format)
Custom metadata associated with the Part. Agents using genai.Part as content representation may need to keep track of the additional information. For example it can be name of a file/source from which the Part originates or a way to multiplex multiple Part streams.
data
Union type
data
can be only one of the following:text
string
Inline text.
inlineData
object ( Blob
)
Inline media bytes.
functionCall
object ( FunctionCall
)
A predicted FunctionCall
returned from the model that contains a string representing the FunctionDeclaration.name
with the arguments and their values.
functionResponse
object ( FunctionResponse
)
The result output of 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.
fileData
object ( FileData
)
URI based data.
executableCode
object ( ExecutableCode
)
Code generated by the model that is meant to be executed.
codeExecutionResult
object ( CodeExecutionResult
)
Result of executing the ExecutableCode
.
metadata
Union type
metadata
can be only one of the following:videoMetadata
object ( VideoMetadata
)
Optional. Video metadata. The metadata should only be specified while the video data is presented in inlineData or fileData.
JSON representation |
---|
{ "thought": boolean, "thoughtSignature": string, "partMetadata": { object }, // data "text": string, "inlineData": { object ( |
Клякса
Raw media bytes.
Text should not be sent as raw bytes, use the 'text' field.
mimeType
string
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
string ( bytes format)
Raw bytes for media formats.
A base64-encoded string.
JSON representation |
---|
{ "mimeType": string, "data": string } |
FunctionCall
A predicted FunctionCall
returned from the model that contains a string representing the FunctionDeclaration.name
with the arguments and their values.
string
id
Optional. The unique id of the function call. If populated, the client to execute the functionCall
and return the response with the matching id
.
string
name
Required. The name of the function to call. Must be az, AZ, 0-9, or contain underscores and dashes, with a maximum length of 64.
args
object ( Struct
format)
Optional. The function parameters and values in JSON object format.
JSON representation |
---|
{ "id": string, "name": string, "args": { object } } |
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 a FunctionCall
made based on model prediction.
string
id
Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call id
.
string
name
Required. The name of the function to call. Must be az, AZ, 0-9, or contain underscores and dashes, with a maximum length of 64.
response
object ( Struct
format)
Required. The function response in JSON object format. Callers can use any keys of their choice that fit the function's syntax to return the function output, eg "output", "result", etc. In particular, if the function call failed to execute, the response can have an "error" key to return error details to the model.
parts[]
object ( FunctionResponsePart
)
Optional. Ordered Parts
that constitute a function response. Parts may have different IANA MIME types.
willContinue
boolean
Optional. Signals that function call continues, and more responses will be returned, turning the function call into a generator. Is only applicable to NON_BLOCKING function calls, is ignored otherwise. If set to false, future responses will not be considered. It is allowed to return empty response
with willContinue=False
to signal that the function call is finished. This may still trigger the model generation. To avoid triggering the generation and finish the function call, additionally set scheduling
to SILENT
.
scheduling
enum ( Scheduling
)
Optional. Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE.
JSON representation |
---|
{ "id": string, "name": string, "response": { object }, "parts": [ { object ( |
ФункцияОтветЧасть
A datatype containing media that is part of a FunctionResponse
message.
A FunctionResponsePart
consists of data which has an associated datatype. A FunctionResponsePart
can only contain one of the accepted types in FunctionResponsePart.data
.
A FunctionResponsePart
must have a fixed IANA MIME type identifying the type and subtype of the media if the inlineData
field is filled with raw bytes.
data
Union type
data
can be only one of the following: inlineData
object ( FunctionResponseBlob
)
Inline media bytes.
JSON-представление |
---|
{
// data
"inlineData": {
object ( |
FunctionResponseBlob
Raw media bytes for function response.
Text should not be sent as raw bytes, use the 'FunctionResponse.response' field.
mimeType
string
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
string ( bytes format)
Raw bytes for media formats.
A base64-encoded string.
JSON representation |
---|
{ "mimeType": string, "data": string } |
Планирование
Specifies how the response should be scheduled in the conversation.
Перечисления | |
---|---|
SCHEDULING_UNSPECIFIED | This value is unused. |
SILENT | Only add the result to the conversation context, do not interrupt or trigger generation. |
WHEN_IDLE | Add the result to the conversation context, and prompt to generate output without interrupting ongoing generation. |
INTERRUPT | Add the result to the conversation context, interrupt ongoing generation and prompt to generate output. |
FileData
URI based data.
mimeType
string
Optional. The IANA standard MIME type of the source data.
fileUri
string
Required. URI.
JSON representation |
---|
{ "mimeType": string, "fileUri": string } |
ExecutableCode
Code generated by the model that is meant to be executed, and the result returned to the model.
Only generated when using the CodeExecution
tool, in which the code will be automatically executed, and a corresponding CodeExecutionResult
will also be generated.
language
enum ( Language
)
Required. Programming language of the code
.
code
string
Required. The code to be executed.
JSON representation |
---|
{
"language": enum ( |
Язык
Supported programming languages for the generated code.
Перечисления | |
---|---|
LANGUAGE_UNSPECIFIED | Unspecified language. This value should not be used. |
PYTHON | Python >= 3.10, with numpy and simpy available. |
CodeExecutionResult
Result of executing the ExecutableCode
.
Only generated when using the CodeExecution
, and always follows a part
containing the ExecutableCode
.
outcome
enum ( Outcome
)
Required. Outcome of the code execution.
output
string
Optional. Contains stdout when code execution is successful, stderr or other description otherwise.
JSON representation |
---|
{
"outcome": enum ( |
Исход
Enumeration of possible outcomes of the code execution.
Перечисления | |
---|---|
OUTCOME_UNSPECIFIED | Unspecified status. This value should not be used. |
OUTCOME_OK | Code execution completed successfully. |
OUTCOME_FAILED | Code execution finished but with a failure. stderr should contain the reason. |
OUTCOME_DEADLINE_EXCEEDED | Code execution ran for too long, and was cancelled. There may or may not be a partial output present. |
ВидеоМетаданные
Metadata describes the input video content.
startOffset
string ( Duration
format)
Optional. The start offset of the video.
A duration in seconds with up to nine fractional digits, ending with ' s
'. Example: "3.5s"
.
endOffset
string ( Duration
format)
Optional. The end offset of the video.
A duration in seconds with up to nine fractional digits, ending with ' s
'. Example: "3.5s"
.
fps
number
Optional. The frame rate of the video sent to the model. If not specified, the default value will be 1.0. The fps range is (0.0, 24.0].
JSON representation |
---|
{ "startOffset": string, "endOffset": string, "fps": number } |
Инструмент
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.
Next ID: 12
functionDeclarations[]
object ( FunctionDeclaration
)
Optional. A list of FunctionDeclarations
available to the model that can be used for function calling.
The model or system does not execute the function. Instead the defined function may be returned as a FunctionCall
with arguments to the client side for execution. The model may decide to call a subset of these functions by populating FunctionCall
in the response. The next conversation turn may contain a FunctionResponse
with the Content.role
"function" generation context for the next model turn.
googleSearchRetrieval
object ( GoogleSearchRetrieval
)
Optional. Retrieval tool that is powered by Google search.
codeExecution
object ( CodeExecution
)
Optional. Enables the model to execute code as part of generation.
googleSearch
object ( GoogleSearch
)
Optional. GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google.
computerUse
object ( ComputerUse
)
Optional. Tool to support the model interacting directly with the computer. If enabled, it automatically populates computer-use specific Function Declarations.
urlContext
object ( UrlContext
)
Optional. Tool to support URL context retrieval.
fileSearch
object ( FileSearch
)
Optional. FileSearch tool type. Tool to retrieve knowledge from Semantic Retrieval corpora.
JSON representation |
---|
{ "functionDeclarations": [ { object ( |
Объявление функции
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.
string
name
Required. The name of the function. Must be az, AZ, 0-9, or contain underscores, colons, dots, and dashes, with a maximum length of 64.
string
description
Required. A brief description of the function.
behavior
enum ( Behavior
)
Optional. Specifies the function Behavior. Currently only supported by the BidiGenerateContent method.
parameters
object ( Schema
)
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.
parametersJsonSchema
value ( Value
format)
Optional. Describes the parameters to the function in JSON Schema format. The schema must describe an object where the properties are the parameters to the function. For example:
{
"type": "object",
"properties": {
"name": { "type": "string" },
"age": { "type": "integer" }
},
"additionalProperties": false,
"required": ["name", "age"],
"propertyOrdering": ["name", "age"]
}
This field is mutually exclusive with parameters
.
response
object ( Schema
)
Optional. Describes the output from this function in JSON Schema format. Reflects the Open API 3.03 Response Object. The Schema defines the type used for the response value of the function.
responseJsonSchema
value ( Value
format)
Optional. Describes the output from this function in JSON Schema format. The value specified by the schema is the response value of the function.
This field is mutually exclusive with response
.
Схема
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 .
type
enum ( Type
)
Required. Data type.
format
string
Optional. The format of the data. Any value is allowed, but most do not trigger any special functionality.
string
title
Optional. The title of the schema.
string
description
Optional. A brief description of the parameter. This could contain examples of use. Parameter description may be formatted as Markdown.
boolean
nullable
Optional. Indicates if the value may be null.
enum[]
string
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"]}
maxItems
string ( int64 format)
Optional. Maximum number of the elements for Type.ARRAY.
minItems
string ( int64 format)
Optional. Minimum number of the elements for Type.ARRAY.
properties
map (key: string, value: object ( Schema
))
Optional. Properties of Type.OBJECT.
An object containing a list of "key": value
pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }
.
required[]
string
Optional. Required properties of Type.OBJECT.
minProperties
string ( int64 format)
Optional. Minimum number of the properties for Type.OBJECT.
maxProperties
string ( int64 format)
Optional. Maximum number of the properties for Type.OBJECT.
minLength
string ( int64 format)
Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING
maxLength
string ( int64 format)
Optional. Maximum length of the Type.STRING
pattern
string
Optional. Pattern of the Type.STRING to restrict a string to a regular expression.
example
value ( Value
format)
Optional. Example of the object. Will only populated when the object is the root.
anyOf[]
object ( Schema
)
Optional. The value should be validated against any (one or more) of the subschemas in the list.
propertyOrdering[]
string
Optional. The order of the properties. Not a standard field in open api spec. Used to determine the order of the properties in the response.
default
value ( Value
format)
Optional. Default value of the field. Per JSON Schema, this field is intended for documentation generators and doesn't affect validation. Thus it's included here and ignored so that developers who send schemas with a default
field don't get unknown-field errors.
items
object ( Schema
)
Optional. Schema of the elements of Type.ARRAY.
minimum
number
Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the Type.INTEGER and Type.NUMBER
maximum
number
Optional. Maximum value of the Type.INTEGER and Type.NUMBER
JSON representation |
---|
{ "type": enum ( |
Тип
Type contains the list of OpenAPI data types as defined by https://spec.openapis.org/oas/v3.0.3#data-types
Перечисления | |
---|---|
TYPE_UNSPECIFIED | Not specified, should not be used. |
STRING | String type. |
NUMBER | Number type. |
INTEGER | Целочисленный тип. |
BOOLEAN | Булевский тип. |
ARRAY | Array type. |
OBJECT | Object type. |
NULL | Null type. |
Поведение
Defines the function behavior. Defaults to BLOCKING
.
Перечисления | |
---|---|
UNSPECIFIED | This value is unused. |
BLOCKING | If set, the system will wait to receive the function response before continuing the conversation. |
NON_BLOCKING | If set, the system will not wait to receive the function response. Instead, it will attempt to handle function responses as they become available while maintaining the conversation between the user and the model. |
GoogleSearchRetrieval
Tool to retrieve public web data for grounding, powered by Google.
dynamicRetrievalConfig
object ( DynamicRetrievalConfig
)
Specifies the dynamic retrieval configuration for the given source.
JSON-представление |
---|
{
"dynamicRetrievalConfig": {
object ( |
DynamicRetrievalConfig
Describes the options to customize dynamic retrieval.
mode
enum ( Mode
)
The mode of the predictor to be used in dynamic retrieval.
dynamicThreshold
number
The threshold to be used in dynamic retrieval. If not set, a system default value is used.
JSON representation |
---|
{
"mode": enum ( |
Режим
The mode of the predictor to be used in dynamic retrieval.
Перечисления | |
---|---|
MODE_UNSPECIFIED | Always trigger retrieval. |
MODE_DYNAMIC | Run retrieval only when system decides it is necessary. |
CodeExecution
Этот тип не имеет полей.
Tool that executes code generated by the model, and automatically returns the result to the model.
See also ExecutableCode
and CodeExecutionResult
which are only generated when using this tool.
GoogleSearch
GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google.
timeRangeFilter
object ( Interval
)
Optional. Filter search results to a specific time range. If customers set a start time, they must set an end time (and vice versa).
JSON representation |
---|
{
"timeRangeFilter": {
object ( |
Интервал
Представляет временной интервал, закодированный как начальная метка времени (включительно) и конечная метка времени (исключая).
Начало должно быть меньше или равно концу. Если начало равно концу, интервал пустой (не соответствует ни одному времени). Если ни начало, ни конец не указаны, интервал соответствует любому времени.
startTime
string ( Timestamp
format)
Необязательно. Начало интервала включено.
Если указано, то соответствующая этому интервалу временная метка должна быть такой же или более поздней.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
endTime
string ( Timestamp
format)
Optional. Exclusive end of the interval.
Если указано, то соответствующая этому интервалу временная метка должна быть до конца.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z"
, "2014-10-02T15:01:23.045123456Z"
or "2014-10-02T15:01:23+05:30"
.
JSON representation |
---|
{ "startTime": string, "endTime": string } |
ComputerUse
Computer Use tool type.
environment
enum ( Environment
)
Required. The environment being operated.
excludedPredefinedFunctions[]
string
Optional. By default, predefined functions are included in the final model call. Some of them can be explicitly excluded from being automatically included. This can serve two purposes: 1. Using a more restricted / different action space. 2. Improving the definitions / instructions of predefined functions.
JSON representation |
---|
{
"environment": enum ( |
Среда
Represents the environment being operated, such as a web browser.
Перечисления | |
---|---|
ENVIRONMENT_UNSPECIFIED | Defaults to browser. |
ENVIRONMENT_BROWSER | Operates in a web browser. |
UrlContext
Этот тип не имеет полей.
Tool to support URL context retrieval.
FileSearch
The FileSearch tool that retrieves knowledge from Semantic Retrieval corpora. Files are imported to Semantic Retrieval corpora using the ImportFile API.
retrievalResources[]
object ( RetrievalResource
)
Required. Semantic retrieval resources to retrieve from. Currently only supports one corpus. In the future we may open up multiple corpora support.
retrievalConfig
object ( RetrievalConfig
)
Optional. The configuration for the retrieval.
JSON representation |
---|
{ "retrievalResources": [ { object ( |
RetrievalResource
The semantic retrieval resource to retrieve from.
ragStoreName
string
Required. The name of the semantic retrieval resource to retrieve from. Example: ragStores/my-rag-store-123
JSON representation |
---|
{ "ragStoreName": string } |
RetrievalConfig
Semantic retrieval configuration.
metadataFilter
string
Optional. Metadata filter to apply to the semantic retrieval documents and chunks.
topK
integer
Optional. The number of semantic retrieval chunks to retrieve.
JSON representation |
---|
{ "metadataFilter": string, "topK": integer } |
ToolConfig
The Tool configuration containing parameters for specifying Tool
use in the request.
functionCallingConfig
object ( FunctionCallingConfig
)
Optional. Function calling config.
JSON representation |
---|
{
"functionCallingConfig": {
object ( |
FunctionCallingConfig
Configuration for specifying function calling behavior.
mode
enum ( Mode
)
Optional. Specifies the mode in which function calling should execute. If unspecified, the default value will be set to AUTO.
allowedFunctionNames[]
string
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 or VALIDATED. Function names should match [FunctionDeclaration.name]. When set, model will predict a function call from only allowed function names.
JSON representation |
---|
{
"mode": enum ( |
Режим
Defines the execution behavior for function calling by defining the execution mode.
Перечисления | |
---|---|
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. |
VALIDATED | Model decides to predict either a function call or a natural language response, but will validate function calls with constrained decoding. 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". |
ИспользованиеМетаданных
Metadata on the usage of the cached content.
totalTokenCount
integer
Total number of tokens that the cached content consumes.
JSON representation |
---|
{ "totalTokenCount": integer } |