chore: import upstream snapshot with attribution
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
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
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
# config-js (JavaScript Configuration)
|
||||
|
||||
You can run this example with:
|
||||
|
||||
```bash
|
||||
npx promptfoo@latest init --example config-js
|
||||
cd config-js
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
This example is pre-configured in `promptfooconfig.js`. That means you can just run:
|
||||
|
||||
```bash
|
||||
promptfoo eval
|
||||
```
|
||||
@@ -0,0 +1,98 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<title>Table Output</title>
|
||||
<style>
|
||||
body {
|
||||
font-family:
|
||||
-apple-system,
|
||||
BlinkMacSystemFont,
|
||||
Segoe UI,
|
||||
Roboto,
|
||||
Helvetica,
|
||||
Arial,
|
||||
sans-serif;
|
||||
}
|
||||
table,
|
||||
th,
|
||||
td {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
text-align: left;
|
||||
word-break: break-all;
|
||||
}
|
||||
th,
|
||||
td {
|
||||
padding: 5px;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
tr > td[data-content^='[PASS]'] {
|
||||
color: green;
|
||||
}
|
||||
tr > td[data-content^='[FAIL]'] {
|
||||
color: #ad0000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table>
|
||||
<thead>
|
||||
<th>Rephrase this in {{language}}: {{body}}</th>
|
||||
|
||||
<th>Translate this to conversational {{language}}: {{body}}</th>
|
||||
|
||||
<th>body</th>
|
||||
|
||||
<th>language</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td data-content="Bonjour le monde">Bonjour le monde</td>
|
||||
|
||||
<td data-content="Bonjour le monde">Bonjour le monde</td>
|
||||
|
||||
<td data-content="Hello world">Hello world</td>
|
||||
|
||||
<td data-content="French">French</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td data-content="J'ai faim.">J'ai faim.</td>
|
||||
|
||||
<td data-content="J'ai faim.">J'ai faim.</td>
|
||||
|
||||
<td data-content="I'm hungry">I'm hungry</td>
|
||||
|
||||
<td data-content="French">French</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td data-content="Ahoy thar, world!">Ahoy thar, world!</td>
|
||||
|
||||
<td data-content="Ahoy thar world!">Ahoy thar world!</td>
|
||||
|
||||
<td data-content="Hello world">Hello world</td>
|
||||
|
||||
<td data-content="Pirate">Pirate</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td data-content="Arrr, me belly be empty and yearnin' for grub.">
|
||||
Arrr, me belly be empty and yearnin' for grub.
|
||||
</td>
|
||||
|
||||
<td data-content="Arrr, me belly be rumblin'! I be needin' some grub!">
|
||||
Arrr, me belly be rumblin'! I be needin' some grub!
|
||||
</td>
|
||||
|
||||
<td data-content="I'm hungry">I'm hungry</td>
|
||||
|
||||
<td data-content="Pirate">Pirate</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,181 @@
|
||||
{
|
||||
"version": 1,
|
||||
"results": [
|
||||
{
|
||||
"prompt": {
|
||||
"raw": "Rephrase this in French: Hello world",
|
||||
"display": "Rephrase this in {{language}}: {{body}}"
|
||||
},
|
||||
"vars": {
|
||||
"language": "French",
|
||||
"body": "Hello world"
|
||||
},
|
||||
"response": {
|
||||
"output": "Bonjour le monde",
|
||||
"tokenUsage": {
|
||||
"cached": 19
|
||||
}
|
||||
},
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"prompt": {
|
||||
"raw": "Translate this to conversational French: Hello world",
|
||||
"display": "Translate this to conversational {{language}}: {{body}}"
|
||||
},
|
||||
"vars": {
|
||||
"language": "French",
|
||||
"body": "Hello world"
|
||||
},
|
||||
"response": {
|
||||
"output": "Bonjour le monde",
|
||||
"tokenUsage": {
|
||||
"cached": 20
|
||||
}
|
||||
},
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"prompt": {
|
||||
"raw": "Rephrase this in French: I'm hungry",
|
||||
"display": "Rephrase this in {{language}}: {{body}}"
|
||||
},
|
||||
"vars": {
|
||||
"language": "French",
|
||||
"body": "I'm hungry"
|
||||
},
|
||||
"response": {
|
||||
"output": "J'ai faim.",
|
||||
"tokenUsage": {
|
||||
"cached": 24
|
||||
}
|
||||
},
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"prompt": {
|
||||
"raw": "Translate this to conversational French: I'm hungry",
|
||||
"display": "Translate this to conversational {{language}}: {{body}}"
|
||||
},
|
||||
"vars": {
|
||||
"language": "French",
|
||||
"body": "I'm hungry"
|
||||
},
|
||||
"response": {
|
||||
"output": "J'ai faim.",
|
||||
"tokenUsage": {
|
||||
"cached": 25
|
||||
}
|
||||
},
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"prompt": {
|
||||
"raw": "Rephrase this in Pirate: Hello world",
|
||||
"display": "Rephrase this in {{language}}: {{body}}"
|
||||
},
|
||||
"vars": {
|
||||
"language": "Pirate",
|
||||
"body": "Hello world"
|
||||
},
|
||||
"response": {
|
||||
"output": "Ahoy thar, world!",
|
||||
"tokenUsage": {
|
||||
"cached": 23
|
||||
}
|
||||
},
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"prompt": {
|
||||
"raw": "Translate this to conversational Pirate: Hello world",
|
||||
"display": "Translate this to conversational {{language}}: {{body}}"
|
||||
},
|
||||
"vars": {
|
||||
"language": "Pirate",
|
||||
"body": "Hello world"
|
||||
},
|
||||
"response": {
|
||||
"output": "Ahoy thar world!",
|
||||
"tokenUsage": {
|
||||
"cached": 23
|
||||
}
|
||||
},
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"prompt": {
|
||||
"raw": "Rephrase this in Pirate: I'm hungry",
|
||||
"display": "Rephrase this in {{language}}: {{body}}"
|
||||
},
|
||||
"vars": {
|
||||
"language": "Pirate",
|
||||
"body": "I'm hungry"
|
||||
},
|
||||
"response": {
|
||||
"output": "Arrr, me belly be empty and yearnin' for grub.",
|
||||
"tokenUsage": {
|
||||
"cached": 33
|
||||
}
|
||||
},
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"prompt": {
|
||||
"raw": "Translate this to conversational Pirate: I'm hungry",
|
||||
"display": "Translate this to conversational {{language}}: {{body}}"
|
||||
},
|
||||
"vars": {
|
||||
"language": "Pirate",
|
||||
"body": "I'm hungry"
|
||||
},
|
||||
"response": {
|
||||
"output": "Arrr, me belly be rumblin'! I be needin' some grub!",
|
||||
"tokenUsage": {
|
||||
"cached": 39
|
||||
}
|
||||
},
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"stats": {
|
||||
"successes": 8,
|
||||
"failures": 0,
|
||||
"tokenUsage": {
|
||||
"total": 0,
|
||||
"prompt": 0,
|
||||
"completion": 0,
|
||||
"cached": 206
|
||||
}
|
||||
},
|
||||
"table": {
|
||||
"head": {
|
||||
"prompts": [
|
||||
"Rephrase this in {{language}}: {{body}}",
|
||||
"Translate this to conversational {{language}}: {{body}}"
|
||||
],
|
||||
"vars": ["body", "language"]
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"outputs": ["Bonjour le monde", "Bonjour le monde"],
|
||||
"vars": ["Hello world", "French"]
|
||||
},
|
||||
{
|
||||
"outputs": ["J'ai faim.", "J'ai faim."],
|
||||
"vars": ["I'm hungry", "French"]
|
||||
},
|
||||
{
|
||||
"outputs": ["Ahoy thar, world!", "Ahoy thar world!"],
|
||||
"vars": ["Hello world", "Pirate"]
|
||||
},
|
||||
{
|
||||
"outputs": [
|
||||
"Arrr, me belly be empty and yearnin' for grub.",
|
||||
"Arrr, me belly be rumblin'! I be needin' some grub!"
|
||||
],
|
||||
"vars": ["I'm hungry", "Pirate"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
module.exports = {
|
||||
description: 'A translator built with LLM',
|
||||
prompts: ['prompts.txt'],
|
||||
providers: ['openai:gpt-4.1-mini'],
|
||||
tests: [
|
||||
{
|
||||
vars: {
|
||||
language: 'French',
|
||||
body: 'Hello world',
|
||||
},
|
||||
},
|
||||
{
|
||||
vars: {
|
||||
language: 'French',
|
||||
body: "I'm hungry",
|
||||
},
|
||||
},
|
||||
{
|
||||
vars: {
|
||||
language: 'Pirate',
|
||||
body: 'Hello world',
|
||||
},
|
||||
},
|
||||
{
|
||||
vars: {
|
||||
language: 'Pirate',
|
||||
body: "I'm hungry",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
Rephrase this in {{language}}: {{body}}
|
||||
---
|
||||
Translate this to conversational {{language}}: {{body}}
|
||||
Reference in New Issue
Block a user