Repository: googleapis/nodejs-vertexai
Branch: main
Commit: 77d956444566
Files: 114
Total size: 828.1 KB
Directory structure:
gitextract_z_dw_qc9/
├── .eslintignore
├── .eslintrc.json
├── .github/
│ ├── CODEOWNERS
│ ├── release-please.yml
│ ├── release-trigger.yml
│ ├── sync-repo-settings.yaml
│ └── workflows/
│ └── presubmit.yaml
├── .gitignore
├── .jsdoc.js
├── .kokoro/
│ ├── docs.sh
│ ├── populate-secrets.sh
│ ├── presubmit/
│ │ ├── node18/
│ │ │ ├── common.cfg
│ │ │ ├── continuous-system-test.cfg
│ │ │ ├── docs.cfg
│ │ │ ├── docs.sh
│ │ │ └── system-test.cfg
│ │ └── node22/
│ │ ├── common.cfg
│ │ ├── docs.cfg
│ │ ├── docs.sh
│ │ └── system-test.cfg
│ ├── publish.sh
│ ├── system-test.sh
│ ├── test.sh
│ └── trampoline_v2.sh
├── .prettierignore
├── .prettierrc.js
├── .release-please-manifest.json
├── .repo-metadata.json
├── .trampolinerc
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY.md
├── package.json
├── release-please-config.json
├── src/
│ ├── .prettierignore
│ ├── .prettierrc
│ ├── _internal_types.ts
│ ├── agentengines.ts
│ ├── client.ts
│ ├── converters/
│ │ ├── _agentengines_converters.ts
│ │ ├── _memories_converters.ts
│ │ ├── _memoryrevisions_converters.ts
│ │ ├── _sandboxes_converters.ts
│ │ ├── _sessionevents_converters.ts
│ │ ├── _sessions_converters.ts
│ │ └── _skills_converters.ts
│ ├── eslint.config.mjs
│ ├── index.ts
│ ├── memories.ts
│ ├── memoryrevisions.ts
│ ├── releases.txt
│ ├── sandboxes.ts
│ ├── sessionevents.ts
│ ├── sessions.ts
│ ├── skills.ts
│ ├── types/
│ │ └── common.ts
│ └── types.ts
├── system_test/
│ └── agent_engine_e2e_test.ts
├── test/
│ ├── replays/
│ │ ├── _replay_client.ts
│ │ ├── agentengines_memories_test.ts
│ │ ├── agentengines_sandboxes_test.ts
│ │ ├── agentengines_sessions_test.ts
│ │ ├── agentengines_test.ts
│ │ ├── run_replay_tests.sh
│ │ ├── sessionevents_test.ts
│ │ ├── skills_test.ts
│ │ └── test_env.js
│ ├── spec/
│ │ └── reporter.js
│ └── unit/
│ └── client_test.ts
├── tsconfig.json
└── vertexai/
├── .eslintrc.json
├── README.md
├── package.json
├── src/
│ ├── functions/
│ │ ├── count_tokens.ts
│ │ ├── generate_content.ts
│ │ ├── index.ts
│ │ ├── post_fetch_processing.ts
│ │ ├── post_request.ts
│ │ ├── pre_fetch_processing.ts
│ │ ├── test/
│ │ │ ├── functions_test.ts
│ │ │ ├── post_fetch_processing_test.ts
│ │ │ ├── post_request_test.ts
│ │ │ ├── pre_fetch_processing_test.ts
│ │ │ └── test_data.ts
│ │ └── util.ts
│ ├── index.ts
│ ├── models/
│ │ ├── chat_session.ts
│ │ ├── generative_models.ts
│ │ ├── index.ts
│ │ ├── test/
│ │ │ ├── chat_session_test.ts
│ │ │ ├── generative_models_test.ts
│ │ │ └── models_test.ts
│ │ └── util.ts
│ ├── resources/
│ │ ├── cached_contents.ts
│ │ ├── index.ts
│ │ └── shared/
│ │ └── api_client.ts
│ ├── testing/
│ │ ├── fake_google_auth.ts
│ │ └── fake_google_auth_test.ts
│ ├── types/
│ │ ├── common.ts
│ │ ├── content.ts
│ │ ├── errors.ts
│ │ ├── generate_content_response_handler.ts
│ │ ├── index.ts
│ │ └── tool.ts
│ ├── util/
│ │ ├── constants.ts
│ │ └── index.ts
│ └── vertex_ai.ts
├── system_test/
│ └── end_to_end_sample_test.ts
├── test/
│ ├── index_test.ts
│ └── vertex_ai_test.ts
└── tsconfig.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .eslintignore
================================================
**/node_modules
build/
docs/
src/genai/
test/
system_test/
sdk_schema_test/
src/**/test/
================================================
FILE: .eslintrc.json
================================================
{
"extends": "./node_modules/gts"
}
================================================
FILE: .github/CODEOWNERS
================================================
# Code owners file.
# This file controls who is tagged for review for any given pull request.
#
# For syntax help see:
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
# The Vertex AI SDK team is the default owner for approving PRs.
* @googleapis/vertexai-team
================================================
FILE: .github/release-please.yml
================================================
handleGHRelease: true
manifest: true
================================================
FILE: .github/release-trigger.yml
================================================
enabled: true
================================================
FILE: .github/sync-repo-settings.yaml
================================================
# https://github.com/googleapis/repo-automation-bots/tree/main/packages/sync-repo-settings
# We are disabling this bot until https://github.com/googleapis/repo-automation-bots/issues/4617
# is resolved
enabled: false
================================================
FILE: .github/workflows/presubmit.yaml
================================================
on:
pull_request:
name: presubmit
jobs:
units:
runs-on: ubuntu-latest
strategy:
matrix:
node: [20, 22, 24]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: ^6.24.1
- run: node --version
- run: npm install
- run: npm run test
name: Run unit tests
env:
BUILD_TYPE: presubmit
TEST_TYPE: units
================================================
FILE: .gitignore
================================================
# Ignore directories generated automatically.
node_modules/
build/
docs/
.nyc_output/
# Ignore files generated automatically.
test/spec/sponge_log.xml
# Ignore JetBrains IDE files
.idea/
================================================
FILE: .jsdoc.js
================================================
/**
* @license
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
module.exports = {
opts: {
readme: './README.md',
package: './package.json',
template: './node_modules/jsdoc-fresh',
recurse: true,
verbose: true,
destination: './docs/'
},
plugins: [
'plugins/markdown',
'jsdoc-region-tag'
],
source: {
excludePattern: '(^|\\/|\\\\)[._]',
include: [
'build/src',
],
includePattern: '\\.js$'
},
templates: {
copyright: 'Copyright 2023 Google LLC',
includeDate: false,
sourceFiles: false,
systemName: '@google-cloud/vertexai',
theme: 'lumen',
default: {
outputSourceFiles: false
}
},
markdown: {
idInHeadings: true
}
};
================================================
FILE: .kokoro/docs.sh
================================================
#!/bin/bash
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
set -eo pipefail
export NPM_CONFIG_PREFIX=${HOME}/.npm-global
cd $(dirname $0)/..
npm install
npm run docs-test
================================================
FILE: .kokoro/populate-secrets.sh
================================================
#!/bin/bash
# Copyright 2020 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This file is called in the early stage of `trampoline_v2.sh` to
# populate secrets needed for the CI builds.
set -eo pipefail
function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;}
function msg { println "$*" >&2 ;}
function println { printf '%s\n' "$(now) $*" ;}
# Populates requested secrets set in SECRET_MANAGER_KEYS
# In Kokoro CI builds, we use the service account attached to the
# Kokoro VM. This means we need to setup auth on other CI systems.
# For local run, we just use the gcloud command for retrieving the
# secrets.
if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then
GCLOUD_COMMANDS=(
"docker"
"run"
"--entrypoint=gcloud"
"--volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR}"
"gcr.io/google.com/cloudsdktool/cloud-sdk"
)
if [[ "${TRAMPOLINE_CI:-}" == "kokoro" ]]; then
SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager"
else
echo "Authentication for this CI system is not implemented yet."
exit 2
# TODO: Determine appropriate SECRET_LOCATION and the GCLOUD_COMMANDS.
fi
else
# For local run, use /dev/shm or temporary directory for
# KOKORO_GFILE_DIR.
if [[ -d "/dev/shm" ]]; then
export KOKORO_GFILE_DIR=/dev/shm
else
export KOKORO_GFILE_DIR=$(mktemp -d -t ci-XXXXXXXX)
fi
SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager"
GCLOUD_COMMANDS=("gcloud")
fi
msg "Creating folder on disk for secrets: ${SECRET_LOCATION}"
mkdir -p ${SECRET_LOCATION}
for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g")
do
msg "Retrieving secret ${key}"
"${GCLOUD_COMMANDS[@]}" \
secrets versions access latest \
--project cloud-devrel-kokoro-resources \
--secret $key > \
"$SECRET_LOCATION/$key"
if [[ $? == 0 ]]; then
msg "Secret written to ${SECRET_LOCATION}/${key}"
else
msg "Error retrieving secret ${key}"
exit 2
fi
done
================================================
FILE: .kokoro/presubmit/node18/common.cfg
================================================
# Format: //devtools/kokoro/config/proto/build.proto
# Build logs will be here
action {
define_artifacts {
regex: "**/*sponge_log.xml"
}
}
# Download trampoline resources.
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
# Use the trampoline script to run in docker.
build_file: "nodejs-vertexai/.kokoro/trampoline_v2.sh"
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:18-user"
}
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/nodejs-vertexai/.kokoro/test.sh"
}
================================================
FILE: .kokoro/presubmit/node18/continuous-system-test.cfg
================================================
# Download resources for system tests (service account key, etc.)
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs"
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/nodejs-vertexai/.kokoro/system-test.sh"
}
================================================
FILE: .kokoro/presubmit/node18/docs.cfg
================================================
# doc publications use a Python image.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:18-user"
}
# Download trampoline resources.
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
# Use the trampoline script to run in docker.
build_file: "nodejs-vertexai/.kokoro/trampoline_v2.sh"
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/nodejs-vertexai/.kokoro/presubmit/node18/docs.sh"
}
================================================
FILE: .kokoro/presubmit/node18/docs.sh
================================================
#!/bin/bash
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
set -eo pipefail
if [[ -z "$CREDENTIALS" ]]; then
# if CREDENTIALS are explicitly set, assume we're testing locally
# and don't set NPM_CONFIG_PREFIX.
export NPM_CONFIG_PREFIX=${HOME}/.npm-global
export PATH="$PATH:${NPM_CONFIG_PREFIX}/bin"
cd $(dirname $0)/../..
fi
npm install
npm install --no-save @google-cloud/cloud-rad@^0.4.0
# Switch to 'fail at end' to allow tar command to complete before exiting.
set +e
# publish docs to devsite
NO_UPLOAD=1 npx @google-cloud/cloud-rad . cloud-rad
tar cvfz docs.tar.gz yaml
if [[ $EXIT -ne 0 ]]; then
echo -e "\n Generate docs failed: npx returned a non-zero exit code. \n"
exit $EXIT
fi
set -e
================================================
FILE: .kokoro/presubmit/node18/system-test.cfg
================================================
# Download resources for system tests (service account key, etc.)
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs"
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/nodejs-vertexai/.kokoro/system-test.sh"
}
================================================
FILE: .kokoro/presubmit/node22/common.cfg
================================================
# Format: //devtools/kokoro/config/proto/build.proto
# Build logs will be here
action {
define_artifacts {
regex: "**/*sponge_log.xml"
}
}
# Download trampoline resources.
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
# Use the trampoline script to run in docker.
build_file: "nodejs-vertexai/.kokoro/trampoline_v2.sh"
# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user"
}
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/nodejs-vertexai/.kokoro/test.sh"
}
================================================
FILE: .kokoro/presubmit/node22/docs.cfg
================================================
# doc publications use a Python image.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:22-user"
}
# Download trampoline resources.
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
# Use the trampoline script to run in docker.
build_file: "nodejs-vertexai/.kokoro/trampoline_v2.sh"
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/nodejs-vertexai/.kokoro/presubmit/node22/docs.sh"
}
================================================
FILE: .kokoro/presubmit/node22/docs.sh
================================================
#!/bin/bash
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
set -eo pipefail
if [[ -z "$CREDENTIALS" ]]; then
# if CREDENTIALS are explicitly set, assume we're testing locally
# and don't set NPM_CONFIG_PREFIX.
export NPM_CONFIG_PREFIX=${HOME}/.npm-global
export PATH="$PATH:${NPM_CONFIG_PREFIX}/bin"
cd $(dirname $0)/../..
fi
npm install
npm install --no-save @google-cloud/cloud-rad@^0.4.0
# Switch to 'fail at end' to allow tar command to complete before exiting.
set +e
# publish docs to devsite
NO_UPLOAD=1 npx @google-cloud/cloud-rad . cloud-rad
tar cvfz docs.tar.gz yaml
if [[ $EXIT -ne 0 ]]; then
echo -e "\n Generate docs failed: npx returned a non-zero exit code. \n"
exit $EXIT
fi
set -e
================================================
FILE: .kokoro/presubmit/node22/system-test.cfg
================================================
# Download resources for system tests (service account key, etc.)
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs"
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/nodejs-vertexai/.kokoro/system-test.sh"
}
================================================
FILE: .kokoro/publish.sh
================================================
#!/bin/bash
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -eo pipefail
export NPM_CONFIG_PREFIX=${HOME}/.npm-global
# Start the releasetool reporter
python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script
cd $(dirname $0)/..
NPM_TOKEN=$(cat $KOKORO_KEYSTORE_DIR/73713_google-cloud-npm-token-1)
echo "//wombat-dressing-room.appspot.com/:_authToken=${NPM_TOKEN}" > ~/.npmrc
npm install
npm pack .
# npm provides no way to specify, observe, or predict the name of the tarball
# file it generates. We have to look in the current directory for the freshest
# .tgz file.
#
TARBALL=$(ls -1 -t *.tgz | head -1)
npm publish --access=public --registry=https://wombat-dressing-room.appspot.com "$TARBALL"
# Kokoro collects *.tgz and package-lock.json files and stores them in Placer
# so we can generate SBOMs and attestations.
# However, we *don't* want Kokoro to collect package-lock.json and *.tgz files
# that happened to be installed with dependencies.
find node_modules -name package-lock.json -o -name "*.tgz" | xargs rm -f
================================================
FILE: .kokoro/system-test.sh
================================================
#!/bin/bash
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -eo pipefail
export NPM_CONFIG_PREFIX=${HOME}/.npm-global
# Setup service account credentials.
export GCLOUD_PROJECT=ucaip-sample-tests
cd $(dirname $0)/..
# Run a pre-test hook, if a pre-system-test.sh is in the project
#
if [ -f .kokoro/pre-system-test.sh ]; then
set +x
. .kokoro/pre-system-test.sh
set -x
fi
npm install
# If tests are running against main branch, configure flakybot
# to open issues on failures:
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then
export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml
export MOCHA_REPORTER=xunit
cleanup() {
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
$KOKORO_GFILE_DIR/linux_amd64/flakybot
}
trap cleanup EXIT HUP
fi
# Switch to 'fail at end' to allow tar command to complete before exiting.
set +e
npm run cover:unit && npm run cover:integration
EXIT=$?
tar cvfz build.tar.gz build
npm run cover:report
if [ -d "coverage" ]; then
tar cvfz coverage.tar.gz coverage
fi
if [[ $EXIT -ne 0 ]]; then
echo -e "\n Testing failed: npm returned a non-zero exit code. \n"
exit $EXIT
fi
set -e
================================================
FILE: .kokoro/test.sh
================================================
#!/bin/bash
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -eo pipefail
export NPM_CONFIG_PREFIX=${HOME}/.npm-global
cd $(dirname $0)/..
npm install
# If tests are running against main branch, configure flakybot
# to open issues on failures:
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"nightly"* ]]; then
export MOCHA_REPORTER_OUTPUT=test_output_sponge_log.xml
export MOCHA_REPORTER=xunit
cleanup() {
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
$KOKORO_GFILE_DIR/linux_amd64/flakybot
}
trap cleanup EXIT HUP
fi
# Unit tests exercise the entire API surface, which may include
# deprecation warnings:
export MOCHA_THROW_DEPRECATION=false
npm test
# codecov combines coverage across integration and unit tests. Include
# the logic below for any environment you wish to collect coverage for:
COVERAGE_NODE=22
if npx check-node-version@3.3.0 --silent --node $COVERAGE_NODE; then
NYC_BIN=./node_modules/nyc/bin/nyc.js
if [ -f "$NYC_BIN" ]; then
$NYC_BIN report || true
fi
bash $KOKORO_GFILE_DIR/codecov.sh
else
echo "coverage is only reported for Node $COVERAGE_NODE"
fi
================================================
FILE: .kokoro/trampoline_v2.sh
================================================
#!/usr/bin/env bash
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# trampoline_v2.sh
#
# If you want to make a change to this file, consider doing so at:
# https://github.com/googlecloudplatform/docker-ci-helper
#
# This script is for running CI builds. For Kokoro builds, we
# set this script to `build_file` field in the Kokoro configuration.
# This script does 3 things.
#
# 1. Prepare the Docker image for the test
# 2. Run the Docker with appropriate flags to run the test
# 3. Upload the newly built Docker image
#
# in a way that is somewhat compatible with trampoline_v1.
#
# These environment variables are required:
# TRAMPOLINE_IMAGE: The docker image to use.
# TRAMPOLINE_DOCKERFILE: The location of the Dockerfile.
#
# You can optionally change these environment variables:
# TRAMPOLINE_IMAGE_UPLOAD:
# (true|false): Whether to upload the Docker image after the
# successful builds.
# TRAMPOLINE_BUILD_FILE: The script to run in the docker container.
# TRAMPOLINE_WORKSPACE: The workspace path in the docker container.
# Defaults to /workspace.
# Potentially there are some repo specific envvars in .trampolinerc in
# the project root.
#
# Here is an example for running this script.
# TRAMPOLINE_IMAGE=gcr.io/cloud-devrel-kokoro-resources/node:10-user \
# TRAMPOLINE_BUILD_FILE=.kokoro/system-test.sh \
# .kokoro/trampoline_v2.sh
set -euo pipefail
# x-release-please-start-version
TRAMPOLINE_VERSION="2.0.10"
# x-release-please-end
if command -v tput >/dev/null && [[ -n "${TERM:-}" ]]; then
readonly IO_COLOR_RED="$(tput setaf 1)"
readonly IO_COLOR_GREEN="$(tput setaf 2)"
readonly IO_COLOR_YELLOW="$(tput setaf 3)"
readonly IO_COLOR_RESET="$(tput sgr0)"
else
readonly IO_COLOR_RED=""
readonly IO_COLOR_GREEN=""
readonly IO_COLOR_YELLOW=""
readonly IO_COLOR_RESET=""
fi
function function_exists {
[[ "$(LC_ALL=C type -t "$1")" == "function" ]]
}
# Logs a message using the given color. The first argument must be one
# of the IO_COLOR_* variables defined above, such as
# "${IO_COLOR_YELLOW}". The remaining arguments will be logged in the
# given color. The log message will also have an RFC-3339 timestamp
# prepended (in UTC). You can disable the color output by setting
# TERM=vt100.
function log_impl() {
local color="$1"
shift
local timestamp
timestamp="$(date -u "+%Y-%m-%dT%H:%M:%SZ")"
echo "================================================================"
echo "${color}${timestamp}:" "$@" "${IO_COLOR_RESET}"
echo "================================================================"
}
# Logs the given message with normal coloring and a timestamp.
function log() {
log_impl "${IO_COLOR_RESET}" "$@"
}
# Logs the given message in green with a timestamp.
function log_green() {
log_impl "${IO_COLOR_GREEN}" "$@"
}
# Logs the given message in yellow with a timestamp.
function log_yellow() {
log_impl "${IO_COLOR_YELLOW}" "$@"
}
# Logs the given message in red with a timestamp.
function log_red() {
log_impl "${IO_COLOR_RED}" "$@"
}
readonly tmpdir=$(mktemp -d -t ci-XXXXXXXX)
readonly tmphome="${tmpdir}/h"
mkdir -p "${tmphome}"
function cleanup() {
rm -rf "${tmpdir}"
}
trap cleanup EXIT
RUNNING_IN_CI="${RUNNING_IN_CI:-false}"
# The workspace in the container, defaults to /workspace.
TRAMPOLINE_WORKSPACE="${TRAMPOLINE_WORKSPACE:-/workspace}"
pass_down_envvars=(
# TRAMPOLINE_V2 variables.
# Tells scripts whether they are running as part of CI or not.
"RUNNING_IN_CI"
# Indicates which CI system we're in.
"TRAMPOLINE_CI"
# Indicates the version of the script.
"TRAMPOLINE_VERSION"
)
log_yellow "Building with Trampoline ${TRAMPOLINE_VERSION}"
# Detect which CI systems we're in. If we're in any of the CI systems
# we support, `RUNNING_IN_CI` will be true and `TRAMPOLINE_CI` will be
# the name of the CI system. Both envvars will be passing down to the
# container for telling which CI system we're in.
if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then
# descriptive env var for indicating it's on CI.
RUNNING_IN_CI="true"
TRAMPOLINE_CI="kokoro"
if [[ "${TRAMPOLINE_USE_LEGACY_SERVICE_ACCOUNT:-}" == "true" ]]; then
if [[ ! -f "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json" ]]; then
log_red "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json does not exist. Did you forget to mount cloud-devrel-kokoro-resources/trampoline? Aborting."
exit 1
fi
# This service account will be activated later.
TRAMPOLINE_SERVICE_ACCOUNT="${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json"
else
if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then
gcloud auth list
fi
log_yellow "Configuring Container Registry access"
gcloud auth configure-docker --quiet
fi
pass_down_envvars+=(
# KOKORO dynamic variables.
"KOKORO_BUILD_NUMBER"
"KOKORO_BUILD_ID"
"KOKORO_JOB_NAME"
"KOKORO_GIT_COMMIT"
"KOKORO_GITHUB_COMMIT"
"KOKORO_GITHUB_PULL_REQUEST_NUMBER"
"KOKORO_GITHUB_PULL_REQUEST_COMMIT"
# For Flaky Bot
"KOKORO_GITHUB_COMMIT_URL"
"KOKORO_GITHUB_PULL_REQUEST_URL"
"KOKORO_BUILD_ARTIFACTS_SUBDIR"
)
elif [[ "${TRAVIS:-}" == "true" ]]; then
RUNNING_IN_CI="true"
TRAMPOLINE_CI="travis"
pass_down_envvars+=(
"TRAVIS_BRANCH"
"TRAVIS_BUILD_ID"
"TRAVIS_BUILD_NUMBER"
"TRAVIS_BUILD_WEB_URL"
"TRAVIS_COMMIT"
"TRAVIS_COMMIT_MESSAGE"
"TRAVIS_COMMIT_RANGE"
"TRAVIS_JOB_NAME"
"TRAVIS_JOB_NUMBER"
"TRAVIS_JOB_WEB_URL"
"TRAVIS_PULL_REQUEST"
"TRAVIS_PULL_REQUEST_BRANCH"
"TRAVIS_PULL_REQUEST_SHA"
"TRAVIS_PULL_REQUEST_SLUG"
"TRAVIS_REPO_SLUG"
"TRAVIS_SECURE_ENV_VARS"
"TRAVIS_TAG"
)
elif [[ -n "${GITHUB_RUN_ID:-}" ]]; then
RUNNING_IN_CI="true"
TRAMPOLINE_CI="github-workflow"
pass_down_envvars+=(
"GITHUB_WORKFLOW"
"GITHUB_RUN_ID"
"GITHUB_RUN_NUMBER"
"GITHUB_ACTION"
"GITHUB_ACTIONS"
"GITHUB_ACTOR"
"GITHUB_REPOSITORY"
"GITHUB_EVENT_NAME"
"GITHUB_EVENT_PATH"
"GITHUB_SHA"
"GITHUB_REF"
"GITHUB_HEAD_REF"
"GITHUB_BASE_REF"
)
elif [[ "${CIRCLECI:-}" == "true" ]]; then
RUNNING_IN_CI="true"
TRAMPOLINE_CI="circleci"
pass_down_envvars+=(
"CIRCLE_BRANCH"
"CIRCLE_BUILD_NUM"
"CIRCLE_BUILD_URL"
"CIRCLE_COMPARE_URL"
"CIRCLE_JOB"
"CIRCLE_NODE_INDEX"
"CIRCLE_NODE_TOTAL"
"CIRCLE_PREVIOUS_BUILD_NUM"
"CIRCLE_PROJECT_REPONAME"
"CIRCLE_PROJECT_USERNAME"
"CIRCLE_REPOSITORY_URL"
"CIRCLE_SHA1"
"CIRCLE_STAGE"
"CIRCLE_USERNAME"
"CIRCLE_WORKFLOW_ID"
"CIRCLE_WORKFLOW_JOB_ID"
"CIRCLE_WORKFLOW_UPSTREAM_JOB_IDS"
"CIRCLE_WORKFLOW_WORKSPACE_ID"
)
fi
# Configure the service account for pulling the docker image.
function repo_root() {
local dir="$1"
while [[ ! -d "${dir}/.git" ]]; do
dir="$(dirname "$dir")"
done
echo "${dir}"
}
# Detect the project root. In CI builds, we assume the script is in
# the git tree and traverse from there, otherwise, traverse from `pwd`
# to find `.git` directory.
if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then
PROGRAM_PATH="$(realpath "$0")"
PROGRAM_DIR="$(dirname "${PROGRAM_PATH}")"
PROJECT_ROOT="$(repo_root "${PROGRAM_DIR}")"
else
PROJECT_ROOT="$(repo_root "$(pwd)")"
fi
log_yellow "Changing to the project root: ${PROJECT_ROOT}."
cd "${PROJECT_ROOT}"
# To support relative path for `TRAMPOLINE_SERVICE_ACCOUNT`, we need
# to use this environment variable in `PROJECT_ROOT`.
if [[ -n "${TRAMPOLINE_SERVICE_ACCOUNT:-}" ]]; then
mkdir -p "${tmpdir}/gcloud"
gcloud_config_dir="${tmpdir}/gcloud"
log_yellow "Using isolated gcloud config: ${gcloud_config_dir}."
export CLOUDSDK_CONFIG="${gcloud_config_dir}"
log_yellow "Using ${TRAMPOLINE_SERVICE_ACCOUNT} for authentication."
gcloud auth activate-service-account \
--key-file "${TRAMPOLINE_SERVICE_ACCOUNT}"
log_yellow "Configuring Container Registry access"
gcloud auth configure-docker --quiet
fi
required_envvars=(
# The basic trampoline configurations.
"TRAMPOLINE_IMAGE"
"TRAMPOLINE_BUILD_FILE"
)
if [[ -f "${PROJECT_ROOT}/.trampolinerc" ]]; then
source "${PROJECT_ROOT}/.trampolinerc"
fi
log_yellow "Checking environment variables."
for e in "${required_envvars[@]}"
do
if [[ -z "${!e:-}" ]]; then
log "Missing ${e} env var. Aborting."
exit 1
fi
done
# We want to support legacy style TRAMPOLINE_BUILD_FILE used with V1
# script: e.g. "github/repo-name/.kokoro/run_tests.sh"
TRAMPOLINE_BUILD_FILE="${TRAMPOLINE_BUILD_FILE#github/*/}"
log_yellow "Using TRAMPOLINE_BUILD_FILE: ${TRAMPOLINE_BUILD_FILE}"
# ignore error on docker operations and test execution
set +e
log_yellow "Preparing Docker image."
# We only download the docker image in CI builds.
if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then
# Download the docker image specified by `TRAMPOLINE_IMAGE`
# We may want to add --max-concurrent-downloads flag.
log_yellow "Start pulling the Docker image: ${TRAMPOLINE_IMAGE}."
if docker pull "${TRAMPOLINE_IMAGE}"; then
log_green "Finished pulling the Docker image: ${TRAMPOLINE_IMAGE}."
has_image="true"
else
log_red "Failed pulling the Docker image: ${TRAMPOLINE_IMAGE}."
has_image="false"
fi
else
# For local run, check if we have the image.
if docker images "${TRAMPOLINE_IMAGE}" | grep "${TRAMPOLINE_IMAGE%:*}"; then
has_image="true"
else
has_image="false"
fi
fi
# The default user for a Docker container has uid 0 (root). To avoid
# creating root-owned files in the build directory we tell docker to
# use the current user ID.
user_uid="$(id -u)"
user_gid="$(id -g)"
user_name="$(id -un)"
# To allow docker in docker, we add the user to the docker group in
# the host os.
docker_gid=$(cut -d: -f3 < <(getent group docker))
update_cache="false"
if [[ "${TRAMPOLINE_DOCKERFILE:-none}" != "none" ]]; then
# Build the Docker image from the source.
context_dir=$(dirname "${TRAMPOLINE_DOCKERFILE}")
docker_build_flags=(
"-f" "${TRAMPOLINE_DOCKERFILE}"
"-t" "${TRAMPOLINE_IMAGE}"
"--build-arg" "UID=${user_uid}"
"--build-arg" "USERNAME=${user_name}"
)
if [[ "${has_image}" == "true" ]]; then
docker_build_flags+=("--cache-from" "${TRAMPOLINE_IMAGE}")
fi
log_yellow "Start building the docker image."
if [[ "${TRAMPOLINE_VERBOSE:-false}" == "true" ]]; then
echo "docker build" "${docker_build_flags[@]}" "${context_dir}"
fi
# ON CI systems, we want to suppress docker build logs, only
# output the logs when it fails.
if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then
if docker build "${docker_build_flags[@]}" "${context_dir}" \
> "${tmpdir}/docker_build.log" 2>&1; then
if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then
cat "${tmpdir}/docker_build.log"
fi
log_green "Finished building the docker image."
update_cache="true"
else
log_red "Failed to build the Docker image, aborting."
log_yellow "Dumping the build logs:"
cat "${tmpdir}/docker_build.log"
exit 1
fi
else
if docker build "${docker_build_flags[@]}" "${context_dir}"; then
log_green "Finished building the docker image."
update_cache="true"
else
log_red "Failed to build the Docker image, aborting."
exit 1
fi
fi
else
if [[ "${has_image}" != "true" ]]; then
log_red "We do not have ${TRAMPOLINE_IMAGE} locally, aborting."
exit 1
fi
fi
# We use an array for the flags so they are easier to document.
docker_flags=(
# Remove the container after it exists.
"--rm"
# Use the host network.
"--network=host"
# Run in privileged mode. We are not using docker for sandboxing or
# isolation, just for packaging our dev tools.
"--privileged"
# Run the docker script with the user id. Because the docker image gets to
# write in ${PWD} you typically want this to be your user id.
# To allow docker in docker, we need to use docker gid on the host.
"--user" "${user_uid}:${docker_gid}"
# Pass down the USER.
"--env" "USER=${user_name}"
# Mount the project directory inside the Docker container.
"--volume" "${PROJECT_ROOT}:${TRAMPOLINE_WORKSPACE}"
"--workdir" "${TRAMPOLINE_WORKSPACE}"
"--env" "PROJECT_ROOT=${TRAMPOLINE_WORKSPACE}"
# Mount the temporary home directory.
"--volume" "${tmphome}:/h"
"--env" "HOME=/h"
# Allow docker in docker.
"--volume" "/var/run/docker.sock:/var/run/docker.sock"
# Mount the /tmp so that docker in docker can mount the files
# there correctly.
"--volume" "/tmp:/tmp"
# Pass down the KOKORO_GFILE_DIR and KOKORO_KEYSTORE_DIR
# TODO(tmatsuo): This part is not portable.
"--env" "TRAMPOLINE_SECRET_DIR=/secrets"
"--volume" "${KOKORO_GFILE_DIR:-/dev/shm}:/secrets/gfile"
"--env" "KOKORO_GFILE_DIR=/secrets/gfile"
"--volume" "${KOKORO_KEYSTORE_DIR:-/dev/shm}:/secrets/keystore"
"--env" "KOKORO_KEYSTORE_DIR=/secrets/keystore"
)
# Add an option for nicer output if the build gets a tty.
if [[ -t 0 ]]; then
docker_flags+=("-it")
fi
# Passing down env vars
for e in "${pass_down_envvars[@]}"
do
if [[ -n "${!e:-}" ]]; then
docker_flags+=("--env" "${e}=${!e}")
fi
done
# If arguments are given, all arguments will become the commands run
# in the container, otherwise run TRAMPOLINE_BUILD_FILE.
if [[ $# -ge 1 ]]; then
log_yellow "Running the given commands '" "${@:1}" "' in the container."
readonly commands=("${@:1}")
if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then
echo docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" "${commands[@]}"
fi
docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" "${commands[@]}"
else
log_yellow "Running the tests in a Docker container."
docker_flags+=("--entrypoint=${TRAMPOLINE_BUILD_FILE}")
if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then
echo docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}"
fi
docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}"
fi
test_retval=$?
if [[ ${test_retval} -eq 0 ]]; then
log_green "Build finished with ${test_retval}"
else
log_red "Build finished with ${test_retval}"
fi
# Only upload it when the test passes.
if [[ "${update_cache}" == "true" ]] && \
[[ $test_retval == 0 ]] && \
[[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]]; then
log_yellow "Uploading the Docker image."
if docker push "${TRAMPOLINE_IMAGE}"; then
log_green "Finished uploading the Docker image."
else
log_red "Failed uploading the Docker image."
fi
# Call trampoline_after_upload_hook if it's defined.
if function_exists trampoline_after_upload_hook; then
trampoline_after_upload_hook
fi
fi
exit "${test_retval}"
================================================
FILE: .prettierignore
================================================
**/node_modules
build/
docs/
test/
system_test/
sdk_schema_test/
src/**/test/
================================================
FILE: .prettierrc.js
================================================
/**
* @license
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module.exports = {
...require('gts/.prettierrc.json')
};
================================================
FILE: .release-please-manifest.json
================================================
{
".": "0.6.0"
}
================================================
FILE: .repo-metadata.json
================================================
{
"name": "vertexai",
"name_pretty": "Google Cloud Vertex AI",
"release_level": "preview",
"language": "nodejs",
"repo": "googleapis/nodejs-vertexai",
"distribution_name": "@google-cloud/vertexai",
"api_id": "aiplatform.googleapis.com",
"api_shortname": "aiplatform",
"library_type": "GAPIC_MANUAL",
"client_documentation": "https://cloud.google.com/nodejs/docs/reference/vertexai/latest"
}
================================================
FILE: .trampolinerc
================================================
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Template for .trampolinerc
# Add required env vars here.
required_envvars+=(
)
# Add env vars which are passed down into the container here.
pass_down_envvars+=(
"AUTORELEASE_PR"
"VERSION"
)
# Prevent unintentional override on the default image.
if [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]] && \
[[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then
echo "Please set TRAMPOLINE_IMAGE if you want to upload the Docker image."
exit 1
fi
# Define the default value if it makes sense.
if [[ -z "${TRAMPOLINE_IMAGE_UPLOAD:-}" ]]; then
TRAMPOLINE_IMAGE_UPLOAD=""
fi
if [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then
TRAMPOLINE_IMAGE=""
fi
if [[ -z "${TRAMPOLINE_DOCKERFILE:-}" ]]; then
TRAMPOLINE_DOCKERFILE=""
fi
if [[ -z "${TRAMPOLINE_BUILD_FILE:-}" ]]; then
TRAMPOLINE_BUILD_FILE=""
fi
# Secret Manager secrets.
source ${PROJECT_ROOT}/.kokoro/populate-secrets.sh
================================================
FILE: CHANGELOG.md
================================================
# Changelog
## [0.6.0](https://github.com/googleapis/nodejs-vertexai/compare/v0.5.0...v0.6.0) (2026-05-13)
### Features
* Update minimum supported Node version to Node 20 ([e2a384e](https://github.com/googleapis/nodejs-vertexai/commit/e2a384e88744914fe8daab01d4ea1f5765cd8700))
* BREAKING CHANGE - Rename the package `@google-cloud/agentplatform` ([adf4388](https://github.com/googleapis/nodejs-vertexai/commit/adf438868e497a4b0118950bc6ed7ba467ec02f6))
## [1.12.0](https://github.com/googleapis/nodejs-vertexai/compare/v1.11.0...v1.12.0) (2026-04-14)
### Features
* Add Agent Engine-level configuration for generation_trigger_config. ([365a14a](https://github.com/googleapis/nodejs-vertexai/commit/365a14ae4b05f81df52fd9fbfe2d3ac3371a2b97))
* Add ingest_events method for Memory Bank. ([365a14a](https://github.com/googleapis/nodejs-vertexai/commit/365a14ae4b05f81df52fd9fbfe2d3ac3371a2b97))
* Add memory_types filter to RetrieveMemories ([90e3f69](https://github.com/googleapis/nodejs-vertexai/commit/90e3f6922caebb65535958081d18b200246cef60))
* Add RetrieveProfiles. ([90e3f69](https://github.com/googleapis/nodejs-vertexai/commit/90e3f6922caebb65535958081d18b200246cef60))
* Add structured data and context to MemoryRevision. ([90e3f69](https://github.com/googleapis/nodejs-vertexai/commit/90e3f6922caebb65535958081d18b200246cef60))
* Add structured data and memory type to Memory. ([90e3f69](https://github.com/googleapis/nodejs-vertexai/commit/90e3f6922caebb65535958081d18b200246cef60))
* Add subset_topics to Memory Bank GenerateMemories ([7932c2b](https://github.com/googleapis/nodejs-vertexai/commit/7932c2b49a05d26c5656bb996cd09709d60670c9))
* Add support for agent gateway in agent engine ([b3ea8e3](https://github.com/googleapis/nodejs-vertexai/commit/b3ea8e3a8fdb90e05c5531e01f4ec1284c105af6))
* add support for keep alive probe in agent engines ([088c5ad](https://github.com/googleapis/nodejs-vertexai/commit/088c5ad3edabb13e49dc520a945ac0f48b145704))
* Adds cancel_query_job to SDK for agent engine long running async tasks. ([bc19f31](https://github.com/googleapis/nodejs-vertexai/commit/bc19f31d0f86bdd9f42572a8d0a4ef94e82684e5))
## [1.11.0](https://github.com/googleapis/nodejs-vertexai/compare/v1.10.4...v1.11.0) (2026-04-07)
### Features
* Add consolidation customization to Memory Bank ([9df74eb](https://github.com/googleapis/nodejs-vertexai/commit/9df74eb4c128084d9746b8cf26570a7a04452178))
* Add session_id to Create Session to allow custom session id ([fed70af](https://github.com/googleapis/nodejs-vertexai/commit/fed70afa92c42331efa5633c80184d27b8d0a1c4))
* In run_query_job, rename gcs_bucket to gcs_uri and allow the case that user sets the filename for the output. ([4a1a387](https://github.com/googleapis/nodejs-vertexai/commit/4a1a3870cb368e574cb51ef7a284b82a3b09f935))
## [1.10.4](https://github.com/googleapis/nodejs-vertexai/compare/v1.10.3...v1.10.4) (2026-03-31)
### Features
* Add memory_id to Create Memory ([73207d3](https://github.com/googleapis/nodejs-vertexai/commit/73207d37f72df9475c8919bbace08e8d531daa7f))
* Add raw_event to Append Event ([73207d3](https://github.com/googleapis/nodejs-vertexai/commit/73207d37f72df9475c8919bbace08e8d531daa7f))
* add support for container_spec in AgentEngines ([274e0ff](https://github.com/googleapis/nodejs-vertexai/commit/274e0ff4861a5d7ec5a157300b4675ca6aa70695))
### Miscellaneous Chores
* release 1.10.4 ([15988b8](https://github.com/googleapis/nodejs-vertexai/commit/15988b8e5810d9faebebfaca2c0963b74dea5b90))
## [1.10.3](https://github.com/googleapis/nodejs-vertexai/compare/v1.10.2...v1.10.3) (2026-03-24)
### Miscellaneous Chores
* release 1.10.3 ([6a68cbe](https://github.com/googleapis/nodejs-vertexai/commit/6a68cbe24119a879f963587646fd9d69fecb9fc2))
## [1.10.2](https://github.com/googleapis/nodejs-vertexai/compare/v1.10.1...v1.10.2) (2026-03-19)
### Miscellaneous Chores
* release 1.10.2 ([431950d](https://github.com/googleapis/nodejs-vertexai/commit/431950d9a41db230b798bc01cfe4ba3d48254584))
## [1.10.1](https://github.com/googleapis/nodejs-vertexai/compare/v1.10.0...v1.10.1) (2026-03-18)
### Miscellaneous Chores
* release 1.10.1 ([3c7a6e6](https://github.com/googleapis/nodejs-vertexai/commit/3c7a6e67184eaf1d9b55058834afa519c7c1ecb4))
## [1.10.0](https://github.com/googleapis/nodejs-vertexai/compare/v1.9.3...v1.10.0) (2025-04-10)
### Features
* Allow labels in GenerateContentRequest ([d210d06](https://github.com/googleapis/nodejs-vertexai/commit/d210d06a2f389911850d6dc6a04b527a8cbdf68e))
* Allow labels in GenerateContentRequest ([#466](https://github.com/googleapis/nodejs-vertexai/issues/466)) ([#501](https://github.com/googleapis/nodejs-vertexai/issues/501)) ([0075baa](https://github.com/googleapis/nodejs-vertexai/commit/0075baae578e34341afdfe3e6ec0086cca98b298))
* enable turn off the safety filter in HarmBlockThreshold enum ([1737c66](https://github.com/googleapis/nodejs-vertexai/commit/1737c6626aed0ef8d9e1904be7a79b50b7da4676))
### Bug Fixes
* aggregate text & functionCall(s) correctly ([5a53266](https://github.com/googleapis/nodejs-vertexai/commit/5a53266835b74e6d165244a67a5cb9427220d7de))
* aggregate text & functionCall(s) correctly ([5a53266](https://github.com/googleapis/nodejs-vertexai/commit/5a53266835b74e6d165244a67a5cb9427220d7de))
* aggregate text & functionCall(s) correctly ([5a53266](https://github.com/googleapis/nodejs-vertexai/commit/5a53266835b74e6d165244a67a5cb9427220d7de))
* aggregate text & functionCall(s) correctly ([#497](https://github.com/googleapis/nodejs-vertexai/issues/497)) ([b62483a](https://github.com/googleapis/nodejs-vertexai/commit/b62483a4891159ac727687ef043f7923a8f7d71d))
## [1.9.3](https://github.com/googleapis/nodejs-vertexai/compare/v1.9.2...v1.9.3) (2025-01-31)
### Bug Fixes
* a typo in chat session and missed toolConfig on chat start ([b552fea](https://github.com/googleapis/nodejs-vertexai/commit/b552fea1aac80a6e471fd082dc35c40598d5d170))
## [1.9.2](https://github.com/googleapis/nodejs-vertexai/compare/v1.9.0...v1.9.2) (2024-12-13)
### Features
* add support for audioTimestamp in GenerationConfig ([#467](https://github.com/googleapis/nodejs-vertexai/issues/467)) ([598d955](https://github.com/googleapis/nodejs-vertexai/commit/598d95580fb8302bced40837b5c4bbebc84946cf))
* enable dynamic retrieval for Google Search Retrieval grounding ([3f9eee6](https://github.com/googleapis/nodejs-vertexai/commit/3f9eee6589967164b8c1b86481468eaa5347afbd))
### Bug Fixes
* a typo in chat session and missed toolConfig on chat start ([b552fea](https://github.com/googleapis/nodejs-vertexai/commit/b552fea1aac80a6e471fd082dc35c40598d5d170))
* Add Context Cache support for ChatSessionPreview class ([#433](https://github.com/googleapis/nodejs-vertexai/issues/433)) ([df6f040](https://github.com/googleapis/nodejs-vertexai/commit/df6f0406fbaa72cd64a8f51015e51fee88518db8))
* Add Context Cache support for ChatSessionPreview class ([#433](https://github.com/googleapis/nodejs-vertexai/issues/433)) ([a3beab1](https://github.com/googleapis/nodejs-vertexai/commit/a3beab1f30540749fbeba40a13327ea078dbed69))
* include cachedContent in generate request ([#469](https://github.com/googleapis/nodejs-vertexai/issues/469)) ([a16b9d4](https://github.com/googleapis/nodejs-vertexai/commit/a16b9d48df1e3d3b8784604de08f28167f3e85bf))
* remove restriction on gsc uri for file data part. ([e694c44](https://github.com/googleapis/nodejs-vertexai/commit/e694c441b456ea7bfb3d09f89c17d71641ef355c))
### Documentation
* update README ([e9705cb](https://github.com/googleapis/nodejs-vertexai/commit/e9705cbd44154435a6ad32979e80005a8eef137d))
* update README ([a052132](https://github.com/googleapis/nodejs-vertexai/commit/a052132b91bad5ee9a42c6fe2057afceab36b542))
### Miscellaneous Chores
* release as 1.9.2 ([d54a91b](https://github.com/googleapis/nodejs-vertexai/commit/d54a91bce84980ddfa90b38318a789787912833a))
## [1.9.0](https://github.com/googleapis/nodejs-vertexai/compare/v1.8.1...v1.9.0) (2024-10-14)
### Features
* Add Context Cache support for ChatSessionPreview class ([#433](https://github.com/googleapis/nodejs-vertexai/issues/433)) ([f8a3bdf](https://github.com/googleapis/nodejs-vertexai/commit/f8a3bdf55b6ee694a8fd41df29bdba54d7f8cdc2))
### Documentation
* update README ([a052132](https://github.com/googleapis/nodejs-vertexai/commit/a052132b91bad5ee9a42c6fe2057afceab36b542))
## [1.8.1](https://github.com/googleapis/nodejs-vertexai/compare/v1.8.0...v1.8.1) (2024-09-25)
### Bug Fixes
* Fix cached contents list url ([2c4b769](https://github.com/googleapis/nodejs-vertexai/commit/2c4b7692e369385e5cd82a9b753d037d31e4e8ce))
## [1.8.0](https://github.com/googleapis/nodejs-vertexai/compare/v1.7.0...v1.8.0) (2024-09-18)
### Features
* Add CachedContent resource to Vertex AI client library. ([8c8963e](https://github.com/googleapis/nodejs-vertexai/commit/8c8963e5c62bf491d5a47f7c5a0db64fafaea0cd))
* Implement cached_content with generateContent methods ([c604b8c](https://github.com/googleapis/nodejs-vertexai/commit/c604b8caf4138537b38bdf9f57e8086d55216981))
## [1.7.0](https://github.com/googleapis/nodejs-vertexai/compare/v1.6.0...v1.7.0) (2024-08-30)
### Features
* Add GoogleApi error in ClientError.cause ([d5c67bd](https://github.com/googleapis/nodejs-vertexai/commit/d5c67bdbb7d40f0c8eecca505c90bac21e4fe36d))
## [1.6.0](https://github.com/googleapis/nodejs-vertexai/compare/v1.5.0...v1.6.0) (2024-08-26)
### Features
* Add responseSchema to GenerateContentRequest. ([d3715da](https://github.com/googleapis/nodejs-vertexai/commit/d3715daa793fda8063b379d16a0bf844a90b4087))
* Add tool config ([f618132](https://github.com/googleapis/nodejs-vertexai/commit/f618132b7b5f9a05ba32b5968ccec14c9c18baaa))
## [1.5.0](https://github.com/googleapis/nodejs-vertexai/compare/v1.4.1...v1.5.0) (2024-08-21)
### Features
* missing property frequencyPenalty in type defintions ([#394](https://github.com/googleapis/nodejs-vertexai/issues/394)) ([7557a83](https://github.com/googleapis/nodejs-vertexai/commit/7557a839b96a9fddc17c6516dd9c8c12772b6c59))
## [1.4.1](https://github.com/googleapis/nodejs-vertexai/compare/v1.4.0...v1.4.1) (2024-08-09)
### Bug Fixes
* Fix docstring order and add node version badge in README ([d330fe3](https://github.com/googleapis/nodejs-vertexai/commit/d330fe3352713226794ac3e8c7a7a21474a32ec1))
## [1.4.0](https://github.com/googleapis/nodejs-vertexai/compare/v1.3.0...v1.4.0) (2024-07-15)
### Features
* support responseMimeType in GenerationConfig to allow users specify output response mimetype of the generated candidate text. ([93f6d70](https://github.com/googleapis/nodejs-vertexai/commit/93f6d70660dbee44f81766544047da7baf427e30))
### Bug Fixes
* handle case when content is undefined in candidate. ([f16f040](https://github.com/googleapis/nodejs-vertexai/commit/f16f0405c0419152119385780ba21b2d9c18dc9b))
## [1.3.0](https://github.com/googleapis/nodejs-vertexai/compare/v1.2.0...v1.3.0) (2024-06-26)
### Features
* infer project ID when user don't specify and throw if inference fails ([6b3e68e](https://github.com/googleapis/nodejs-vertexai/commit/6b3e68e3b869659d17ef584995de7d7bfc1b1f3b))
### Bug Fixes
* improve error message to help with debugging ([8a937d5](https://github.com/googleapis/nodejs-vertexai/commit/8a937d5f534f54867fd62a988dbd84ebafb5b76a))
## [1.2.0](https://github.com/googleapis/nodejs-vertexai/compare/v1.1.0...v1.2.0) (2024-05-22)
### Features
* allow users to pass string as system instruction ([a824162](https://github.com/googleapis/nodejs-vertexai/commit/a824162a29b8c6ba3ccae46c492dd28e9c2baf9c))
* enable inference request to tuned model. ([de9c4c2](https://github.com/googleapis/nodejs-vertexai/commit/de9c4c2f8c63a298bd28ab69dae9b6a5d72c20d7))
* infer location if user doesn't specifies it. ([b8d4af1](https://github.com/googleapis/nodejs-vertexai/commit/b8d4af1bb990e95093f446c808194bfc4fe53287))
* support RAG in public preview ([5ade755](https://github.com/googleapis/nodejs-vertexai/commit/5ade7551fe0dbab54bc56f251c32bf3b7802c2c5))
* update grounding metadata ([d3c0a64](https://github.com/googleapis/nodejs-vertexai/commit/d3c0a647248be6be49b6b93a18aad79c10bae6c4))
### Bug Fixes
* log instead of throw appendHistory errors to avoid unhandled rejection ([2ec9e7d](https://github.com/googleapis/nodejs-vertexai/commit/2ec9e7d5519af438eb03b9f21f90b86f2575ac47))
## [1.1.0](https://github.com/googleapis/nodejs-vertexai/compare/v1.0.0...v1.1.0) (2024-04-13)
### Features
* enable system instruction for GenerativeModel ([590ca5a](https://github.com/googleapis/nodejs-vertexai/commit/590ca5a055e65b493c7d20f3983173dc8a8cbc39))
* enable system instruction in chat experience ([7e71f75](https://github.com/googleapis/nodejs-vertexai/commit/7e71f750104cf14f465bb8091f851b5692f5aea9))
* exposing customHeader in requestOptions to allow users pass in customer headers. ([b47d733](https://github.com/googleapis/nodejs-vertexai/commit/b47d733680837233b4323f4113737421099df02b))
## [1.0.0](https://github.com/googleapis/nodejs-vertexai/compare/v0.5.0...v1.0.0) (2024-04-04)
### Features
* added userAgent option to RequestOptions to allow setting User-Agent header ([ca43e2f](https://github.com/googleapis/nodejs-vertexai/commit/ca43e2f0b4ebef60d3739b10a3707cdfe2e2a4ec))
* include grounding metadata to stream aggregated response. ([d32755e](https://github.com/googleapis/nodejs-vertexai/commit/d32755e41ca36a52bfd55dafd45bf5a1a8835b7b))
* Support functionCalls property in GenerationContentCandidate interface for non streaming mode ([89568a6](https://github.com/googleapis/nodejs-vertexai/commit/89568a654550f51ed7e280eb6108f6bdb13e7a92))
### Bug Fixes
* check optional field in aggregate response ([f7718ae](https://github.com/googleapis/nodejs-vertexai/commit/f7718aec22f2806bfda18cc75d2ba2c47c929efe))
* correct CitationMetadata interface. refactor nested function ([722b7fd](https://github.com/googleapis/nodejs-vertexai/commit/722b7fda23fd03e85b418e71cfacf2206596fc86))
* correct code snippets in README ([bdcc5fd](https://github.com/googleapis/nodejs-vertexai/commit/bdcc5fdda9325c37a2efcfc9c00e8cf90fae1f46))
* correct GenerateContentCandidate interface and GenerateContentResponse interface ([7a366ab](https://github.com/googleapis/nodejs-vertexai/commit/7a366abfc13b87e93bc233e045b8e173ae6357b5))
* correct sys test logic on stream endpoint for funcion calling ([1fd5b72](https://github.com/googleapis/nodejs-vertexai/commit/1fd5b725a6537ddca0b93c34be04a4ad8f9f50b6))
* Fix a bug in the Vertex AI client library. ([8ad7dfb](https://github.com/googleapis/nodejs-vertexai/commit/8ad7dfbd7090868ed89a155aa9519ed220c23451))
* fix bug in safetyRatings handling, fix incomplete content interfaces, and add unit test for stream response handling ([e573ce6](https://github.com/googleapis/nodejs-vertexai/commit/e573ce68bda3fabdc75ffbacc56421215cbe2f70))
* for function call, role should be model. ([3b80dc8](https://github.com/googleapis/nodejs-vertexai/commit/3b80dc86b8c5d1e4be0afe99bca35201fd812abb))
* functionResponse should be user role ([d092ab4](https://github.com/googleapis/nodejs-vertexai/commit/d092ab4bb0862fc8471e663a4fb7084b432baf74))
* Make appendHistory private. ([a1bedcd](https://github.com/googleapis/nodejs-vertexai/commit/a1bedcdb6fe71d73a7601c4fafda699b0b8d1698))
* pass tools from getGenerativeModel and startChat methods to top level functions ([bbaf78a](https://github.com/googleapis/nodejs-vertexai/commit/bbaf78a5286ca39074b72bcce7eb7856fe0bec70))
* pass tools from getGenerativeModel to chatSession. ([907ad74](https://github.com/googleapis/nodejs-vertexai/commit/907ad74aefe24082607431c34027df6ae6d46a08))
* remove any type in token signature ([add084c](https://github.com/googleapis/nodejs-vertexai/commit/add084c6c1657f92a43c102159abceb0b7121b0c))
* remove defaulting value of candidates in unary api. remove unused variables and imports. remove throwing GoogleAIError when candidates undefined or empty. ([6c0c31c](https://github.com/googleapis/nodejs-vertexai/commit/6c0c31c2d798f32739fb0d8b647d4289168cc446))
* replace any type with explicit types in post fetch processing functions ([4099129](https://github.com/googleapis/nodejs-vertexai/commit/4099129d8497ec39fd1410e3edfc7599f2a91db8))
* replace snake_case in docs to camelCase ([5893581](https://github.com/googleapis/nodejs-vertexai/commit/5893581b17b9f1df28410f1315c2fd760acc98b6))
* SDK should be released to 1.0.0 ([4cab5fd](https://github.com/googleapis/nodejs-vertexai/commit/4cab5fd814bb0c47c98b5be2ed250f5a3765cd6e))
* update finish reason enum list to be complete ([f16b2e7](https://github.com/googleapis/nodejs-vertexai/commit/f16b2e778f1c0d250404928d85f12e775fc0f720))
* update prompt feedback interface ([0d3754a](https://github.com/googleapis/nodejs-vertexai/commit/0d3754ac7c51b73281342cdb20b22af5918045fa))
## [0.5.0](https://github.com/googleapis/nodejs-vertexai/compare/v0.4.0...v0.5.0) (2024-02-29)
### Features
* Introduce Request Timeout Configuration ([1b37f40](https://github.com/googleapis/nodejs-vertexai/commit/1b37f4045f604dac10c91ba800b34c6beadd113a))
### Bug Fixes
* correct UsageMetadata schema ([10bc676](https://github.com/googleapis/nodejs-vertexai/commit/10bc67666a64d6ea7dd103c3dae678b8080735c1))
* include usageMetadata in stream aggregated response ([a1154c9](https://github.com/googleapis/nodejs-vertexai/commit/a1154c9a91bb5d9cd988a00be4b462ee013fa704))
## [0.4.0](https://github.com/googleapis/nodejs-vertexai/compare/v0.3.1...v0.4.0) (2024-02-15)
### Features
* Added support for Grounding ([929df39](https://github.com/googleapis/nodejs-vertexai/commit/929df39f19f423bcfaf35ef113ce04886345a6ab))
* enable both GA and preview namespaces. ([1c2aca6](https://github.com/googleapis/nodejs-vertexai/commit/1c2aca6b776784a5b51d1654ffa41dc36f600874))
### Bug Fixes
* throw more details on error message. ([5dba79c](https://github.com/googleapis/nodejs-vertexai/commit/5dba79c3648203b9a66b6098f9f1fa0280e6e67d))
* unary api should only need to `await` once. ([67a2e96](https://github.com/googleapis/nodejs-vertexai/commit/67a2e9649c69a2cf9868a074527efd93d2c800c9))
## [0.3.1](https://github.com/googleapis/nodejs-vertexai/compare/v0.3.0...v0.3.1) (2024-02-06)
### Bug Fixes
* decouple dependency between VertexAI_Preivew and GenerativeModel classes ([6762c99](https://github.com/googleapis/nodejs-vertexai/commit/6762c995bfa1bfdb740ed01a2eb4385126b0e36a))
* Switch NodeJS generateContent to call Unary API endpoint ([e4edb59](https://github.com/googleapis/nodejs-vertexai/commit/e4edb599863c23a896e263ba2639c80481a65543))
## [0.3.0](https://github.com/googleapis/nodejs-vertexai/compare/v0.2.1...v0.3.0) (2024-01-30)
### Features
* add function calling support ([1deb4e9](https://github.com/googleapis/nodejs-vertexai/commit/1deb4e920205d2fff6da780175de6045bd853885))
### Bug Fixes
* throw error when GoogleAuthOptions.scopes doesn't include required scope. ([558aee9](https://github.com/googleapis/nodejs-vertexai/commit/558aee98d76192b4a63b3d28abba3f3d4cda1762))
* throws instructive client side error message when bad request happens for function calling ([c90203d](https://github.com/googleapis/nodejs-vertexai/commit/c90203d153407daa08763c273a827a5e9db54a70))
## [0.2.1](https://github.com/googleapis/nodejs-vertexai/compare/v0.2.0...v0.2.1) (2024-01-05)
### Bug Fixes
* enable passing only a string to generateContent and generateContentStream ([c50811e](https://github.com/googleapis/nodejs-vertexai/commit/c50811e5443848edb8f9ce5d88ae4c6c8b59b65b))
## [0.2.0](https://github.com/googleapis/nodejs-vertexai/compare/v0.1.3...v0.2.0) (2024-01-03)
### Features
* allow user to pass "models/model-ID" to instantiate model ([e94b285](https://github.com/googleapis/nodejs-vertexai/commit/e94b285dac6aaf0c77c6b9c6220b29b8d4aced52))
* include all supported authentication options ([257355c](https://github.com/googleapis/nodejs-vertexai/commit/257355ca09ee298623198404a4f889f5cf7788ee))
### Bug Fixes
* processing of streams, including UTF ([63ce032](https://github.com/googleapis/nodejs-vertexai/commit/63ce032461a32e9e5fdf04d8ce2d4d8628d691b1))
* remove placeholder cache attribute of access token ([3ec92e7](https://github.com/googleapis/nodejs-vertexai/commit/3ec92e71a9f7ef4a55bf64037f363ec6be6a729d))
* update safety return types ([449c7a2](https://github.com/googleapis/nodejs-vertexai/commit/449c7a2af2272add956eb44d8e617878468af344))
* throw ClientError or GoogleGenerativeAIError according to response status so that users can catch them and handle them according to class name. ([ea0dcb7](https://github.com/googleapis/nodejs-vertexai/commit/ea0dcb717be8d22d98916252ccee352e9af4a09f))
## [0.1.3](https://github.com/googleapis/nodejs-vertexai/compare/v0.1.2...v0.1.3) (2023-12-13)
### Bug Fixes
* Add samples link to readme ([3a86e85](https://github.com/googleapis/nodejs-vertexai/commit/3a86e85de034479818813e563cef6badd68074ab))
* update header field ([eab8841](https://github.com/googleapis/nodejs-vertexai/commit/eab8841f42679e976d4b1eca8dc083330380daff))
## [0.1.2](https://github.com/googleapis/nodejs-vertexai/compare/v0.1.1...v0.1.2) (2023-12-13)
### Bug Fixes
* update readme ([b01bd39](https://github.com/googleapis/nodejs-vertexai/commit/b01bd391a34f7b7b65d8e267ca169f52f5a48217))
## [0.1.1](https://github.com/googleapis/nodejs-vertexai/compare/v0.1.0...v0.1.1) (2023-12-12)
### Bug Fixes
* fix stream send message content ([ad1e17e](https://github.com/googleapis/nodejs-vertexai/commit/ad1e17e81c72ce55d395bcae36326d48d595d175))
## 0.1.0 (2023-12-12)
### Features
* add streamGenerateContent method ([6263800](https://github.com/googleapis/nodejs-vertexai/commit/626380039d7bb2fb9af9219f70ad549950b5f490))
* add streamSendMessage method ([598b1dd](https://github.com/googleapis/nodejs-vertexai/commit/598b1dd7ca8d84c9b32e633a65634abea232f7de))
* add generateContent method ([d7f1f0f](https://github.com/googleapis/nodejs-vertexai/commit/d7f1f0f66b7bf22c2cb59a8ef698b426cf7e3b8b))
* add countTokens method ([e0265a3](https://github.com/googleapis/nodejs-vertexai/commit/e0265a36d73b460c66062a0b520b5556d0aa894b))
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of
experience, education, socio-economic status, nationality, personal appearance,
race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening,
offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
This Code of Conduct also applies outside the project spaces when the Project
Steward has a reasonable belief that an individual's behavior may have a
negative impact on the project or its community.
## Conflict Resolution
We do not believe that all conflict is bad; healthy debate and disagreement
often yield positive results. However, it is never okay to be disrespectful or
to engage in behavior that violates the project’s code of conduct.
If you see someone violating the code of conduct, you are encouraged to address
the behavior directly with those involved. Many issues can be resolved quickly
and easily, and this gives people more control over the outcome of their
dispute. If you are unable to resolve the matter for any reason, or if the
behavior is threatening or harassing, report it. We are dedicated to providing
an environment where participants feel welcome and safe.
Reports should be directed to *googleapis-stewards@google.com*, the
Project Steward(s) for *Google Cloud Client Libraries*. It is the Project Steward’s duty to
receive and address reported violations of the code of conduct. They will then
work with a committee consisting of representatives from the Open Source
Programs Office and the Google Open Source Strategy team. If for any reason you
are uncomfortable reaching out to the Project Steward, please email
opensource@google.com.
We will investigate every complaint, but you may not receive a direct response.
We will use our discretion in determining when and how to follow up on reported
incidents, which may range from not taking action to permanent expulsion from
the project and project-sponsored spaces. We will notify the accused of the
report and provide them an opportunity to discuss it before any action is taken.
The identity of the reporter will be omitted from the details of the report
supplied to the accused. In potentially harmful situations, such as ongoing
harassment or threats to anyone's safety, we may take action without notice.
## Attribution
This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
available at
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
================================================
FILE: CONTRIBUTING.md
================================================
# How to Contribute
We'd love to accept your patches and contributions to this project. There are
just a few small guidelines you need to follow.
## Contributor License Agreement
Contributions to this project must be accompanied by a Contributor License
Agreement. You (or your employer) retain the copyright to your contribution;
this simply gives us permission to use and redistribute your contributions as
part of the project. Head over to to see
your current agreements on file or to sign a new one.
You generally only need to submit a CLA once, so if you've already submitted one
(even if it was for a different project), you probably don't need to do it
again.
## Code Reviews
All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.
## Community Guidelines
This project follows [Google's Open Source Community
Guidelines](https://opensource.google/conduct/).
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
# Gemini Enterprise Agent Platform SDK for Node.js quickstart
The Agent Platform SDK for Node.js lets you use the Gemini API to build
AI-powered features and applications. Both TypeScript and JavaScript are
supported.
For the latest list of available Gemini models on Agent Platform, see the
[Model information](https://cloud.google.com/vertex-ai/docs/generative-ai/learn/models#gemini-models)
page in Agent Platform documentation.
## Before you begin
1. Make sure your node.js version is 20 or above.
1. [Select](https://console.cloud.google.com/project) or [create](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project) a Google Cloud project.
1. [Enable billing for your project](https://cloud.google.com/billing/docs/how-to/modify-project).
1. [Enable the Agent Platform API](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com).
1. [Install the gcloud CLI](https://cloud.google.com/sdk/docs/install).
1. [Initialize the gcloud CLI](https://cloud.google.com/sdk/docs/initializing).
1. Create local authentication credentials for your user account:
```sh
gcloud auth application-default login
```
A list of accepted authentication options are listed in [GoogleAuthOptions](https://github.com/googleapis/google-auth-library-nodejs/blob/3ae120d0a45c95e36c59c9ac8286483938781f30/src/auth/googleauth.ts#L87) interface of google-auth-library-node.js GitHub repo.
## Install the SDK
Install the Agent Platform SDK for Node.js by running the following command:
```shell
npm install @google-cloud/agentplatform
```
## Instantiate the Agent Platform client
First, import the `Client` class:
```typescript
import { Client } from '@google-cloud/agentplatform';
```
Then instantiate a client:
```typescript
const client: Client = new Client({
project: 'my-cloud-project',
location: 'my-cloud-location',
});
```
## License
The contents of this repository are licensed under the
[Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
================================================
FILE: SECURITY.md
================================================
# Security Policy
To report a security issue, please use [g.co/vulnz](https://g.co/vulnz).
The Google Security Team will respond within 5 working days of your report on g.co/vulnz.
We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue.
================================================
FILE: package.json
================================================
{
"name": "@google-cloud/agentplatform",
"description": "Vertex Generative AI client for Node.js",
"version": "0.6.0",
"license": "Apache-2.0",
"author": "Google LLC",
"engines": {
"node": ">=20.0.0"
},
"homepage": "https://github.com/googleapis/nodejs-vertexai",
"repository": "googleapis/nodejs-vertexai",
"main": "build/src/index.js",
"type": "commonjs",
"scripts": {
"clean": "gts clean",
"compile": "tsc -p .",
"docs": "jsdoc -c .jsdoc.js",
"predocs-test": "npm run docs",
"docs-test": "linkinator docs",
"compile:oss": "tsc -p tsconfig.json.oss",
"fix": "gts fix",
"test": "npm run test:unit",
"test:unit": "jasmine build/test/unit/*_test.js --reporter=test/spec/reporter.js",
"test:system": "jasmine build/system_test/*_test.js --reporter=test/spec/reporter.js",
"test:replays": "jasmine build/test/replays/*_test.js --reporter=test/spec/reporter.js",
"lint": "ESLINT_USE_FLAT_CONFIG=true eslint src --no-ignore --config src/eslint.config.mjs",
"format": "prettier 'src/**/*.ts' 'src/**/*.mjs' --write",
"clean-js-files": "find . -type f -name \"*.js\" -exec rm -f {} +",
"clean-js-map-files": "find . -type f -name \"*.js.map\" -exec rm -f {} +",
"postpack": "if [ \"${CLEAN}\" ]; then npm run clean-after-pack; fi",
"cover": "npm run cover:unit && npm run cover:integration && npm run cover:report",
"cover:unit": "nyc npm run test",
"cover:integration": "nyc --no-clean npm run test:system",
"cover:report": "nyc report --reporter=lcov",
"prepare": "npm run compile",
"pretest": "npm run compile",
"posttest": "npm run lint"
},
"dependencies": {
"@google/genai": "^1.45.0",
"google-auth-library": "^9.1.0"
},
"devDependencies": {
"@eslint/js": "9.20.0",
"@types/jasmine": "^5.1.2",
"@types/node": "^20.9.0",
"eslint": "8.57.0",
"gts": "^5.2.0",
"jasmine": "^5.1.0",
"jasmine-reporters": "^2.4.0",
"jsdoc": "^4.0.0",
"jsdoc-fresh": "^3.0.0",
"jsdoc-region-tag": "^3.0.0",
"linkinator": "^4.0.0",
"nyc": "^15.1.0",
"prettier": "3.3.3",
"prettier-plugin-organize-imports": "^4.1.0",
"typescript": "~5.4.0",
"typescript-eslint": "8.24.1"
},
"files": [
"build/src",
"!build/**/*.map"
]
}
================================================
FILE: release-please-config.json
================================================
{
"initial-version": "0.5.0",
"release-type": "node",
"include-component-in-tag": false,
"packages": {
".": {
"extra-files": [
"src/client.ts"
]
}
}
}
================================================
FILE: src/.prettierignore
================================================
# Ignore autogenerated files:
agentengines.ts
_internal_types.ts
sessionevents.ts
sessions.ts
types/**
types.ts
converters/**
# Ignore built files:
dist/**
================================================
FILE: src/.prettierrc
================================================
{
"printWidth" : 80,
"tabWidth" : 2,
"useTabs" : false,
"semi" : true,
"singleQuote" : true,
"quoteProps" : "preserve",
"bracketSpacing" : false,
"trailingComma" : "all",
"arrowParens" : "always",
"embeddedLanguageFormatting" : "off",
"bracketSameLine" : true,
"singleAttributePerLine" : false,
"htmlWhitespaceSensitivity" : "strict",
"plugins": ["prettier-plugin-organize-imports"],
}
================================================
FILE: src/_internal_types.ts
================================================
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
================================================
FILE: src/agentengines.ts
================================================
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
import * as common from '@google/genai/vertex_internal';
import {ApiClient, BaseModule} from '@google/genai/vertex_internal';
import * as converters from './converters/_agentengines_converters.js';
import {Memories} from './memories.js';
import {Sandboxes} from './sandboxes.js';
import {Sessions} from './sessions.js';
import * as types from './types.js';
export class AgentEngines extends BaseModule {
public readonly sessions: Sessions;
public readonly sandboxes: Sandboxes;
public readonly memories: Memories;
constructor(private readonly apiClient: ApiClient) {
super();
this.sessions = new Sessions(apiClient);
this.sandboxes = new Sandboxes(apiClient);
this.memories = new Memories(apiClient);
}
async createInternal(
params: types.CreateAgentEngineRequestParameters,
): Promise {
let response: Promise;
let path: string = '';
let queryParams: Record = {};
if (this.apiClient.isVertexAI()) {
const body =
converters.createAgentEngineRequestParametersToVertex(params);
path = common.formatMap(
'reasoningEngines',
body['_url'] as Record,
);
queryParams = body['_query'] as Record;
delete body['_url'];
delete body['_query'];
delete body['config'];
response = this.apiClient
.request({
path: path,
queryParams: queryParams,
body: JSON.stringify(body),
httpMethod: 'POST',
httpOptions: params.config?.httpOptions,
abortSignal: params.config?.abortSignal,
})
.then((httpResponse) => {
return httpResponse.json();
}) as Promise;
return response.then((apiResponse) => {
const resp = converters.agentEngineOperationFromVertex(apiResponse);
return resp as types.AgentEngineOperation;
});
} else {
throw new Error(
'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).',
);
}
}
async deleteInternal(
params: types.DeleteAgentEngineRequestParameters,
): Promise {
let response: Promise;
let path: string = '';
let queryParams: Record = {};
if (this.apiClient.isVertexAI()) {
const body =
converters.deleteAgentEngineRequestParametersToVertex(params);
path = common.formatMap(
'{name}',
body['_url'] as Record,
);
queryParams = body['_query'] as Record;
delete body['_url'];
delete body['_query'];
delete body['config'];
response = this.apiClient
.request({
path: path,
queryParams: queryParams,
body: JSON.stringify(body),
httpMethod: 'DELETE',
httpOptions: params.config?.httpOptions,
abortSignal: params.config?.abortSignal,
})
.then((httpResponse) => {
return httpResponse.json();
}) as Promise;
return response.then((resp) => {
return resp as types.DeleteAgentEngineOperation;
});
} else {
throw new Error(
'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).',
);
}
}
async getInternal(
params: types.GetAgentEngineRequestParameters,
): Promise {
let response: Promise;
let path: string = '';
let queryParams: Record = {};
if (this.apiClient.isVertexAI()) {
const body = converters.getAgentEngineRequestParametersToVertex(params);
path = common.formatMap(
'{name}',
body['_url'] as Record,
);
queryParams = body['_query'] as Record;
delete body['_url'];
delete body['_query'];
delete body['config'];
response = this.apiClient
.request({
path: path,
queryParams: queryParams,
body: JSON.stringify(body),
httpMethod: 'GET',
httpOptions: params.config?.httpOptions,
abortSignal: params.config?.abortSignal,
})
.then((httpResponse) => {
return httpResponse.json();
}) as Promise;
return response.then((apiResponse) => {
const resp = converters.reasoningEngineFromVertex(apiResponse);
return resp as types.ReasoningEngine;
});
} else {
throw new Error(
'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).',
);
}
}
async listInternal(
params: types.ListAgentEngineRequestParameters,
): Promise {
let response: Promise;
let path: string = '';
let queryParams: Record = {};
if (this.apiClient.isVertexAI()) {
const body = converters.listAgentEngineRequestParametersToVertex(params);
path = common.formatMap(
'reasoningEngines',
body['_url'] as Record,
);
queryParams = body['_query'] as Record;
delete body['_url'];
delete body['_query'];
delete body['config'];
response = this.apiClient
.request({
path: path,
queryParams: queryParams,
body: JSON.stringify(body),
httpMethod: 'GET',
httpOptions: params.config?.httpOptions,
abortSignal: params.config?.abortSignal,
})
.then((httpResponse) => {
return httpResponse.json();
}) as Promise;
return response.then((apiResponse) => {
const resp =
converters.listReasoningEnginesResponseFromVertex(apiResponse);
const typedResp = new types.ListReasoningEnginesResponse();
Object.assign(typedResp, resp);
return typedResp;
});
} else {
throw new Error(
'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).',
);
}
}
async getAgentOperationInternal(
params: types.GetAgentEngineOperationParameters,
): Promise {
let response: Promise;
let path: string = '';
let queryParams: Record = {};
if (this.apiClient.isVertexAI()) {
const body = converters.getAgentEngineOperationParametersToVertex(params);
path = common.formatMap(
'{operationName}',
body['_url'] as Record,
);
queryParams = body['_query'] as Record;
delete body['_url'];
delete body['_query'];
delete body['config'];
response = this.apiClient
.request({
path: path,
queryParams: queryParams,
body: JSON.stringify(body),
httpMethod: 'GET',
httpOptions: params.config?.httpOptions,
abortSignal: params.config?.abortSignal,
})
.then((httpResponse) => {
return httpResponse.json();
}) as Promise;
return response.then((apiResponse) => {
const resp = converters.agentEngineOperationFromVertex(apiResponse);
return resp as types.AgentEngineOperation;
});
} else {
throw new Error(
'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).',
);
}
}
async queryInternal(
params: types.QueryAgentEngineRequestParameters,
): Promise {
let response: Promise;
let path: string = '';
let queryParams: Record = {};
if (this.apiClient.isVertexAI()) {
const body = converters.queryAgentEngineRequestParametersToVertex(params);
path = common.formatMap(
'{name}:query',
body['_url'] as Record,
);
queryParams = body['_query'] as Record;
delete body['_url'];
delete body['_query'];
delete body['config'];
response = this.apiClient
.request({
path: path,
queryParams: queryParams,
body: JSON.stringify(body),
httpMethod: 'POST',
httpOptions: params.config?.httpOptions,
abortSignal: params.config?.abortSignal,
})
.then((httpResponse) => {
return httpResponse.json();
}) as Promise;
return response.then((resp) => {
const typedResp = new types.QueryReasoningEngineResponse();
Object.assign(typedResp, resp);
return typedResp;
});
} else {
throw new Error(
'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).',
);
}
}
async updateInternal(
params: types.UpdateAgentEngineRequestParameters,
): Promise {
let response: Promise;
let path: string = '';
let queryParams: Record = {};
if (this.apiClient.isVertexAI()) {
const body =
converters.updateAgentEngineRequestParametersToVertex(params);
path = common.formatMap(
'{name}',
body['_url'] as Record,
);
queryParams = body['_query'] as Record;
delete body['_url'];
delete body['_query'];
delete body['config'];
response = this.apiClient
.request({
path: path,
queryParams: queryParams,
body: JSON.stringify(body),
httpMethod: 'PATCH',
httpOptions: params.config?.httpOptions,
abortSignal: params.config?.abortSignal,
})
.then((httpResponse) => {
return httpResponse.json();
}) as Promise;
return response.then((apiResponse) => {
const resp = converters.agentEngineOperationFromVertex(apiResponse);
return resp as types.AgentEngineOperation;
});
} else {
throw new Error(
'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).',
);
}
}
}
================================================
FILE: src/client.ts
================================================
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {ApiClient, NodeAuth, NodeDownloader, NodeUploader,} from '@google/genai/vertex_internal';
import {AgentEngines} from './agentengines';
import {Skills} from './skills';
export const SDK_VERSION = '0.6.0'; // x-release-please-version
let agentEnginesInternalWarned = false;
export class Client {
protected readonly apiClient: ApiClient;
public readonly _agentEnginesInternal: AgentEngines;
public readonly skills: Skills;
constructor(
options: {project?: string; location?: string; apiEndpoint?: string;}) {
const auth = new NodeAuth({
googleAuthOptions: {
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
},
});
const uploader = new NodeUploader();
const downloader = new NodeDownloader();
const nodeVersion =
typeof process !== 'undefined' ? process.version : 'unknown';
this.apiClient = new ApiClient({
auth,
uploader,
downloader,
project: options.project,
location: options.location,
vertexai: true,
httpOptions: options.apiEndpoint ? {baseUrl: options.apiEndpoint} :
undefined,
userAgentExtra: '',
});
const headers = this.apiClient.clientOptions.httpOptions?.headers as
Record|
undefined;
if (headers) {
const telemetryStr =
`+vertex-genai-modules/${SDK_VERSION} gl-node/${nodeVersion}`;
if (headers['User-Agent']) {
headers['User-Agent'] = headers['User-Agent'].trim() + telemetryStr;
}
if (headers['x-goog-api-client']) {
headers['x-goog-api-client'] =
headers['x-goog-api-client'].trim() + telemetryStr;
}
}
this._agentEnginesInternal = new AgentEngines(this.apiClient);
this.skills = new Skills(this.apiClient);
}
/**
* Getter for agentEnginesInternal that logs a warning on first use.
*/
public get agentEnginesInternal(): AgentEngines {
if (!agentEnginesInternalWarned) {
console.warn(
'The agentEnginesInternal implementation is experimental, and may change in future versions.',
);
agentEnginesInternalWarned = true;
}
return this._agentEnginesInternal;
}
}
================================================
FILE: src/converters/_agentengines_converters.ts
================================================
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
import * as common from '@google/genai/vertex_internal';
import * as types from '../types.js';
export function agentEngineOperationFromVertex(
fromObject: types.AgentEngineOperation,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['name'], fromName);
}
const fromMetadata = common.getValueByPath(fromObject, ['metadata']);
if (fromMetadata != null) {
common.setValueByPath(toObject, ['metadata'], fromMetadata);
}
const fromDone = common.getValueByPath(fromObject, ['done']);
if (fromDone != null) {
common.setValueByPath(toObject, ['done'], fromDone);
}
const fromError = common.getValueByPath(fromObject, ['error']);
if (fromError != null) {
common.setValueByPath(toObject, ['error'], fromError);
}
const fromResponse = common.getValueByPath(fromObject, ['response']);
if (fromResponse != null) {
common.setValueByPath(
toObject,
['response'],
reasoningEngineFromVertex(fromResponse),
);
}
return toObject;
}
export function createAgentEngineConfigToVertex(
fromObject: types.CreateAgentEngineConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromDisplayName = common.getValueByPath(fromObject, ['displayName']);
if (parentObject !== undefined && fromDisplayName != null) {
common.setValueByPath(parentObject, ['displayName'], fromDisplayName);
}
const fromDescription = common.getValueByPath(fromObject, ['description']);
if (parentObject !== undefined && fromDescription != null) {
common.setValueByPath(parentObject, ['description'], fromDescription);
}
const fromSpec = common.getValueByPath(fromObject, ['spec']);
if (parentObject !== undefined && fromSpec != null) {
common.setValueByPath(parentObject, ['spec'], fromSpec);
}
const fromContextSpec = common.getValueByPath(fromObject, ['contextSpec']);
if (parentObject !== undefined && fromContextSpec != null) {
common.setValueByPath(
parentObject,
['contextSpec'],
reasoningEngineContextSpecToVertex(fromContextSpec),
);
}
const fromPscInterfaceConfig = common.getValueByPath(fromObject, [
'pscInterfaceConfig',
]);
if (parentObject !== undefined && fromPscInterfaceConfig != null) {
common.setValueByPath(
parentObject,
['pscInterfaceConfig'],
fromPscInterfaceConfig,
);
}
const fromEncryptionSpec = common.getValueByPath(fromObject, [
'encryptionSpec',
]);
if (parentObject !== undefined && fromEncryptionSpec != null) {
common.setValueByPath(parentObject, ['encryptionSpec'], fromEncryptionSpec);
}
const fromLabels = common.getValueByPath(fromObject, ['labels']);
if (parentObject !== undefined && fromLabels != null) {
common.setValueByPath(parentObject, ['labels'], fromLabels);
}
const fromSourcePackages = common.getValueByPath(fromObject, [
'sourcePackages',
]);
if (parentObject !== undefined && fromSourcePackages != null) {
common.setValueByPath(parentObject, ['sourcePackages'], fromSourcePackages);
}
const fromEntrypointModule = common.getValueByPath(fromObject, [
'entrypointModule',
]);
if (parentObject !== undefined && fromEntrypointModule != null) {
common.setValueByPath(
parentObject,
['entrypointModule'],
fromEntrypointModule,
);
}
const fromEntrypointObject = common.getValueByPath(fromObject, [
'entrypointObject',
]);
if (parentObject !== undefined && fromEntrypointObject != null) {
common.setValueByPath(
parentObject,
['entrypointObject'],
fromEntrypointObject,
);
}
const fromRequirementsFile = common.getValueByPath(fromObject, [
'requirementsFile',
]);
if (parentObject !== undefined && fromRequirementsFile != null) {
common.setValueByPath(
parentObject,
['requirementsFile'],
fromRequirementsFile,
);
}
const fromAgentFramework = common.getValueByPath(fromObject, [
'agentFramework',
]);
if (parentObject !== undefined && fromAgentFramework != null) {
common.setValueByPath(parentObject, ['agentFramework'], fromAgentFramework);
}
const fromPythonVersion = common.getValueByPath(fromObject, [
'pythonVersion',
]);
if (parentObject !== undefined && fromPythonVersion != null) {
common.setValueByPath(parentObject, ['pythonVersion'], fromPythonVersion);
}
const fromAgentGatewayConfig = common.getValueByPath(fromObject, [
'agentGatewayConfig',
]);
if (parentObject !== undefined && fromAgentGatewayConfig != null) {
common.setValueByPath(
parentObject,
['agentGatewayConfig'],
fromAgentGatewayConfig,
);
}
return toObject;
}
export function createAgentEngineRequestParametersToVertex(
fromObject: types.CreateAgentEngineRequestParameters,
): Record {
const toObject: Record = {};
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
createAgentEngineConfigToVertex(fromConfig, toObject);
}
return toObject;
}
export function deleteAgentEngineRequestParametersToVertex(
fromObject: types.DeleteAgentEngineRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromForce = common.getValueByPath(fromObject, ['force']);
if (fromForce != null) {
common.setValueByPath(toObject, ['force'], fromForce);
}
return toObject;
}
export function getAgentEngineOperationParametersToVertex(
fromObject: types.GetAgentEngineOperationParameters,
): Record {
const toObject: Record = {};
const fromOperationName = common.getValueByPath(fromObject, [
'operationName',
]);
if (fromOperationName != null) {
common.setValueByPath(
toObject,
['_url', 'operationName'],
fromOperationName,
);
}
return toObject;
}
export function getAgentEngineRequestParametersToVertex(
fromObject: types.GetAgentEngineRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
return toObject;
}
export function listAgentEngineConfigToVertex(
fromObject: types.ListAgentEngineConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromPageSize = common.getValueByPath(fromObject, ['pageSize']);
if (parentObject !== undefined && fromPageSize != null) {
common.setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
}
const fromPageToken = common.getValueByPath(fromObject, ['pageToken']);
if (parentObject !== undefined && fromPageToken != null) {
common.setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
}
const fromFilter = common.getValueByPath(fromObject, ['filter']);
if (parentObject !== undefined && fromFilter != null) {
common.setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
}
return toObject;
}
export function listAgentEngineRequestParametersToVertex(
fromObject: types.ListAgentEngineRequestParameters,
): Record {
const toObject: Record = {};
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
listAgentEngineConfigToVertex(fromConfig, toObject);
}
return toObject;
}
export function listReasoningEnginesResponseFromVertex(
fromObject: types.ListReasoningEnginesResponse,
): Record {
const toObject: Record = {};
const fromSdkHttpResponse = common.getValueByPath(fromObject, [
'sdkHttpResponse',
]);
if (fromSdkHttpResponse != null) {
common.setValueByPath(toObject, ['sdkHttpResponse'], fromSdkHttpResponse);
}
const fromNextPageToken = common.getValueByPath(fromObject, [
'nextPageToken',
]);
if (fromNextPageToken != null) {
common.setValueByPath(toObject, ['nextPageToken'], fromNextPageToken);
}
const fromReasoningEngines = common.getValueByPath(fromObject, [
'reasoningEngines',
]);
if (fromReasoningEngines != null) {
let transformedList = fromReasoningEngines;
if (Array.isArray(transformedList)) {
transformedList = transformedList.map((item) => {
return reasoningEngineFromVertex(item);
});
}
common.setValueByPath(toObject, ['reasoningEngines'], transformedList);
}
return toObject;
}
export function queryAgentEngineConfigToVertex(
fromObject: types.QueryAgentEngineConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromClassMethod = common.getValueByPath(fromObject, ['classMethod']);
if (parentObject !== undefined && fromClassMethod != null) {
common.setValueByPath(parentObject, ['classMethod'], fromClassMethod);
}
const fromInput = common.getValueByPath(fromObject, ['input']);
if (parentObject !== undefined && fromInput != null) {
common.setValueByPath(parentObject, ['input'], fromInput);
}
const fromIncludeAllFields = common.getValueByPath(fromObject, [
'includeAllFields',
]);
if (fromIncludeAllFields != null) {
common.setValueByPath(toObject, ['includeAllFields'], fromIncludeAllFields);
}
return toObject;
}
export function queryAgentEngineRequestParametersToVertex(
fromObject: types.QueryAgentEngineRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
queryAgentEngineConfigToVertex(fromConfig, toObject);
}
return toObject;
}
export function reasoningEngineContextSpecFromVertex(
fromObject: types.ReasoningEngineContextSpec,
): Record {
const toObject: Record = {};
const fromMemoryBankConfig = common.getValueByPath(fromObject, [
'memoryBankConfig',
]);
if (fromMemoryBankConfig != null) {
common.setValueByPath(
toObject,
['memoryBankConfig'],
reasoningEngineContextSpecMemoryBankConfigFromVertex(
fromMemoryBankConfig,
),
);
}
return toObject;
}
export function reasoningEngineContextSpecMemoryBankConfigFromVertex(
fromObject: types.ReasoningEngineContextSpecMemoryBankConfig,
): Record {
const toObject: Record = {};
const fromCustomizationConfigs = common.getValueByPath(fromObject, [
'customizationConfigs',
]);
if (fromCustomizationConfigs != null) {
let transformedList = fromCustomizationConfigs;
if (Array.isArray(transformedList)) {
transformedList = transformedList.map((item) => {
return item;
});
}
common.setValueByPath(toObject, ['customizationConfigs'], transformedList);
}
const fromDisableMemoryRevisions = common.getValueByPath(fromObject, [
'disableMemoryRevisions',
]);
if (fromDisableMemoryRevisions != null) {
common.setValueByPath(
toObject,
['disableMemoryRevisions'],
fromDisableMemoryRevisions,
);
}
const fromGenerationConfig = common.getValueByPath(fromObject, [
'generationConfig',
]);
if (fromGenerationConfig != null) {
common.setValueByPath(toObject, ['generationConfig'], fromGenerationConfig);
}
const fromSimilaritySearchConfig = common.getValueByPath(fromObject, [
'similaritySearchConfig',
]);
if (fromSimilaritySearchConfig != null) {
common.setValueByPath(
toObject,
['similaritySearchConfig'],
fromSimilaritySearchConfig,
);
}
const fromTtlConfig = common.getValueByPath(fromObject, ['ttlConfig']);
if (fromTtlConfig != null) {
common.setValueByPath(toObject, ['ttlConfig'], fromTtlConfig);
}
const fromStructuredMemoryConfigs = common.getValueByPath(fromObject, [
'structuredMemoryConfigs',
]);
if (fromStructuredMemoryConfigs != null) {
let transformedList = fromStructuredMemoryConfigs;
if (Array.isArray(transformedList)) {
transformedList = transformedList.map((item) => {
return structuredMemoryConfigFromVertex(item);
});
}
common.setValueByPath(
toObject,
['structuredMemoryConfigs'],
transformedList,
);
}
return toObject;
}
export function reasoningEngineContextSpecMemoryBankConfigToVertex(
fromObject: types.ReasoningEngineContextSpecMemoryBankConfig,
): Record {
const toObject: Record = {};
const fromCustomizationConfigs = common.getValueByPath(fromObject, [
'customizationConfigs',
]);
if (fromCustomizationConfigs != null) {
let transformedList = fromCustomizationConfigs;
if (Array.isArray(transformedList)) {
transformedList = transformedList.map((item) => {
return item;
});
}
common.setValueByPath(toObject, ['customizationConfigs'], transformedList);
}
const fromDisableMemoryRevisions = common.getValueByPath(fromObject, [
'disableMemoryRevisions',
]);
if (fromDisableMemoryRevisions != null) {
common.setValueByPath(
toObject,
['disableMemoryRevisions'],
fromDisableMemoryRevisions,
);
}
const fromGenerationConfig = common.getValueByPath(fromObject, [
'generationConfig',
]);
if (fromGenerationConfig != null) {
common.setValueByPath(toObject, ['generationConfig'], fromGenerationConfig);
}
const fromSimilaritySearchConfig = common.getValueByPath(fromObject, [
'similaritySearchConfig',
]);
if (fromSimilaritySearchConfig != null) {
common.setValueByPath(
toObject,
['similaritySearchConfig'],
fromSimilaritySearchConfig,
);
}
const fromTtlConfig = common.getValueByPath(fromObject, ['ttlConfig']);
if (fromTtlConfig != null) {
common.setValueByPath(toObject, ['ttlConfig'], fromTtlConfig);
}
const fromStructuredMemoryConfigs = common.getValueByPath(fromObject, [
'structuredMemoryConfigs',
]);
if (fromStructuredMemoryConfigs != null) {
let transformedList = fromStructuredMemoryConfigs;
if (Array.isArray(transformedList)) {
transformedList = transformedList.map((item) => {
return structuredMemoryConfigToVertex(item);
});
}
common.setValueByPath(
toObject,
['structuredMemoryConfigs'],
transformedList,
);
}
return toObject;
}
export function reasoningEngineContextSpecToVertex(
fromObject: types.ReasoningEngineContextSpec,
): Record {
const toObject: Record = {};
const fromMemoryBankConfig = common.getValueByPath(fromObject, [
'memoryBankConfig',
]);
if (fromMemoryBankConfig != null) {
common.setValueByPath(
toObject,
['memoryBankConfig'],
reasoningEngineContextSpecMemoryBankConfigToVertex(fromMemoryBankConfig),
);
}
return toObject;
}
export function reasoningEngineFromVertex(
fromObject: types.ReasoningEngine,
): Record {
const toObject: Record = {};
const fromEncryptionSpec = common.getValueByPath(fromObject, [
'encryptionSpec',
]);
if (fromEncryptionSpec != null) {
common.setValueByPath(toObject, ['encryptionSpec'], fromEncryptionSpec);
}
const fromContextSpec = common.getValueByPath(fromObject, ['contextSpec']);
if (fromContextSpec != null) {
common.setValueByPath(
toObject,
['contextSpec'],
reasoningEngineContextSpecFromVertex(fromContextSpec),
);
}
const fromCreateTime = common.getValueByPath(fromObject, ['createTime']);
if (fromCreateTime != null) {
common.setValueByPath(toObject, ['createTime'], fromCreateTime);
}
const fromDescription = common.getValueByPath(fromObject, ['description']);
if (fromDescription != null) {
common.setValueByPath(toObject, ['description'], fromDescription);
}
const fromDisplayName = common.getValueByPath(fromObject, ['displayName']);
if (fromDisplayName != null) {
common.setValueByPath(toObject, ['displayName'], fromDisplayName);
}
const fromEtag = common.getValueByPath(fromObject, ['etag']);
if (fromEtag != null) {
common.setValueByPath(toObject, ['etag'], fromEtag);
}
const fromLabels = common.getValueByPath(fromObject, ['labels']);
if (fromLabels != null) {
common.setValueByPath(toObject, ['labels'], fromLabels);
}
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['name'], fromName);
}
const fromSpec = common.getValueByPath(fromObject, ['spec']);
if (fromSpec != null) {
common.setValueByPath(toObject, ['spec'], fromSpec);
}
const fromUpdateTime = common.getValueByPath(fromObject, ['updateTime']);
if (fromUpdateTime != null) {
common.setValueByPath(toObject, ['updateTime'], fromUpdateTime);
}
const fromTrafficConfig = common.getValueByPath(fromObject, [
'trafficConfig',
]);
if (fromTrafficConfig != null) {
common.setValueByPath(toObject, ['trafficConfig'], fromTrafficConfig);
}
return toObject;
}
export function structuredMemoryConfigFromVertex(
fromObject: types.StructuredMemoryConfig,
): Record {
const toObject: Record = {};
const fromSchemaConfigs = common.getValueByPath(fromObject, [
'schemaConfigs',
]);
if (fromSchemaConfigs != null) {
let transformedList = fromSchemaConfigs;
if (Array.isArray(transformedList)) {
transformedList = transformedList.map((item) => {
return structuredMemorySchemaConfigFromVertex(item);
});
}
common.setValueByPath(toObject, ['schemaConfigs'], transformedList);
}
const fromScopeKeys = common.getValueByPath(fromObject, ['scopeKeys']);
if (fromScopeKeys != null) {
common.setValueByPath(toObject, ['scopeKeys'], fromScopeKeys);
}
return toObject;
}
export function structuredMemoryConfigToVertex(
fromObject: types.StructuredMemoryConfig,
): Record {
const toObject: Record = {};
const fromSchemaConfigs = common.getValueByPath(fromObject, [
'schemaConfigs',
]);
if (fromSchemaConfigs != null) {
let transformedList = fromSchemaConfigs;
if (Array.isArray(transformedList)) {
transformedList = transformedList.map((item) => {
return structuredMemorySchemaConfigToVertex(item);
});
}
common.setValueByPath(toObject, ['schemaConfigs'], transformedList);
}
const fromScopeKeys = common.getValueByPath(fromObject, ['scopeKeys']);
if (fromScopeKeys != null) {
common.setValueByPath(toObject, ['scopeKeys'], fromScopeKeys);
}
return toObject;
}
export function structuredMemorySchemaConfigFromVertex(
fromObject: types.StructuredMemorySchemaConfig,
): Record {
const toObject: Record = {};
const fromMemorySchema = common.getValueByPath(fromObject, ['schema']);
if (fromMemorySchema != null) {
common.setValueByPath(toObject, ['memorySchema'], fromMemorySchema);
}
const fromId = common.getValueByPath(fromObject, ['id']);
if (fromId != null) {
common.setValueByPath(toObject, ['id'], fromId);
}
const fromMemoryType = common.getValueByPath(fromObject, ['memoryType']);
if (fromMemoryType != null) {
common.setValueByPath(toObject, ['memoryType'], fromMemoryType);
}
return toObject;
}
export function structuredMemorySchemaConfigToVertex(
fromObject: types.StructuredMemorySchemaConfig,
): Record {
const toObject: Record = {};
const fromMemorySchema = common.getValueByPath(fromObject, ['memorySchema']);
if (fromMemorySchema != null) {
common.setValueByPath(toObject, ['schema'], fromMemorySchema);
}
const fromId = common.getValueByPath(fromObject, ['id']);
if (fromId != null) {
common.setValueByPath(toObject, ['id'], fromId);
}
const fromMemoryType = common.getValueByPath(fromObject, ['memoryType']);
if (fromMemoryType != null) {
common.setValueByPath(toObject, ['memoryType'], fromMemoryType);
}
return toObject;
}
export function updateAgentEngineConfigToVertex(
fromObject: types.UpdateAgentEngineConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromDisplayName = common.getValueByPath(fromObject, ['displayName']);
if (parentObject !== undefined && fromDisplayName != null) {
common.setValueByPath(parentObject, ['displayName'], fromDisplayName);
}
const fromDescription = common.getValueByPath(fromObject, ['description']);
if (parentObject !== undefined && fromDescription != null) {
common.setValueByPath(parentObject, ['description'], fromDescription);
}
const fromSpec = common.getValueByPath(fromObject, ['spec']);
if (parentObject !== undefined && fromSpec != null) {
common.setValueByPath(parentObject, ['spec'], fromSpec);
}
const fromContextSpec = common.getValueByPath(fromObject, ['contextSpec']);
if (parentObject !== undefined && fromContextSpec != null) {
common.setValueByPath(
parentObject,
['contextSpec'],
reasoningEngineContextSpecToVertex(fromContextSpec),
);
}
const fromPscInterfaceConfig = common.getValueByPath(fromObject, [
'pscInterfaceConfig',
]);
if (parentObject !== undefined && fromPscInterfaceConfig != null) {
common.setValueByPath(
parentObject,
['pscInterfaceConfig'],
fromPscInterfaceConfig,
);
}
const fromEncryptionSpec = common.getValueByPath(fromObject, [
'encryptionSpec',
]);
if (parentObject !== undefined && fromEncryptionSpec != null) {
common.setValueByPath(parentObject, ['encryptionSpec'], fromEncryptionSpec);
}
const fromLabels = common.getValueByPath(fromObject, ['labels']);
if (parentObject !== undefined && fromLabels != null) {
common.setValueByPath(parentObject, ['labels'], fromLabels);
}
const fromSourcePackages = common.getValueByPath(fromObject, [
'sourcePackages',
]);
if (parentObject !== undefined && fromSourcePackages != null) {
common.setValueByPath(parentObject, ['sourcePackages'], fromSourcePackages);
}
const fromEntrypointModule = common.getValueByPath(fromObject, [
'entrypointModule',
]);
if (parentObject !== undefined && fromEntrypointModule != null) {
common.setValueByPath(
parentObject,
['entrypointModule'],
fromEntrypointModule,
);
}
const fromEntrypointObject = common.getValueByPath(fromObject, [
'entrypointObject',
]);
if (parentObject !== undefined && fromEntrypointObject != null) {
common.setValueByPath(
parentObject,
['entrypointObject'],
fromEntrypointObject,
);
}
const fromRequirementsFile = common.getValueByPath(fromObject, [
'requirementsFile',
]);
if (parentObject !== undefined && fromRequirementsFile != null) {
common.setValueByPath(
parentObject,
['requirementsFile'],
fromRequirementsFile,
);
}
const fromAgentFramework = common.getValueByPath(fromObject, [
'agentFramework',
]);
if (parentObject !== undefined && fromAgentFramework != null) {
common.setValueByPath(parentObject, ['agentFramework'], fromAgentFramework);
}
const fromPythonVersion = common.getValueByPath(fromObject, [
'pythonVersion',
]);
if (parentObject !== undefined && fromPythonVersion != null) {
common.setValueByPath(parentObject, ['pythonVersion'], fromPythonVersion);
}
const fromAgentGatewayConfig = common.getValueByPath(fromObject, [
'agentGatewayConfig',
]);
if (parentObject !== undefined && fromAgentGatewayConfig != null) {
common.setValueByPath(
parentObject,
['agentGatewayConfig'],
fromAgentGatewayConfig,
);
}
const fromUpdateMask = common.getValueByPath(fromObject, ['updateMask']);
if (parentObject !== undefined && fromUpdateMask != null) {
common.setValueByPath(
parentObject,
['_query', 'updateMask'],
fromUpdateMask,
);
}
return toObject;
}
export function updateAgentEngineRequestParametersToVertex(
fromObject: types.UpdateAgentEngineRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
updateAgentEngineConfigToVertex(fromConfig, toObject);
}
return toObject;
}
================================================
FILE: src/converters/_memories_converters.ts
================================================
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
import * as common from '@google/genai/vertex_internal';
import * as types from '../types.js';
export function agentEngineMemoryConfigToVertex(
fromObject: types.AgentEngineMemoryConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromDisplayName = common.getValueByPath(fromObject, ['displayName']);
if (parentObject !== undefined && fromDisplayName != null) {
common.setValueByPath(parentObject, ['displayName'], fromDisplayName);
}
const fromDescription = common.getValueByPath(fromObject, ['description']);
if (parentObject !== undefined && fromDescription != null) {
common.setValueByPath(parentObject, ['description'], fromDescription);
}
const fromTtl = common.getValueByPath(fromObject, ['ttl']);
if (parentObject !== undefined && fromTtl != null) {
common.setValueByPath(parentObject, ['ttl'], fromTtl);
}
const fromExpireTime = common.getValueByPath(fromObject, ['expireTime']);
if (parentObject !== undefined && fromExpireTime != null) {
common.setValueByPath(parentObject, ['expireTime'], fromExpireTime);
}
const fromRevisionExpireTime = common.getValueByPath(fromObject, [
'revisionExpireTime',
]);
if (parentObject !== undefined && fromRevisionExpireTime != null) {
common.setValueByPath(
parentObject,
['revisionExpireTime'],
fromRevisionExpireTime,
);
}
const fromRevisionTtl = common.getValueByPath(fromObject, ['revisionTtl']);
if (parentObject !== undefined && fromRevisionTtl != null) {
common.setValueByPath(parentObject, ['revisionTtl'], fromRevisionTtl);
}
const fromDisableMemoryRevisions = common.getValueByPath(fromObject, [
'disableMemoryRevisions',
]);
if (parentObject !== undefined && fromDisableMemoryRevisions != null) {
common.setValueByPath(
parentObject,
['disableMemoryRevisions'],
fromDisableMemoryRevisions,
);
}
const fromTopics = common.getValueByPath(fromObject, ['topics']);
if (parentObject !== undefined && fromTopics != null) {
let transformedList = fromTopics;
if (Array.isArray(transformedList)) {
transformedList = transformedList.map((item) => {
return item;
});
}
common.setValueByPath(parentObject, ['topics'], transformedList);
}
const fromMetadata = common.getValueByPath(fromObject, ['metadata']);
if (parentObject !== undefined && fromMetadata != null) {
common.setValueByPath(parentObject, ['metadata'], fromMetadata);
}
const fromMemoryId = common.getValueByPath(fromObject, ['memoryId']);
if (parentObject !== undefined && fromMemoryId != null) {
common.setValueByPath(parentObject, ['_query', 'memoryId'], fromMemoryId);
}
return toObject;
}
export function createAgentEngineMemoryRequestParametersToVertex(
fromObject: types.CreateAgentEngineMemoryRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromFact = common.getValueByPath(fromObject, ['fact']);
if (fromFact != null) {
common.setValueByPath(toObject, ['fact'], fromFact);
}
const fromScope = common.getValueByPath(fromObject, ['scope']);
if (fromScope != null) {
common.setValueByPath(toObject, ['scope'], fromScope);
}
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
agentEngineMemoryConfigToVertex(fromConfig, toObject);
}
return toObject;
}
export function deleteAgentEngineMemoryRequestParametersToVertex(
fromObject: types.DeleteAgentEngineMemoryRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
return toObject;
}
export function generateAgentEngineMemoriesConfigToVertex(
fromObject: types.GenerateAgentEngineMemoriesConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromDisableConsolidation = common.getValueByPath(fromObject, [
'disableConsolidation',
]);
if (parentObject !== undefined && fromDisableConsolidation != null) {
common.setValueByPath(
parentObject,
['disableConsolidation'],
fromDisableConsolidation,
);
}
const fromRevisionLabels = common.getValueByPath(fromObject, [
'revisionLabels',
]);
if (parentObject !== undefined && fromRevisionLabels != null) {
common.setValueByPath(parentObject, ['revisionLabels'], fromRevisionLabels);
}
const fromRevisionExpireTime = common.getValueByPath(fromObject, [
'revisionExpireTime',
]);
if (parentObject !== undefined && fromRevisionExpireTime != null) {
common.setValueByPath(
parentObject,
['revisionExpireTime'],
fromRevisionExpireTime,
);
}
const fromRevisionTtl = common.getValueByPath(fromObject, ['revisionTtl']);
if (parentObject !== undefined && fromRevisionTtl != null) {
common.setValueByPath(parentObject, ['revisionTtl'], fromRevisionTtl);
}
const fromDisableMemoryRevisions = common.getValueByPath(fromObject, [
'disableMemoryRevisions',
]);
if (parentObject !== undefined && fromDisableMemoryRevisions != null) {
common.setValueByPath(
parentObject,
['disableMemoryRevisions'],
fromDisableMemoryRevisions,
);
}
const fromMetadata = common.getValueByPath(fromObject, ['metadata']);
if (parentObject !== undefined && fromMetadata != null) {
common.setValueByPath(parentObject, ['metadata'], fromMetadata);
}
const fromMetadataMergeStrategy = common.getValueByPath(fromObject, [
'metadataMergeStrategy',
]);
if (parentObject !== undefined && fromMetadataMergeStrategy != null) {
common.setValueByPath(
parentObject,
['metadataMergeStrategy'],
fromMetadataMergeStrategy,
);
}
const fromAllowedTopics = common.getValueByPath(fromObject, [
'allowedTopics',
]);
if (parentObject !== undefined && fromAllowedTopics != null) {
let transformedList = fromAllowedTopics;
if (Array.isArray(transformedList)) {
transformedList = transformedList.map((item) => {
return item;
});
}
common.setValueByPath(parentObject, ['allowedTopics'], transformedList);
}
return toObject;
}
export function generateAgentEngineMemoriesRequestParametersToVertex(
fromObject: types.GenerateAgentEngineMemoriesRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromVertexSessionSource = common.getValueByPath(fromObject, [
'vertexSessionSource',
]);
if (fromVertexSessionSource != null) {
common.setValueByPath(
toObject,
['vertexSessionSource'],
fromVertexSessionSource,
);
}
const fromDirectContentsSource = common.getValueByPath(fromObject, [
'directContentsSource',
]);
if (fromDirectContentsSource != null) {
common.setValueByPath(
toObject,
['directContentsSource'],
fromDirectContentsSource,
);
}
const fromDirectMemoriesSource = common.getValueByPath(fromObject, [
'directMemoriesSource',
]);
if (fromDirectMemoriesSource != null) {
common.setValueByPath(
toObject,
['directMemoriesSource'],
fromDirectMemoriesSource,
);
}
const fromScope = common.getValueByPath(fromObject, ['scope']);
if (fromScope != null) {
common.setValueByPath(toObject, ['scope'], fromScope);
}
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
generateAgentEngineMemoriesConfigToVertex(fromConfig, toObject);
}
return toObject;
}
export function getAgentEngineGenerateMemoriesOperationParametersToVertex(
fromObject: types.GetAgentEngineGenerateMemoriesOperationParameters,
): Record {
const toObject: Record = {};
const fromOperationName = common.getValueByPath(fromObject, [
'operationName',
]);
if (fromOperationName != null) {
common.setValueByPath(
toObject,
['_url', 'operationName'],
fromOperationName,
);
}
return toObject;
}
export function getAgentEngineMemoryOperationParametersToVertex(
fromObject: types.GetAgentEngineMemoryOperationParameters,
): Record {
const toObject: Record = {};
const fromOperationName = common.getValueByPath(fromObject, [
'operationName',
]);
if (fromOperationName != null) {
common.setValueByPath(
toObject,
['_url', 'operationName'],
fromOperationName,
);
}
return toObject;
}
export function getAgentEngineMemoryRequestParametersToVertex(
fromObject: types.GetAgentEngineMemoryRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
return toObject;
}
export function ingestEventsConfigToVertex(
fromObject: types.IngestEventsConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromForceFlush = common.getValueByPath(fromObject, ['forceFlush']);
if (parentObject !== undefined && fromForceFlush != null) {
common.setValueByPath(parentObject, ['forceFlush'], fromForceFlush);
}
return toObject;
}
export function ingestEventsRequestParametersToVertex(
fromObject: types.IngestEventsRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromStreamId = common.getValueByPath(fromObject, ['streamId']);
if (fromStreamId != null) {
common.setValueByPath(toObject, ['streamId'], fromStreamId);
}
const fromDirectContentsSource = common.getValueByPath(fromObject, [
'directContentsSource',
]);
if (fromDirectContentsSource != null) {
common.setValueByPath(
toObject,
['directContentsSource'],
fromDirectContentsSource,
);
}
const fromScope = common.getValueByPath(fromObject, ['scope']);
if (fromScope != null) {
common.setValueByPath(toObject, ['scope'], fromScope);
}
const fromGenerationTriggerConfig = common.getValueByPath(fromObject, [
'generationTriggerConfig',
]);
if (fromGenerationTriggerConfig != null) {
common.setValueByPath(
toObject,
['generationTriggerConfig'],
fromGenerationTriggerConfig,
);
}
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
ingestEventsConfigToVertex(fromConfig, toObject);
}
return toObject;
}
export function listAgentEngineMemoryConfigToVertex(
fromObject: types.ListAgentEngineMemoryConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromPageSize = common.getValueByPath(fromObject, ['pageSize']);
if (parentObject !== undefined && fromPageSize != null) {
common.setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
}
const fromPageToken = common.getValueByPath(fromObject, ['pageToken']);
if (parentObject !== undefined && fromPageToken != null) {
common.setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
}
const fromFilter = common.getValueByPath(fromObject, ['filter']);
if (parentObject !== undefined && fromFilter != null) {
common.setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
}
const fromOrderBy = common.getValueByPath(fromObject, ['orderBy']);
if (parentObject !== undefined && fromOrderBy != null) {
common.setValueByPath(parentObject, ['_query', 'orderBy'], fromOrderBy);
}
return toObject;
}
export function listAgentEngineMemoryRequestParametersToVertex(
fromObject: types.ListAgentEngineMemoryRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
listAgentEngineMemoryConfigToVertex(fromConfig, toObject);
}
return toObject;
}
export function purgeAgentEngineMemoriesRequestParametersToVertex(
fromObject: types.PurgeAgentEngineMemoriesRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromFilter = common.getValueByPath(fromObject, ['filter']);
if (fromFilter != null) {
common.setValueByPath(toObject, ['filter'], fromFilter);
}
const fromFilterGroups = common.getValueByPath(fromObject, ['filterGroups']);
if (fromFilterGroups != null) {
let transformedList = fromFilterGroups;
if (Array.isArray(transformedList)) {
transformedList = transformedList.map((item) => {
return item;
});
}
common.setValueByPath(toObject, ['filterGroups'], transformedList);
}
const fromForce = common.getValueByPath(fromObject, ['force']);
if (fromForce != null) {
common.setValueByPath(toObject, ['force'], fromForce);
}
return toObject;
}
export function retrieveAgentEngineMemoriesConfigToVertex(
fromObject: types.RetrieveAgentEngineMemoriesConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromFilter = common.getValueByPath(fromObject, ['filter']);
if (parentObject !== undefined && fromFilter != null) {
common.setValueByPath(parentObject, ['filter'], fromFilter);
}
const fromFilterGroups = common.getValueByPath(fromObject, ['filterGroups']);
if (parentObject !== undefined && fromFilterGroups != null) {
let transformedList = fromFilterGroups;
if (Array.isArray(transformedList)) {
transformedList = transformedList.map((item) => {
return item;
});
}
common.setValueByPath(parentObject, ['filterGroups'], transformedList);
}
const fromMemoryTypes = common.getValueByPath(fromObject, ['memoryTypes']);
if (parentObject !== undefined && fromMemoryTypes != null) {
common.setValueByPath(parentObject, ['memoryTypes'], fromMemoryTypes);
}
return toObject;
}
export function retrieveAgentEngineMemoriesRequestParametersToVertex(
fromObject: types.RetrieveAgentEngineMemoriesRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromScope = common.getValueByPath(fromObject, ['scope']);
if (fromScope != null) {
common.setValueByPath(toObject, ['scope'], fromScope);
}
const fromSimilaritySearchParams = common.getValueByPath(fromObject, [
'similaritySearchParams',
]);
if (fromSimilaritySearchParams != null) {
common.setValueByPath(
toObject,
['similaritySearchParams'],
fromSimilaritySearchParams,
);
}
const fromSimpleRetrievalParams = common.getValueByPath(fromObject, [
'simpleRetrievalParams',
]);
if (fromSimpleRetrievalParams != null) {
common.setValueByPath(
toObject,
['simpleRetrievalParams'],
fromSimpleRetrievalParams,
);
}
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
retrieveAgentEngineMemoriesConfigToVertex(fromConfig, toObject);
}
return toObject;
}
export function retrieveMemoryProfilesRequestParametersToVertex(
fromObject: types.RetrieveMemoryProfilesRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromScope = common.getValueByPath(fromObject, ['scope']);
if (fromScope != null) {
common.setValueByPath(toObject, ['scope'], fromScope);
}
return toObject;
}
export function rollbackAgentEngineMemoryRequestParametersToVertex(
fromObject: types.RollbackAgentEngineMemoryRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromTargetRevisionId = common.getValueByPath(fromObject, [
'targetRevisionId',
]);
if (fromTargetRevisionId != null) {
common.setValueByPath(toObject, ['targetRevisionId'], fromTargetRevisionId);
}
return toObject;
}
export function updateAgentEngineMemoryConfigToVertex(
fromObject: types.UpdateAgentEngineMemoryConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromDisplayName = common.getValueByPath(fromObject, ['displayName']);
if (parentObject !== undefined && fromDisplayName != null) {
common.setValueByPath(parentObject, ['displayName'], fromDisplayName);
}
const fromDescription = common.getValueByPath(fromObject, ['description']);
if (parentObject !== undefined && fromDescription != null) {
common.setValueByPath(parentObject, ['description'], fromDescription);
}
const fromTtl = common.getValueByPath(fromObject, ['ttl']);
if (parentObject !== undefined && fromTtl != null) {
common.setValueByPath(parentObject, ['ttl'], fromTtl);
}
const fromExpireTime = common.getValueByPath(fromObject, ['expireTime']);
if (parentObject !== undefined && fromExpireTime != null) {
common.setValueByPath(parentObject, ['expireTime'], fromExpireTime);
}
const fromRevisionExpireTime = common.getValueByPath(fromObject, [
'revisionExpireTime',
]);
if (parentObject !== undefined && fromRevisionExpireTime != null) {
common.setValueByPath(
parentObject,
['revisionExpireTime'],
fromRevisionExpireTime,
);
}
const fromRevisionTtl = common.getValueByPath(fromObject, ['revisionTtl']);
if (parentObject !== undefined && fromRevisionTtl != null) {
common.setValueByPath(parentObject, ['revisionTtl'], fromRevisionTtl);
}
const fromDisableMemoryRevisions = common.getValueByPath(fromObject, [
'disableMemoryRevisions',
]);
if (parentObject !== undefined && fromDisableMemoryRevisions != null) {
common.setValueByPath(
parentObject,
['disableMemoryRevisions'],
fromDisableMemoryRevisions,
);
}
const fromTopics = common.getValueByPath(fromObject, ['topics']);
if (parentObject !== undefined && fromTopics != null) {
let transformedList = fromTopics;
if (Array.isArray(transformedList)) {
transformedList = transformedList.map((item) => {
return item;
});
}
common.setValueByPath(parentObject, ['topics'], transformedList);
}
const fromMetadata = common.getValueByPath(fromObject, ['metadata']);
if (parentObject !== undefined && fromMetadata != null) {
common.setValueByPath(parentObject, ['metadata'], fromMetadata);
}
const fromMemoryId = common.getValueByPath(fromObject, ['memoryId']);
if (parentObject !== undefined && fromMemoryId != null) {
common.setValueByPath(parentObject, ['_query', 'memoryId'], fromMemoryId);
}
const fromUpdateMask = common.getValueByPath(fromObject, ['updateMask']);
if (parentObject !== undefined && fromUpdateMask != null) {
common.setValueByPath(
parentObject,
['_query', 'updateMask'],
fromUpdateMask,
);
}
return toObject;
}
export function updateAgentEngineMemoryRequestParametersToVertex(
fromObject: types.UpdateAgentEngineMemoryRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromFact = common.getValueByPath(fromObject, ['fact']);
if (fromFact != null) {
common.setValueByPath(toObject, ['fact'], fromFact);
}
const fromScope = common.getValueByPath(fromObject, ['scope']);
if (fromScope != null) {
common.setValueByPath(toObject, ['scope'], fromScope);
}
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
updateAgentEngineMemoryConfigToVertex(fromConfig, toObject);
}
return toObject;
}
================================================
FILE: src/converters/_memoryrevisions_converters.ts
================================================
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
import * as common from '@google/genai/vertex_internal';
import * as types from '../types.js';
export function getAgentEngineMemoryRevisionRequestParametersToVertex(
fromObject: types.GetAgentEngineMemoryRevisionRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
return toObject;
}
export function listAgentEngineMemoryRevisionsConfigToVertex(
fromObject: types.ListAgentEngineMemoryRevisionsConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromPageSize = common.getValueByPath(fromObject, ['pageSize']);
if (parentObject !== undefined && fromPageSize != null) {
common.setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
}
const fromPageToken = common.getValueByPath(fromObject, ['pageToken']);
if (parentObject !== undefined && fromPageToken != null) {
common.setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
}
const fromFilter = common.getValueByPath(fromObject, ['filter']);
if (parentObject !== undefined && fromFilter != null) {
common.setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
}
return toObject;
}
export function listAgentEngineMemoryRevisionsRequestParametersToVertex(
fromObject: types.ListAgentEngineMemoryRevisionsRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
listAgentEngineMemoryRevisionsConfigToVertex(fromConfig, toObject);
}
return toObject;
}
================================================
FILE: src/converters/_sandboxes_converters.ts
================================================
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
import * as common from '@google/genai/vertex_internal';
import * as types from '../types.js';
export function createAgentEngineSandboxConfigToVertex(
fromObject: types.CreateAgentEngineSandboxConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromDisplayName = common.getValueByPath(fromObject, ['displayName']);
if (parentObject !== undefined && fromDisplayName != null) {
common.setValueByPath(parentObject, ['displayName'], fromDisplayName);
}
const fromDescription = common.getValueByPath(fromObject, ['description']);
if (parentObject !== undefined && fromDescription != null) {
common.setValueByPath(parentObject, ['description'], fromDescription);
}
const fromTtl = common.getValueByPath(fromObject, ['ttl']);
if (parentObject !== undefined && fromTtl != null) {
common.setValueByPath(parentObject, ['ttl'], fromTtl);
}
const fromSandboxEnvironmentTemplate = common.getValueByPath(fromObject, [
'sandboxEnvironmentTemplate',
]);
if (parentObject !== undefined && fromSandboxEnvironmentTemplate != null) {
common.setValueByPath(
parentObject,
['sandboxEnvironmentTemplate'],
fromSandboxEnvironmentTemplate,
);
}
const fromSandboxEnvironmentSnapshot = common.getValueByPath(fromObject, [
'sandboxEnvironmentSnapshot',
]);
if (parentObject !== undefined && fromSandboxEnvironmentSnapshot != null) {
common.setValueByPath(
parentObject,
['sandboxEnvironmentSnapshot'],
fromSandboxEnvironmentSnapshot,
);
}
const fromOwner = common.getValueByPath(fromObject, ['owner']);
if (parentObject !== undefined && fromOwner != null) {
common.setValueByPath(parentObject, ['owner'], fromOwner);
}
return toObject;
}
export function createAgentEngineSandboxRequestParametersToVertex(
fromObject: types.CreateAgentEngineSandboxRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromSpec = common.getValueByPath(fromObject, ['spec']);
if (fromSpec != null) {
common.setValueByPath(toObject, ['spec'], fromSpec);
}
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
createAgentEngineSandboxConfigToVertex(fromConfig, toObject);
}
return toObject;
}
export function deleteAgentEngineSandboxRequestParametersToVertex(
fromObject: types.DeleteAgentEngineSandboxRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
return toObject;
}
export function executeCodeAgentEngineSandboxRequestParametersToVertex(
fromObject: types.ExecuteCodeAgentEngineSandboxRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromInputs = common.getValueByPath(fromObject, ['inputs']);
if (fromInputs != null) {
let transformedList = fromInputs;
if (Array.isArray(transformedList)) {
transformedList = transformedList.map((item) => {
return item;
});
}
common.setValueByPath(toObject, ['inputs'], transformedList);
}
return toObject;
}
export function getAgentEngineSandboxOperationParametersToVertex(
fromObject: types.GetAgentEngineSandboxOperationParameters,
): Record {
const toObject: Record = {};
const fromOperationName = common.getValueByPath(fromObject, [
'operationName',
]);
if (fromOperationName != null) {
common.setValueByPath(
toObject,
['_url', 'operationName'],
fromOperationName,
);
}
return toObject;
}
export function getAgentEngineSandboxRequestParametersToVertex(
fromObject: types.GetAgentEngineSandboxRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
return toObject;
}
export function listAgentEngineSandboxesConfigToVertex(
fromObject: types.ListAgentEngineSandboxesConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromPageSize = common.getValueByPath(fromObject, ['pageSize']);
if (parentObject !== undefined && fromPageSize != null) {
common.setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
}
const fromPageToken = common.getValueByPath(fromObject, ['pageToken']);
if (parentObject !== undefined && fromPageToken != null) {
common.setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
}
const fromFilter = common.getValueByPath(fromObject, ['filter']);
if (parentObject !== undefined && fromFilter != null) {
common.setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
}
return toObject;
}
export function listAgentEngineSandboxesRequestParametersToVertex(
fromObject: types.ListAgentEngineSandboxesRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
listAgentEngineSandboxesConfigToVertex(fromConfig, toObject);
}
return toObject;
}
================================================
FILE: src/converters/_sessionevents_converters.ts
================================================
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
import * as common from '@google/genai/vertex_internal';
import * as types from '../types.js';
export function appendAgentEngineSessionEventConfigToVertex(
fromObject: types.AppendAgentEngineSessionEventConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromContent = common.getValueByPath(fromObject, ['content']);
if (parentObject !== undefined && fromContent != null) {
common.setValueByPath(parentObject, ['content'], fromContent);
}
const fromActions = common.getValueByPath(fromObject, ['actions']);
if (parentObject !== undefined && fromActions != null) {
common.setValueByPath(parentObject, ['actions'], fromActions);
}
const fromErrorCode = common.getValueByPath(fromObject, ['errorCode']);
if (parentObject !== undefined && fromErrorCode != null) {
common.setValueByPath(parentObject, ['errorCode'], fromErrorCode);
}
const fromErrorMessage = common.getValueByPath(fromObject, ['errorMessage']);
if (parentObject !== undefined && fromErrorMessage != null) {
common.setValueByPath(parentObject, ['errorMessage'], fromErrorMessage);
}
const fromEventMetadata = common.getValueByPath(fromObject, [
'eventMetadata',
]);
if (parentObject !== undefined && fromEventMetadata != null) {
common.setValueByPath(parentObject, ['eventMetadata'], fromEventMetadata);
}
const fromRawEvent = common.getValueByPath(fromObject, ['rawEvent']);
if (parentObject !== undefined && fromRawEvent != null) {
common.setValueByPath(parentObject, ['rawEvent'], fromRawEvent);
}
return toObject;
}
export function appendAgentEngineSessionEventRequestParametersToVertex(
fromObject: types.AppendAgentEngineSessionEventRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromAuthor = common.getValueByPath(fromObject, ['author']);
if (fromAuthor != null) {
common.setValueByPath(toObject, ['author'], fromAuthor);
}
const fromInvocationId = common.getValueByPath(fromObject, ['invocationId']);
if (fromInvocationId != null) {
common.setValueByPath(toObject, ['invocationId'], fromInvocationId);
}
const fromTimestamp = common.getValueByPath(fromObject, ['timestamp']);
if (fromTimestamp != null) {
common.setValueByPath(toObject, ['timestamp'], fromTimestamp);
}
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
appendAgentEngineSessionEventConfigToVertex(fromConfig, toObject);
}
return toObject;
}
export function listAgentEngineSessionEventsConfigToVertex(
fromObject: types.ListAgentEngineSessionEventsConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromPageSize = common.getValueByPath(fromObject, ['pageSize']);
if (parentObject !== undefined && fromPageSize != null) {
common.setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
}
const fromPageToken = common.getValueByPath(fromObject, ['pageToken']);
if (parentObject !== undefined && fromPageToken != null) {
common.setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
}
const fromFilter = common.getValueByPath(fromObject, ['filter']);
if (parentObject !== undefined && fromFilter != null) {
common.setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
}
return toObject;
}
export function listAgentEngineSessionEventsRequestParametersToVertex(
fromObject: types.ListAgentEngineSessionEventsRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
listAgentEngineSessionEventsConfigToVertex(fromConfig, toObject);
}
return toObject;
}
================================================
FILE: src/converters/_sessions_converters.ts
================================================
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
import * as common from '@google/genai/vertex_internal';
import * as types from '../types.js';
export function createAgentEngineSessionConfigToVertex(
fromObject: types.CreateAgentEngineSessionConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromDisplayName = common.getValueByPath(fromObject, ['displayName']);
if (parentObject !== undefined && fromDisplayName != null) {
common.setValueByPath(parentObject, ['displayName'], fromDisplayName);
}
const fromSessionState = common.getValueByPath(fromObject, ['sessionState']);
if (parentObject !== undefined && fromSessionState != null) {
common.setValueByPath(parentObject, ['sessionState'], fromSessionState);
}
const fromTtl = common.getValueByPath(fromObject, ['ttl']);
if (parentObject !== undefined && fromTtl != null) {
common.setValueByPath(parentObject, ['ttl'], fromTtl);
}
const fromExpireTime = common.getValueByPath(fromObject, ['expireTime']);
if (parentObject !== undefined && fromExpireTime != null) {
common.setValueByPath(parentObject, ['expireTime'], fromExpireTime);
}
const fromLabels = common.getValueByPath(fromObject, ['labels']);
if (parentObject !== undefined && fromLabels != null) {
common.setValueByPath(parentObject, ['labels'], fromLabels);
}
const fromSessionId = common.getValueByPath(fromObject, ['sessionId']);
if (parentObject !== undefined && fromSessionId != null) {
common.setValueByPath(parentObject, ['_query', 'sessionId'], fromSessionId);
}
return toObject;
}
export function createAgentEngineSessionRequestParametersToVertex(
fromObject: types.CreateAgentEngineSessionRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromUserId = common.getValueByPath(fromObject, ['userId']);
if (fromUserId != null) {
common.setValueByPath(toObject, ['userId'], fromUserId);
}
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
createAgentEngineSessionConfigToVertex(fromConfig, toObject);
}
return toObject;
}
export function deleteAgentEngineSessionRequestParametersToVertex(
fromObject: types.DeleteAgentEngineSessionRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
return toObject;
}
export function getAgentEngineSessionOperationParametersToVertex(
fromObject: types.GetAgentEngineSessionOperationParameters,
): Record {
const toObject: Record = {};
const fromOperationName = common.getValueByPath(fromObject, [
'operationName',
]);
if (fromOperationName != null) {
common.setValueByPath(
toObject,
['_url', 'operationName'],
fromOperationName,
);
}
return toObject;
}
export function getAgentEngineSessionRequestParametersToVertex(
fromObject: types.GetAgentEngineSessionRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
return toObject;
}
export function listAgentEngineSessionsConfigToVertex(
fromObject: types.ListAgentEngineSessionsConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromPageSize = common.getValueByPath(fromObject, ['pageSize']);
if (parentObject !== undefined && fromPageSize != null) {
common.setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize);
}
const fromPageToken = common.getValueByPath(fromObject, ['pageToken']);
if (parentObject !== undefined && fromPageToken != null) {
common.setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken);
}
const fromFilter = common.getValueByPath(fromObject, ['filter']);
if (parentObject !== undefined && fromFilter != null) {
common.setValueByPath(parentObject, ['_query', 'filter'], fromFilter);
}
return toObject;
}
export function listAgentEngineSessionsRequestParametersToVertex(
fromObject: types.ListAgentEngineSessionsRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
listAgentEngineSessionsConfigToVertex(fromConfig, toObject);
}
return toObject;
}
export function updateAgentEngineSessionConfigToVertex(
fromObject: types.UpdateAgentEngineSessionConfig,
parentObject: Record,
): Record {
const toObject: Record = {};
const fromDisplayName = common.getValueByPath(fromObject, ['displayName']);
if (parentObject !== undefined && fromDisplayName != null) {
common.setValueByPath(parentObject, ['displayName'], fromDisplayName);
}
const fromSessionState = common.getValueByPath(fromObject, ['sessionState']);
if (parentObject !== undefined && fromSessionState != null) {
common.setValueByPath(parentObject, ['sessionState'], fromSessionState);
}
const fromTtl = common.getValueByPath(fromObject, ['ttl']);
if (parentObject !== undefined && fromTtl != null) {
common.setValueByPath(parentObject, ['ttl'], fromTtl);
}
const fromExpireTime = common.getValueByPath(fromObject, ['expireTime']);
if (parentObject !== undefined && fromExpireTime != null) {
common.setValueByPath(parentObject, ['expireTime'], fromExpireTime);
}
const fromLabels = common.getValueByPath(fromObject, ['labels']);
if (parentObject !== undefined && fromLabels != null) {
common.setValueByPath(parentObject, ['labels'], fromLabels);
}
const fromSessionId = common.getValueByPath(fromObject, ['sessionId']);
if (parentObject !== undefined && fromSessionId != null) {
common.setValueByPath(parentObject, ['_query', 'sessionId'], fromSessionId);
}
const fromUpdateMask = common.getValueByPath(fromObject, ['updateMask']);
if (parentObject !== undefined && fromUpdateMask != null) {
common.setValueByPath(
parentObject,
['_query', 'updateMask'],
fromUpdateMask,
);
}
const fromUserId = common.getValueByPath(fromObject, ['userId']);
if (parentObject !== undefined && fromUserId != null) {
common.setValueByPath(parentObject, ['userId'], fromUserId);
}
return toObject;
}
export function updateAgentEngineSessionRequestParametersToVertex(
fromObject: types.UpdateAgentEngineSessionRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
updateAgentEngineSessionConfigToVertex(fromConfig, toObject);
}
return toObject;
}
================================================
FILE: src/converters/_skills_converters.ts
================================================
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
import * as common from '@google/genai/vertex_internal';
import * as types from '../types.js';
export function getSkillRequestParametersToVertex(
fromObject: types.GetSkillRequestParameters,
): Record {
const toObject: Record = {};
const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['_url', 'name'], fromName);
}
const fromConfig = common.getValueByPath(fromObject, ['config']);
if (fromConfig != null) {
common.setValueByPath(toObject, ['config'], fromConfig);
}
return toObject;
}
================================================
FILE: src/eslint.config.mjs
================================================
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
export default [
eslint.configs.recommended,
...tseslint.configs.recommended,
{
ignores: [
// Ignore built files.
'dist/**',
],
},
{
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
'argsIgnorePattern': '^_',
'varsIgnorePattern': '^_',
},
],
'@typescript-eslint/no-empty-object-type': [
'error',
{
'allowInterfaces': 'always',
},
],
},
},
];
================================================
FILE: src/index.ts
================================================
/**
* @license
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {Client} from './client';
export * from './types';
================================================
FILE: src/memories.ts
================================================
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
import * as common from '@google/genai/vertex_internal';
import {ApiClient, BaseModule} from '@google/genai/vertex_internal';
import * as converters from './converters/_memories_converters.js';
import {MemoryRevisions} from './memoryrevisions.js';
import * as types from './types.js';
export class Memories extends BaseModule {
public readonly revisions: MemoryRevisions;
constructor(private readonly apiClient: ApiClient) {
super();
this.revisions = new MemoryRevisions(apiClient);
}
async createInternal(
params: types.CreateAgentEngineMemoryRequestParameters,
): Promise {
let response: Promise;
let path: string = '';
let queryParams: Record = {};
if (this.apiClient.isVertexAI()) {
const body =
converters.createAgentEngineMemoryRequestParametersToVertex(params);
path = common.formatMap(
'{name}/memories',
body['_url'] as Record,
);
queryParams = body['_query'] as Record;
delete body['_url'];
delete body['_query'];
delete body['config'];
response = this.apiClient
.request({
path: path,
queryParams: queryParams,
body: JSON.stringify(body),
httpMethod: 'POST',
httpOptions: params.config?.httpOptions,
abortSignal: params.config?.abortSignal,
})
.then((httpResponse) => {
return httpResponse.json();
}) as Promise;
return response.then((resp) => {
return resp as types.AgentEngineMemoryOperation;
});
} else {
throw new Error(
'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).',
);
}
}
async delete(
params: types.DeleteAgentEngineMemoryRequestParameters,
): Promise {
let response: Promise;
let path: string = '';
let queryParams: Record = {};
if (this.apiClient.isVertexAI()) {
const body =
converters.deleteAgentEngineMemoryRequestParametersToVertex(params);
path = common.formatMap(
'{name}',
body['_url'] as Record,
);
queryParams = body['_query'] as Record;
delete body['_url'];
delete body['_query'];
delete body['config'];
response = this.apiClient
.request({
path: path,
queryParams: queryParams,
body: JSON.stringify(body),
httpMethod: 'DELETE',
httpOptions: params.config?.httpOptions,
abortSignal: params.config?.abortSignal,
})
.then((httpResponse) => {
return httpResponse.json();
}) as Promise;
return response.then((resp) => {
return resp as types.DeleteAgentEngineMemoryOperation;
});
} else {
throw new Error(
'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).',
);
}
}
async generateInternal(
params: types.GenerateAgentEngineMemoriesRequestParameters,
): Promise {
let response: Promise;
let path: string = '';
let queryParams: Record = {};
if (this.apiClient.isVertexAI()) {
const body =
converters.generateAgentEngineMemoriesRequestParametersToVertex(params);
path = common.formatMap(
'{name}/memories:generate',
body['_url'] as Record,
);
queryParams = body['_query'] as Record;
delete body['_url'];
delete body['_query'];
delete body['config'];
response = this.apiClient
.request({
path: path,
queryParams: queryParams,
body: JSON.stringify(body),
httpMethod: 'POST',
httpOptions: params.config?.httpOptions,
abortSignal: params.config?.abortSignal,
})
.then((httpResponse) => {
return httpResponse.json();
}) as Promise;
return response.then((resp) => {
return resp as types.AgentEngineGenerateMemoriesOperation;
});
} else {
throw new Error(
'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).',
);
}
}
async get(
params: types.GetAgentEngineMemoryRequestParameters,
): Promise {
let response: Promise;
let path: string = '';
let queryParams: Record = {};
if (this.apiClient.isVertexAI()) {
const body =
converters.getAgentEngineMemoryRequestParametersToVertex(params);
path = common.formatMap(
'{name}',
body['_url'] as Record,
);
queryParams = body['_query'] as Record;
delete body['_url'];
delete body['_query'];
delete body['config'];
response = this.apiClient
.request({
path: path,
queryParams: queryParams,
body: JSON.stringify(body),
httpMethod: 'GET',
httpOptions: params.config?.httpOptions,
abortSignal: params.config?.abortSignal,
})
.then((httpResponse) => {
return httpResponse.json();
}) as Promise;
return response.then((resp) => {
return resp as types.Memory;
});
} else {
throw new Error(
'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).',
);
}
}
async ingestEventsInternal(
params: types.IngestEventsRequestParameters,
): Promise {
let response: Promise;
let path: string = '';
let queryParams: Record = {};
if (this.apiClient.isVertexAI()) {
const body = converters.ingestEventsRequestParametersToVertex(params);
path = common.formatMap(
'{name}/memories:ingestEvents',
body['_url'] as Record,
);
queryParams = body['_query'] as Record;
delete body['_url'];
delete body['_query'];
delete body['config'];
response = this.apiClient
.request({
path: path,
queryParams: queryParams,
body: JSON.stringify(body),
httpMethod: 'POST',
httpOptions: params.config?.httpOptions,
abortSignal: params.config?.abortSignal,
})
.then((httpResponse) => {
return httpResponse.json();
}) as Promise;
return response.then((resp) => {
return resp as types.MemoryBankIngestEventsOperation;
});
} else {
throw new Error(
'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).',
);
}
}
async listInternal(
params: types.ListAgentEngineMemoryRequestParameters,
): Promise {
let response: Promise;
let path: string = '';
let queryParams: Record = {};
if (this.apiClient.isVertexAI()) {
const body =
converters.listAgentEngineMemoryRequestParametersToVertex(params);
path = common.formatMap(
'{name}/memories',
body['_url'] as Record,
);
queryParams = body['_query'] as Record;
delete body['_url'];
delete body['_query'];
delete body['config'];
response = this.apiClient
.request({
path: path,
queryParams: queryParams,
body: JSON.stringify(body),
httpMethod: 'GET',
httpOptions: params.config?.httpOptions,
abortSignal: params.config?.abortSignal,
})
.then((httpResponse) => {
return httpResponse.json();
}) as Promise;
return response.then((resp) => {
const typedResp = new types.ListReasoningEnginesMemoriesResponse();
Object.assign(typedResp, resp);
return typedResp;
});
} else {
throw new Error(
'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).',
);
}
}
async getMemoryOperationInternal(
params: types.GetAgentEngineMemoryOperationParameters,
): Promise {
let response: Promise;
let path: string = '';
let queryParams: Record = {};
if (this.apiClient.isVertexAI()) {
const body =
converters.getAgentEngineMemoryOperationParametersToVertex(params);
path = common.formatMap(
'{operationName}',
body['_url'] as Record,
);
queryParams = body['_query'] as Record;
delete body['_url'];
delete body['_query'];
delete body['config'];
response = this.apiClient
.request({
path: path,
queryParams: queryParams,
body: JSON.stringify(body),
httpMethod: 'GET',
httpOptions: params.config?.httpOptions,
abortSignal: params.config?.abortSignal,
})
.then((httpResponse) => {
return httpResponse.json();
}) as Promise;
return response.then((resp) => {
return resp as types.AgentEngineMemoryOperation;
});
} else {
throw new Error(
'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).',
);
}
}
async getGenerateMemoriesOperationInternal(
params: types.GetAgentEngineGenerateMemoriesOperationParameters,
): Promise {
let response: Promise;
let path: string = '';
let queryParams: Record = {};
if (this.apiClient.isVertexAI()) {
const body =
converters.getAgentEngineGenerateMemoriesOperationParametersToVertex(
params,
);
path = common.formatMap(
'{operationName}',
body['_url'] as Record,
);
queryParams = body['_query'] as Record;
delete body['_url'];
delete body['_query'];
delete body['config'];
response = this.apiClient
.request({
path: path,
queryParams: queryParams,
body: JSON.stringify(body),
httpMethod: 'GET',
httpOptions: params.config?.httpOptions,
abortSignal: params.config?.abortSignal,
})
.then((httpResponse) => {
return httpResponse.json();
}) as Promise;
return response.then((resp) => {
return resp as types.AgentEngineGenerateMemoriesOperation;
});
} else {
throw new Error(
'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).',
);
}
}
async retrieveInternal(
params: types.RetrieveAgentEngineMemoriesRequestParameters,
): Promise {
let response: Promise;
let path: string = '';
let queryParams: Record = {};
if (this.apiClient.isVertexAI()) {
const body =
converters.retrieveAgentEngineMemoriesRequestParametersToVertex(params);
path = common.formatMap(
'{name}/memories:retrieve',
body['_url'] as Record,
);
queryParams = body['_query'] as Record;
delete body['_url'];
delete body['_query'];
delete body['config'];
response = this.apiClient
.request({
path: path,
queryParams: queryParams,
body: JSON.stringify(body),
httpMethod: 'POST',
httpOptions: params.config?.httpOptions,
abortSignal: params.config?.abortSignal,
})
.then((httpResponse) => {
return httpResponse.json();
}) as Promise;
return response.then((resp) => {
const typedResp = new types.RetrieveMemoriesResponse();
Object.assign(typedResp, resp);
return typedResp;
});
} else {
throw new Error(
'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).',
);
}
}
async retrieveProfiles(
params: types.RetrieveMemoryProfilesRequestParameters,
): Promise {
let response: Promise;
let path: string = '';
let queryParams: Record = {};
if (this.apiClient.isVertexAI()) {
const body =
converters.retrieveMemoryProfilesRequestParametersToVertex(params);
path = common.formatMap(
'{name}/memories:retrieveProfiles',
body['_url'] as Record,
);
queryParams = body['_query'] as Record;
delete body['_url'];
delete body['_query'];
delete body['config'];
response = this.apiClient
.request({
path: path,
queryParams: queryParams,
body: JSON.stringify(body),
httpMethod: 'POST',
httpOptions: params.config?.httpOptions,
abortSignal: params.config?.abortSignal,
})
.then((httpResponse) => {
return httpResponse.json();
}) as Promise;
return response.then((resp) => {
const typedResp = new types.RetrieveProfilesResponse();
Object.assign(typedResp, resp);
return typedResp;
});
} else {
throw new Error(
'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).',
);
}
}
async rollbackInternal(
params: types.RollbackAgentEngineMemoryRequestParameters,
): Promise {
let response: Promise