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
167 lines
4.4 KiB
YAML
167 lines
4.4 KiB
YAML
# yaml-language-server: $schema=https://promptfoo.dev/config-schema.json
|
|
description: HTTP provider with TLS certificates
|
|
|
|
prompts:
|
|
- 'Explain {{topic}} in simple terms'
|
|
|
|
providers:
|
|
# Basic configuration with CA certificate
|
|
- id: http
|
|
label: HTTPS with CA cert
|
|
config:
|
|
url: https://localhost:8443/chat/completions
|
|
method: POST
|
|
headers:
|
|
Content-Type: application/json
|
|
Authorization: Bearer {{ env.API_KEY }}
|
|
body:
|
|
model: gpt-4o-mini
|
|
messages:
|
|
- role: system
|
|
content: You are a helpful assistant that explains complex topics simply
|
|
- role: user
|
|
content: '{{prompt}}'
|
|
temperature: 0.7
|
|
tls:
|
|
# CA certificate for verifying server certificates
|
|
caPath: ./certs/ca-cert.pem
|
|
rejectUnauthorized: true
|
|
transformResponse: 'json.choices[0].message.content'
|
|
maxRetries: 0
|
|
|
|
# Mutual TLS (client certificate authentication)
|
|
- id: http
|
|
label: HTTPS with mTLS
|
|
config:
|
|
url: https://localhost:8443/chat/completions
|
|
method: POST
|
|
headers:
|
|
Content-Type: application/json
|
|
body:
|
|
prompt: '{{prompt}}'
|
|
max_tokens: 150
|
|
tls:
|
|
# CA for verifying server
|
|
caPath: ./certs/ca-cert.pem
|
|
# Client certificate for authentication
|
|
certPath: ./certs/client-cert.pem
|
|
keyPath: ./certs/client-key.pem
|
|
rejectUnauthorized: true
|
|
# Optional: Override server name for SNI
|
|
servername: secure-api.example.com
|
|
transformResponse: 'json.result'
|
|
maxRetries: 0
|
|
|
|
# PFX/PKCS12 certificate bundle
|
|
- id: http
|
|
label: HTTPS with PFX
|
|
config:
|
|
url: https://localhost:8443/chat/completions
|
|
method: POST
|
|
headers:
|
|
Content-Type: application/json
|
|
X-API-Key: '{{ env.API_KEY }}'
|
|
body:
|
|
input: '{{prompt}}'
|
|
tls:
|
|
# PFX bundle containing cert and key
|
|
pfxPath: ./certs/client.pfx
|
|
passphrase: testpassword
|
|
rejectUnauthorized: true
|
|
transformResponse: 'json.output'
|
|
maxRetries: 0
|
|
|
|
# Development configuration (self-signed certificates)
|
|
- id: http
|
|
label: HTTPS dev mode
|
|
config:
|
|
url: https://localhost:8443/chat/completions
|
|
method: POST
|
|
headers:
|
|
Content-Type: application/json
|
|
body:
|
|
message: '{{prompt}}'
|
|
tls:
|
|
# WARNING: Only for development!
|
|
rejectUnauthorized: false
|
|
transformResponse: 'json.response'
|
|
maxRetries: 0
|
|
|
|
# Advanced TLS configuration
|
|
- id: http
|
|
label: HTTPS with advanced TLS
|
|
config:
|
|
url: https://localhost:8443/chat/completions
|
|
method: POST
|
|
headers:
|
|
Content-Type: application/json
|
|
Authorization: Bearer {{ env.API_KEY }}
|
|
body:
|
|
query: '{{prompt}}'
|
|
tls:
|
|
caPath: ./certs/ca-cert.pem
|
|
certPath: ./certs/client-cert.pem
|
|
keyPath: ./certs/client-key.pem
|
|
rejectUnauthorized: true
|
|
servername: high-security.example.com
|
|
# Restrict to strong ciphers
|
|
ciphers: 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256'
|
|
# Enforce modern TLS versions
|
|
minVersion: 'TLSv1.2'
|
|
maxVersion: 'TLSv1.3'
|
|
transformResponse: 'json.data'
|
|
maxRetries: 0
|
|
|
|
defaultTest:
|
|
assert:
|
|
- type: not-empty
|
|
value: 'Response should not be empty'
|
|
|
|
tests:
|
|
- vars:
|
|
topic: quantum computing
|
|
assert:
|
|
- type: contains-any
|
|
value:
|
|
- quantum
|
|
- qubit
|
|
- superposition
|
|
- entanglement
|
|
- type: min-length
|
|
value: 50
|
|
|
|
- vars:
|
|
topic: blockchain technology
|
|
assert:
|
|
- type: contains-any
|
|
value:
|
|
- blockchain
|
|
- distributed
|
|
- ledger
|
|
- cryptocurrency
|
|
- type: javascript
|
|
value: |
|
|
if (!output || output.length < 50) {
|
|
return {
|
|
pass: false,
|
|
score: 0,
|
|
reason: 'Response too short'
|
|
};
|
|
}
|
|
return {
|
|
pass: true,
|
|
score: 1,
|
|
reason: 'Response is detailed enough'
|
|
};
|
|
|
|
- vars:
|
|
topic: machine learning
|
|
assert:
|
|
- type: llm-rubric
|
|
value: |
|
|
The explanation should:
|
|
1. Be understandable to a non-technical audience
|
|
2. Include at least one real-world example
|
|
3. Avoid excessive jargon
|
|
Rate the response on a scale of 0-1 for clarity and completeness
|