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
155 lines
4.7 KiB
YAML
155 lines
4.7 KiB
YAML
# End-to-end test for script value resolution fix (#6200)
|
|
# Tests that file:// script output is correctly used by assertion handlers
|
|
|
|
providers:
|
|
- id: echo
|
|
|
|
prompts:
|
|
- '{{prompt}}'
|
|
|
|
tests:
|
|
# Test 1: llm-rubric with JavaScript file:// script
|
|
- description: 'llm-rubric should use JS script output as rubric'
|
|
vars:
|
|
prompt: 'SCRIPT_OUTPUT_12345'
|
|
topic: 'machine learning'
|
|
assert:
|
|
- type: llm-rubric
|
|
value: file://rubric-generator.cjs:knownValue
|
|
provider: echo
|
|
|
|
# Test 2: contains with JavaScript file:// script
|
|
- description: 'contains should use JS script output'
|
|
vars:
|
|
prompt: 'The answer is SCRIPT_OUTPUT_12345 here'
|
|
assert:
|
|
- type: contains
|
|
value: file://rubric-generator.cjs:knownValue
|
|
|
|
# Test 3: equals with JavaScript file:// script
|
|
- description: 'equals should use JS script output'
|
|
vars:
|
|
prompt: 'SCRIPT_OUTPUT_12345'
|
|
assert:
|
|
- type: equals
|
|
value: file://rubric-generator.cjs:knownValue
|
|
|
|
# Test 4: regex with JavaScript file:// script
|
|
- description: 'regex should use JS script output as pattern'
|
|
vars:
|
|
prompt: 'Code: 12345'
|
|
pattern: "\\d+"
|
|
assert:
|
|
- type: regex
|
|
value: file://rubric-generator.cjs:getPattern
|
|
|
|
# Test 5: contains-all with JavaScript file:// script (array return)
|
|
- description: 'contains-all should use JS script array output'
|
|
vars:
|
|
prompt: 'This has reference one and also reference two in it'
|
|
assert:
|
|
- type: contains-all
|
|
value: file://rubric-generator.cjs:referenceArray
|
|
|
|
# Test 6: contains with numeric return
|
|
- description: 'contains should handle numeric script output'
|
|
vars:
|
|
prompt: 'The answer is 0'
|
|
assert:
|
|
- type: contains
|
|
value: file://rubric-generator.cjs:numericValue
|
|
|
|
# Test 7: javascript assertion with file:// (regression - should still work)
|
|
- description: 'javascript assertion should use script as grading function'
|
|
vars:
|
|
prompt: 'this contains expected word'
|
|
assert:
|
|
- type: javascript
|
|
value: file://rubric-generator.cjs:gradingFunction
|
|
|
|
# Test 8: javascript assertion inline (regression - should still work)
|
|
- description: 'javascript assertion inline should still work'
|
|
vars:
|
|
prompt: 'hello world'
|
|
assert:
|
|
- type: javascript
|
|
value: output.includes("hello")
|
|
|
|
# Test 9: Direct value (no script) - baseline
|
|
- description: 'Direct value should work as before'
|
|
vars:
|
|
prompt: 'expected text'
|
|
assert:
|
|
- type: contains
|
|
value: 'expected'
|
|
|
|
# Test 10: equals with empty string from script
|
|
- description: 'equals should handle empty string from script'
|
|
vars:
|
|
prompt: ''
|
|
assert:
|
|
- type: equals
|
|
value: file://rubric-generator.cjs:emptyValue
|
|
|
|
# Test 11: Python script for contains
|
|
- description: 'contains should use Python script output'
|
|
vars:
|
|
prompt: 'The answer is SCRIPT_OUTPUT_12345 here'
|
|
assert:
|
|
- type: contains
|
|
value: file://rubric-generator.py:known_value
|
|
|
|
# Test 12: Python script for equals
|
|
- description: 'equals should use Python script output'
|
|
vars:
|
|
prompt: 'SCRIPT_OUTPUT_12345'
|
|
assert:
|
|
- type: equals
|
|
value: file://rubric-generator.py:known_value
|
|
|
|
# Test 13: starts-with with JavaScript script
|
|
- description: 'starts-with should use JS script output'
|
|
vars:
|
|
prompt: 'SCRIPT_OUTPUT_12345 is the answer'
|
|
assert:
|
|
- type: starts-with
|
|
value: file://rubric-generator.cjs:knownValue
|
|
|
|
# Test 14: icontains (case insensitive) with script
|
|
- description: 'icontains should use script output case-insensitively'
|
|
vars:
|
|
prompt: 'the answer is script_output_12345 here'
|
|
assert:
|
|
- type: icontains
|
|
value: file://rubric-generator.cjs:knownValue
|
|
|
|
# Test 15: not-contains with script (inverse)
|
|
- description: 'not-contains should use script output'
|
|
vars:
|
|
prompt: 'this does not have the magic value'
|
|
assert:
|
|
- type: not-contains
|
|
value: file://rubric-generator.cjs:knownValue
|
|
|
|
# Test 16: Dynamic rubric with context vars
|
|
- description: 'llm-rubric should pass context to script'
|
|
vars:
|
|
prompt: 'Machine learning explanation here'
|
|
topic: 'neural networks'
|
|
assert:
|
|
- type: llm-rubric
|
|
value: file://rubric-generator.cjs:rubric
|
|
provider: echo
|
|
|
|
# Test 17: Multiple assertions on same test
|
|
- description: 'Multiple script-based assertions should all work'
|
|
vars:
|
|
prompt: 'SCRIPT_OUTPUT_12345'
|
|
assert:
|
|
- type: equals
|
|
value: file://rubric-generator.cjs:knownValue
|
|
- type: contains
|
|
value: file://rubric-generator.cjs:knownValue
|
|
- type: starts-with
|
|
value: file://rubric-generator.cjs:knownValue
|