142 lines
4.0 KiB
YAML

# yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
description: 'swap-integration Skill Evaluation'
# Prompt template that injects skill context + case content via vars
prompts:
- file://prompt-wrapper.txt
# Provider configuration
providers:
- id: anthropic:claude-sonnet-4-5-20250929
config:
temperature: 0
max_tokens: 8192 # Swap integrations need more tokens for complete examples
# Default test configuration applied to all tests
defaultTest:
options:
timeout: 120000 # 2 minutes per case
vars:
skill_content: file://../../../packages/plugins/uniswap-trading/skills/swap-integration/SKILL.md
# Test cases with specific assertions
tests:
- vars:
case_content: file://cases/basic.md
assert:
# Correctness rubric
- type: llm-rubric
value: file://rubrics/correctness.txt
threshold: 0.8
provider: anthropic:claude-sonnet-4-5-20250929
# Completeness rubric
- type: llm-rubric
value: file://rubrics/completeness.txt
threshold: 0.85
provider: anthropic:claude-sonnet-4-5-20250929
# Deterministic checks for required patterns
- type: contains
value: 'trade-api.gateway.uniswap.org'
- type: contains
value: 'check_approval'
- type: contains
value: '/quote'
- type: contains
value: '/swap'
- vars:
case_content: file://cases/eth-to-token-swap.md
assert:
# Correctness rubric
- type: llm-rubric
value: file://rubrics/correctness.txt
threshold: 0.8
provider: anthropic:claude-sonnet-4-5-20250929
# Completeness rubric
- type: llm-rubric
value: file://rubrics/completeness.txt
threshold: 0.85
provider: anthropic:claude-sonnet-4-5-20250929
# Deterministic checks for ETH-specific patterns
- type: contains
value: 'trade-api.gateway.uniswap.org'
- type: contains
value: '/quote'
- type: contains
value: '/swap'
- type: contains
value: 'value'
- type: contains
value: 'permitData'
# Anti-pattern check: quote wrapping is checked via the LLM rubric
# (not-contains is too blunt for destructuring patterns like `const { quote: quoteResponse }`)
- vars:
case_content: file://cases/security-pitfalls.md
assert:
# Correctness rubric
- type: llm-rubric
value: file://rubrics/correctness.txt
threshold: 0.8
provider: anthropic:claude-sonnet-4-5-20250929
# Completeness rubric
- type: llm-rubric
value: file://rubrics/completeness.txt
threshold: 0.85
provider: anthropic:claude-sonnet-4-5-20250929
# Must include validation patterns
- type: contains
value: 'swap.data'
- type: contains
value: 'permitData'
- type: contains
value: 'signature'
- type: contains
value: 'isAddress'
# Must strip null fields (destructuring pattern)
- type: contains
value: 'permitTransaction'
# Anti-pattern checks: The model may reference these patterns in comments,
# tests, or explanations (which is correct for a security guide). The LLM
# rubric above validates the actual implementation avoids them.
- vars:
case_content: file://cases/smart-account-swap.md
assert:
# Correctness rubric
- type: llm-rubric
value: file://rubrics/correctness.txt
threshold: 0.8
provider: anthropic:claude-sonnet-4-5-20250929
# Completeness rubric
- type: llm-rubric
value: file://rubrics/completeness.txt
threshold: 0.85
provider: anthropic:claude-sonnet-4-5-20250929
# Must include Trading API flow
- type: contains
value: 'trade-api.gateway.uniswap.org'
# Must reference smart account / ERC-4337 patterns
- type: contains
value: 'sendUserOperation'
# Must include WETH handling
- type: contains
value: 'withdraw'
# Must use viem
- type: contains
value: 'viem'