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

101 lines
2.7 KiB
YAML

# yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
#
# Vercel AI SDK Example
#
# Demonstrates dynamic prompt construction with the Vercel AI SDK.
# The provider builds prompts based on persona, task type, and context,
# then reports the actual prompt sent to the LLM.
#
# Setup:
# cd examples/integration-vercel/ai-sdk
# npm install
# export OPENAI_API_KEY=sk-...
#
# Run:
# npx promptfoo@latest eval
description: Vercel AI SDK with dynamic prompt construction
providers:
- id: file://./aiSdkProvider.mjs
config:
model: gpt-4o-mini
temperature: 0.7
prompts:
- '{{topic}}'
tests:
# Expert persona with explain task
- description: Quantum computing for students
vars:
topic: quantum entanglement
persona: expert
task_type: explain
domain: quantum physics
audience: college students
assert:
- type: llm-rubric
value: explains quantum entanglement clearly with appropriate examples
# Coder persona with explain task
- description: Async/await for junior devs
vars:
topic: async/await patterns in JavaScript
persona: coder
task_type: explain
domain: JavaScript
audience: junior developers
assert:
- type: icontains
value: async
- type: icontains
value: await
# Analyst persona with comparison task
- description: Compare SQL vs NoSQL
vars:
topic: SQL databases vs NoSQL databases
persona: analyst
task_type: compare
domain: database systems
format: structured comparison with pros/cons
assert:
- type: icontains
value: SQL
- type: llm-rubric
value: provides balanced comparison of both database types
# Expert with troubleshooting task
- description: Debug memory leaks
vars:
topic: memory leaks in Node.js applications
persona: coder
task_type: troubleshoot
domain: Node.js performance
audience: senior engineers
assert:
- type: icontains
value: memory
- type: llm-rubric
value: provides actionable debugging steps
# With RAG-style context injection
- description: Explain with context (RAG simulation)
vars:
topic: transformer architecture
persona: expert
task_type: explain
domain: machine learning
audience: ML engineers
context: |
From "Attention Is All You Need" (2017):
The Transformer uses self-attention to compute representations
of its input and output without using sequence-aligned RNNs or
convolution.
assert:
- type: icontains
value: attention
- type: llm-rubric
value: references or builds upon the provided context