examples/google-vertex-tools/README.md
Example configurations for testing Google Vertex AI models with function calling and tool callbacks.
You can run this example with:
npx promptfoo@latest init --example google-vertex-tools
cd google-vertex-tools
This example demonstrates how to use Vertex AI models with:
Install the Google Auth Library:
npm install google-auth-library
Enable the Vertex AI API in your Google Cloud project
Configure your Google Cloud project:
gcloud config set project PROJECT_ID
Set up authentication using one of these methods:
Authenticate with your Google account:
gcloud auth application-default login
Use a machine with an authorized service account
Use service account credentials file:
Download your service account JSON
Set the credentials path:
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
This example includes two different approaches:
promptfooconfig.yaml)Uses external tool definitions and validates function calls without execution:
promptfooconfig.yaml - YAML configuration with external toolstools.json - Function definitions for weather lookuppromptfooconfig-callback.js)Demonstrates actual function execution with local callbacks:
promptfooconfig-callback.js - JavaScript configuration with inline tools and callbacksBasic tool declaration example:
promptfoo eval -c promptfooconfig.yaml
Function callback example:
promptfoo eval -c promptfooconfig-callback.js
View results:
promptfoo view