oh-my-promptfoo 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -126
- package/dist/cli.js +318 -136
- package/dist/cli.js.map +1 -1
- package/dist/delegate-runner.js +3 -3
- package/dist/delegate-runner.js.map +1 -1
- package/dist/index.cjs +545 -247
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +520 -222
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,144 +1,43 @@
|
|
|
1
1
|
# oh-my-promptfoo
|
|
2
2
|
|
|
3
|
-
Run coding-agent evaluations with stock Promptfoo.
|
|
3
|
+
Run coding-agent evaluations with stock Promptfoo. The package owns a private
|
|
4
|
+
workspace per test, can run Copilot in an existing directory, and provides an
|
|
5
|
+
independent assertion for named semantic criteria.
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
| Use case | Promptfoo provider |
|
|
7
|
+
| Use case | Promptfoo reference |
|
|
8
8
|
| --- | --- |
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
12
|
-
`Provider` owns the workspace for each evaluation row. `CopilotSdkProvider` uses your existing directory. Neither scores agent output; the independent `llmAssert` export below can grade named rubric criteria.
|
|
9
|
+
| Isolated workspace with pinned Git, OCI artifact, or trusted local-directory sources | `package:oh-my-promptfoo:Provider` |
|
|
10
|
+
| Copilot in a directory managed by the caller | `package:oh-my-promptfoo:CopilotSdkProvider` |
|
|
11
|
+
| One judge request for named rubric criteria | `package:oh-my-promptfoo/assertions:llmAssert` |
|
|
13
12
|
|
|
14
13
|
## Install
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
Node 22.22+ and Promptfoo 0.122.x or 0.124.x are required. The Copilot SDK is
|
|
16
|
+
an optional peer; install it when using either Copilot provider.
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
19
|
npm install --save-dev promptfoo@0.124.0 oh-my-promptfoo
|
|
20
|
-
|
|
21
|
-
npm install --save-dev @github/copilot-sdk@1.0.6
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Set the credential for the agent you select before running an evaluation. OCI sources also require an ORAS 1.x executable supplied through `ALLAGENTS_ORAS_PATH`.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
## Grade named criteria with one judge request
|
|
28
|
-
|
|
29
|
-
Use the public `package:oh-my-promptfoo/assertions:llmAssert` reference in a stock Promptfoo JavaScript assertion. The assertion works with any provider; it does not require a workspace provider.
|
|
30
|
-
|
|
31
|
-
```yaml
|
|
32
|
-
tests:
|
|
33
|
-
- assert:
|
|
34
|
-
- type: javascript
|
|
35
|
-
value: package:oh-my-promptfoo/assertions:llmAssert
|
|
36
|
-
config:
|
|
37
|
-
threshold: 0.7
|
|
38
|
-
components:
|
|
39
|
-
- metric: accuracy
|
|
40
|
-
value: Grounds every factual claim in the provided material
|
|
41
|
-
weight: 2
|
|
42
|
-
- metric: clarity
|
|
43
|
-
value: Explains the result clearly
|
|
20
|
+
npm install --save-dev @github/copilot-sdk@1.0.17 # Copilot only
|
|
44
21
|
```
|
|
45
22
|
|
|
46
|
-
Set
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
`
|
|
50
|
-
plain objects. Weights default to 1. The weighted mean must reach
|
|
51
|
-
`threshold` (default 0.7), and every component must pass: an explicit judge
|
|
52
|
-
`pass` flag takes precedence over its score; otherwise the component score
|
|
53
|
-
must reach the threshold. Missing, duplicate, malformed, or unknown grades
|
|
54
|
-
fail the assertion. Promptfoo receives `componentResults`, `namedScores`,
|
|
55
|
-
and `namedScoreWeights`. Grading instructions and criteria use the system
|
|
56
|
-
message; the candidate output is passed separately as untrusted user content.
|
|
57
|
-
The judge request has a 120-second deadline.
|
|
58
|
-
|
|
59
|
-
This is a package-supplied JavaScript assertion, not Promptfoo's proposed
|
|
60
|
-
native [`llm-rubric.value.components` feature](https://github.com/promptfoo/promptfoo/issues/10069).
|
|
61
|
-
|
|
62
|
-
## Prepare a workspace and run an agent
|
|
23
|
+
Set the agent credential through `delegate.env` in authored evals. Set
|
|
24
|
+
`OPENAI_API_KEY` and `OPENAI_MODEL` separately when using `llmAssert`. OCI inputs
|
|
25
|
+
require ORAS 1.x through `ALLAGENTS_ORAS_PATH`. A trusted runner must provide
|
|
26
|
+
`ALLAGENTS_LOCAL_SOURCE_ROOT` before acquiring `type: local` sources.
|
|
63
27
|
|
|
64
|
-
|
|
28
|
+
## Author and run an eval
|
|
65
29
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
config:
|
|
72
|
-
delegate:
|
|
73
|
-
id: openai:codex-sdk
|
|
74
|
-
config:
|
|
75
|
-
model: gpt-5.3-codex
|
|
76
|
-
sandbox_mode: workspace-write
|
|
77
|
-
env:
|
|
78
|
-
OPENAI_API_KEY: "{{env.OPENAI_API_KEY}}"
|
|
79
|
-
workspace:
|
|
80
|
-
sources:
|
|
81
|
-
- type: git
|
|
82
|
-
repository: https://github.com/allagentsdev/oh-my-promptfoo.git
|
|
83
|
-
ref: main
|
|
84
|
-
destination: project
|
|
85
|
-
workingDir: project
|
|
86
|
-
tests:
|
|
87
|
-
- vars:
|
|
88
|
-
task: Read README.md and write a summary to summary.txt in this repository.
|
|
89
|
-
assert:
|
|
90
|
-
- type: javascript
|
|
91
|
-
value: |
|
|
92
|
-
return import('node:fs').then(fs => {
|
|
93
|
-
const root = context.providerResponse.metadata.workspace.path;
|
|
94
|
-
return fs.readFileSync(root + '/project/summary.txt', 'utf8').length > 0;
|
|
95
|
-
});
|
|
96
|
-
```
|
|
30
|
+
Start with the [agent-facing usage skill](https://github.com/allagentsdev/oh-my-promptfoo/blob/main/skills/oh-my-promptfoo/SKILL.md)
|
|
31
|
+
for concrete workspace, Copilot, file-assertion, and grading examples. The
|
|
32
|
+
[examples](https://github.com/allagentsdev/oh-my-promptfoo/tree/main/examples)
|
|
33
|
+
contain full Promptfoo configs; the [provider guide](https://github.com/allagentsdev/oh-my-promptfoo/blob/main/docs/provider-guide.md)
|
|
34
|
+
covers limits, permissions, source provenance, cleanup, and cache behavior.
|
|
97
35
|
|
|
98
36
|
```sh
|
|
99
|
-
npx promptfoo
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
The workspace stays available while Promptfoo runs assertions. `metadata.workspace.path` is a transient local path, not a durable artifact. For Codex, Claude, and Copilot variants, see the [workspace examples](https://github.com/allagentsdev/oh-my-promptfoo/tree/main/examples).
|
|
103
|
-
|
|
104
|
-
## Run Copilot in an existing directory
|
|
105
|
-
|
|
106
|
-
`CopilotSdkProvider` runs Copilot in an existing `working_dir`. Set `COPILOT_WORKING_DIR` to an absolute path. This provider does not prepare Git or OCI sources.
|
|
107
|
-
|
|
108
|
-
```yaml
|
|
109
|
-
# promptfooconfig.yaml
|
|
110
|
-
prompts: ["{{task}}"]
|
|
111
|
-
providers:
|
|
112
|
-
- id: package:oh-my-promptfoo:CopilotSdkProvider
|
|
113
|
-
config:
|
|
114
|
-
working_dir: "{{env.COPILOT_WORKING_DIR}}"
|
|
115
|
-
env:
|
|
116
|
-
COPILOT_GITHUB_TOKEN: "{{env.COPILOT_GITHUB_TOKEN}}"
|
|
117
|
-
tests:
|
|
118
|
-
- vars:
|
|
119
|
-
task: Explain the purpose of this repository.
|
|
120
|
-
assert:
|
|
121
|
-
- type: regex
|
|
122
|
-
value: .+
|
|
37
|
+
npx promptfoo validate config -c promptfooconfig.yaml
|
|
38
|
+
npx promptfoo eval -c promptfooconfig.yaml
|
|
123
39
|
```
|
|
124
40
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
## Configuration at a glance
|
|
130
|
-
|
|
131
|
-
| Field | Applies to | Meaning |
|
|
132
|
-
| --- | --- | --- |
|
|
133
|
-
| `config.delegate.id` | `Provider` | Required: `openai:codex-sdk`, `anthropic:claude-agent-sdk`, or `copilot-sdk` |
|
|
134
|
-
| `config.delegate.config` | `Provider` | Agent-specific settings, such as model and sandbox mode |
|
|
135
|
-
| `config.delegate.env` | `Provider` | Explicit credentials passed to the delegated agent |
|
|
136
|
-
| `config.workspace.sources` | `Provider` | Required array of Git or OCI sources; `[]` creates an empty workspace |
|
|
137
|
-
| `config.workspaceTimeoutMs` | `Provider` | Optional workspace-preparation deadline; falls back to `ALLAGENTS_WORKSPACE_TIMEOUT_MS`, then 120,000 ms |
|
|
138
|
-
| `config.workingDir` | `Provider` | Optional relative directory inside the prepared workspace; defaults to its root |
|
|
139
|
-
| `config.fileChanges` | `Provider` | Optional bounded file-change evidence; defaults to `false` |
|
|
140
|
-
| `config.timeoutMs` | `Provider` | Agent-call deadline; independent of preparation and defaults to 900,000 ms |
|
|
141
|
-
| `config.working_dir` | `CopilotSdkProvider` | Required existing directory |
|
|
142
|
-
| `config.env`, `config.permissions` | `CopilotSdkProvider` | Explicit Copilot credentials and permissions |
|
|
143
|
-
|
|
144
|
-
Promptfoo's `package:` reference needs the exported class suffix shown above; the npm package name alone is not a provider ID. See the [provider guide](https://github.com/allagentsdev/oh-my-promptfoo/blob/main/docs/provider-guide.md) for source permissions, response metadata, cleanup, caching, and full configuration details.
|
|
41
|
+
`Provider` starts the agent at its private workspace root unless `workingDir`
|
|
42
|
+
selects a prepared subdirectory. The optional `agent-workspace/` sibling layout
|
|
43
|
+
is documented in the provider guide; the root layout remains the default.
|