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-aistudio-gemini (Google AI Studio (Gemini and Gemma) Example)

You can run this example with:

npx promptfoo@latest init --example google-aistudio-gemini
cd google-aistudio-gemini

This example demonstrates using Google's Gemini and Gemma models with promptfoo to evaluate math puzzle-solving capabilities.

Prerequisites

  • promptfoo CLI installed (npm install -g promptfoo or brew install promptfoo)
  • Google AI Studio API key set as GOOGLE_API_KEY

Available Models

The example tests across multiple Gemini and Gemma models:

  • Gemma 4 31B IT - Open model with strong reasoning, coding, and agentic capabilities
  • Gemma 4 26B A4B IT - Smaller open Gemma 4 model for lower-latency reasoning and coding evals
  • Gemini 3.5 Flash - Newest, fastest frontier Flash model with high-effort thinking
  • Gemini 3.1 Pro - Frontier model with improved reasoning and multimodal understanding
  • Gemini 3 Flash - Frontier Flash model with strong reasoning at lower latency
  • Gemini 3.1 Flash-Lite - Low-latency, cost-efficient model for high-volume tasks
  • Gemini 2.5 Pro - Stable model with strong reasoning, coding, and multimodal understanding; also used with structured JSON output and function calling
  • Gemini 2.5 Flash - Stable Flash model with enhanced reasoning and thinking capabilities
  • Gemini 2.5 Flash-Lite - Cost-efficient and fast 2.5 model, optimized for high-volume, latency-sensitive tasks
  • gemini-embedding-001 - Embedding model used for similarity-based assertions

System Instructions from File

This example also demonstrates how to load system instructions from an external file using the file:// prefix:

providers:
  - id: google:gemini-2.5-pro
    label: gemini-with-system-instruction-file
    config:
      systemInstruction: file://system-instruction.txt

The system-instruction.txt file contains reusable instructions that can be:

  • Shared across multiple configurations
  • Version controlled separately
  • Used to manage complex or lengthy system prompts

Image Understanding Example

This example also includes an image understanding configuration (promptfooconfig.image.yaml) that demonstrates:

  • Multimodal capabilities: Using Gemini models to analyze and compare images
  • Image file handling: Loading images using the file:// prefix
  • Visual comparison: Testing the model's ability to identify and compare different images

Images should be placed on separate lines in the prompt. The file:// prefix automatically handles loading and encoding the images for the Gemini API.

Running the Eval

  1. Get a local copy of the configuration:
promptfoo init --example google-aistudio-gemini
  1. Run the examples:
# Basic math puzzle evaluation across multiple Gemini and Gemma models
promptfoo eval

# Image understanding and comparison evaluation
promptfoo eval -c promptfooconfig.image.yaml
  1. View the results:
promptfoo view