Files
wehub-resource-sync 0d3cb498a3
Deploy local.promptfoo.app / Deploy to Cloudflare Pages (push) Waiting to run
Test and Publish Multi-arch Docker Image / test (push) Waiting to run
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-amd64 platform:linux/amd64 runner:ubuntu-latest]) (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-arm64 platform:linux/arm64 runner:ubuntu-24.04-arm]) (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / merge-docker-digests (push) Blocked by required conditions
Test and Publish Multi-arch Docker Image / Attest Multi-arch Image (push) Blocked by required conditions
CI / Shell Format Check (push) Waiting to run
CI / Check Ruby (3.4) (push) Waiting to run
CI / CI Config (push) Waiting to run
CI / Test on Node ${{ matrix.node }} and ${{ matrix.os }}${{ matrix.shard && format(' (shard {0}/3)', matrix.shard) || '' }} (push) Blocked by required conditions
CI / Build on Node ${{ matrix.node }} (push) Blocked by required conditions
CI / Style Check (push) Waiting to run
CI / Generate Assets (push) Waiting to run
CI / Check Python (3.14) (push) Waiting to run
CI / Check Python (3.9) (push) Waiting to run
CI / Build Docs (push) Waiting to run
CI / Code Scan Action (push) Waiting to run
CI / Site tests (push) Waiting to run
CI / webui tests (push) Waiting to run
CI / Run Integration Tests (push) Waiting to run
CI / Run Smoke Tests (push) Waiting to run
CI / Go Tests (push) Waiting to run
CI / Share Test (push) Waiting to run
CI / Redteam (Production API) (push) Waiting to run
CI / Redteam (Staging API) (push) Waiting to run
CI / GitHub Actions Lint (push) Waiting to run
CI / Check Ruby (3.0) (push) Waiting to run
release-please / release-please (push) Waiting to run
release-please / build (push) Blocked by required conditions
release-please / publish-npm (push) Blocked by required conditions
release-please / publish-npm-backfill (push) Waiting to run
release-please / docker (push) Blocked by required conditions
release-please / publish-code-scan-action (push) Blocked by required conditions
release-please / attest-code-scan-action (push) Blocked by required conditions
Validate Renovate Config / Validate Renovate Configuration (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 13:24:08 +08:00
..

google-vertex-tools (Google Vertex Tools)

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

Purpose

This example demonstrates how to use Vertex AI models with:

  • Function calling and tool declarations
  • Function callback execution with local implementations
  • Different configuration approaches (YAML vs JavaScript)

Prerequisites

  1. Install the Google Auth Library:

    npm install google-auth-library
    
  2. Enable the Vertex AI API in your Google Cloud project

  3. Configure your Google Cloud project:

    gcloud config set project PROJECT_ID
    
  4. 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:

      1. Download your service account JSON

      2. Set the credentials path:

        export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
        

Configurations

This example includes two different approaches:

Basic Tool Declaration (promptfooconfig.yaml)

Uses external tool definitions and validates function calls without execution:

  • promptfooconfig.yaml - YAML configuration with external tools
  • tools.json - Function definitions for weather lookup

Function Callbacks (promptfooconfig-callback.js)

Demonstrates actual function execution with local callbacks:

  • promptfooconfig-callback.js - JavaScript configuration with inline tools and callbacks
  • Includes local function implementation for adding numbers

Running the Examples

  1. Basic tool declaration example:

    promptfoo eval -c promptfooconfig.yaml
    
  2. Function callback example:

    promptfoo eval -c promptfooconfig-callback.js
    
  3. View results:

    promptfoo view
    

Expected Results

  • Basic example: Validates that the model correctly calls the weather function with proper parameters
  • Callback example: Actually executes the addition function and validates the computed results

Learn More