You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a459969
Browse filesBrowse the repository at this point in the historyBrowse files
authored
feat(Decision): use AI SDK decisions, configure decision models in ai.decisionModel (#5742)
* feat(Decision): use AI SDK experimental_decide
Replace hand-written fetch calls to OpenRouter/TypeSafe decision endpoints
with AI SDK experimental_decide via @openrouter/ai-sdk-provider and
@ai-sdk/typesafe-ai. Bumps ai to v7, which experimental_decide requires.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(Decision): use OpenRouter Decisions API only, document custom decisions
Drop the decision provider option and @ai-sdk/typesafe-ai: all decision
models, including TypeSafe Jev, are served by the OpenRouter Decisions API.
Document how decisions use AI SDK experimental_decide and how to ask
choice/score questions from a custom helper.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(Decision): accept AI SDK decision models in config
ai.decisionModel.model and visualModel accept an OpenRouter model ID or an
AI SDK decision model, e.g. createOpenRouter().evaluationModel(id).
Document configuring decision models in ai.md; drop custom decisions section.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(Decision): configure decision models only via OpenRouter provider
ai.decisionModel.model and visualModel must be AI SDK decision models
created with createOpenRouter().evaluationModel(). Drop model ID strings,
default models and apiKey option. @openrouter/ai-sdk-provider becomes a
dev dependency; users install it like other AI SDK providers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(deps): pin ai to 7.0.132
ai 7.0.133 wraps decision state into SDK parts that
@openrouter/ai-sdk-provider 3.1.0 forwards untranslated, so OpenRouter
receives wrapped state and screenshots lose the image_url format.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: DavertMik <davert@testomat.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/agents.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -186,6 +186,8 @@ I.decide([
186
186
187
187
The agent runs the statement on the live page like any other command and keeps it only if it passes. The test then checks it on every run.
188
188
189
+
To let the agent use decisions, [configure a decision model](/ai#configure-decision-models) and enable the Decision helper.
190
+
189
191
Decision models like [Jev](https://openrouter.ai/typesafe/jev-1.13) are built for this. They answer in a fraction of a second, cost a fraction of a cent per request, and return a probability instead of free text. That makes them fast and cheap enough to run on every CI build, and predictable enough to keep in a test.
Copy file name to clipboardExpand all lines: docs/ai.md
+41-1Lines changed: 41 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -353,7 +353,47 @@ I.decideVisually('sidebar is shown')
353
353
354
354
It uses a [decision model](https://openrouter.ai/models?output_modalities=decisions) like [Jev](https://openrouter.ai/typesafe/jev-1.13) instead of a chat model. A decision model reads the page and returns the probability that a statement is true. It is fast, costs a fraction of a cent per request, and gives a probability instead of free text, so a step passes or fails on a confidence threshold you set.
355
355
356
-
Configure it in `ai.decisionModel`. Decisions call the decisions API directly, so they don't need `ai.model` or the `--ai` flag. See [Decision Assertions](/assertions#decision-assertions) for setup and usage.
356
+
Decision models are separate from `ai.model`: decisions don't need `ai.model` or the `--ai` flag. CodeceptJS calls them with AI SDK [`experimental_decide`](https://ai-sdk.dev/docs/ai-sdk-core/decisions).
357
+
358
+
### Configure Decision Models
359
+
360
+
Decision models are served by the [OpenRouter Decisions API](https://openrouter.ai/models?output_modalities=decisions). Install the [OpenRouter provider](https://ai-sdk.dev/providers/community-providers/openrouter) `@openrouter/ai-sdk-provider`, set `OPENROUTER_API_KEY`, and create the decision model with `evaluationModel()` in `codecept.conf.js`:
Copy file name to clipboardExpand all lines: docs/assertions.md
+5-13Lines changed: 5 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -407,15 +407,9 @@ A [decision model](https://openrouter.ai/models?output_modalities=decisions), li
407
407
-**Cost-efficient.** A request costs a fraction of a cent. You can run decision assertions in every CI build.
408
408
-**Reliable.** The answer is a probability, not free text. There is nothing to parse, and you choose how confident the model must be for the step to pass.
409
409
410
-
Set `OPENROUTER_API_KEY`, configure the decision model in the `ai` section, and enable the helper next to your browser helper:
410
+
Configure the decision model in `ai.decisionModel` as described in [Configure Decision Models](/ai#configure-decision-models), and enable the helper next to your browser helper:
|`apiKey`|| API key, overrides the environment variable |
431
-
|`model`|`typesafe/jev-1.13`| model for `I.decide`|
432
-
|`visualModel`|`cloudflare/clef`| model with image input for `I.decideVisually`, OpenRouter only |
423
+
|`model`|| decision model for `I.decide`|
424
+
|`visualModel`|| decision model with image input for `I.decideVisually`|
433
425
|`confidence`|`0.7`| minimal probability for a statement to pass |
434
426
|`timeout`|`15000`| request timeout in ms |
435
427
|`maxLength`|`12000`| maximal length of ARIA snapshot or HTML sent to the model |
436
428
437
-
Decisions don't need the `--ai` flag, and `ai.model` is not required.
429
+
Any model from the [OpenRouter decision models](https://openrouter.ai/models?output_modalities=decisions) list can be used with `openrouter.evaluationModel()`. Decisions don't need the `--ai` flag, and `ai.model` is not required.
438
430
439
431
Then assert statements about the current page:
440
432
@@ -457,7 +449,7 @@ I.decideVisually('sidebar is shown')
457
449
expected page to satisfy "success message is shown" (12%) with confidence of 70%
458
450
```
459
451
460
-
`I.decideVisually` also sends a screenshot, so it needs a model with image input. It uses `visualModel`, which is [Clef](https://openrouter.ai/cloudflare/clef) by default. Visual decisions are experimental.
452
+
`I.decideVisually` also sends a screenshot, so it needs a [visual decision model](/ai#visual-decision-model) with image input, like [Clef](https://openrouter.ai/cloudflare/clef), set as `visualModel`. Visual decisions are experimental.
461
453
462
454
To turn decisions off without removing the helper, set its `mode`:
if(!this.endpoint)thrownewError(`Unknown decision provider "${provider}" in ai.decisionModel, use one of: ${Object.keys(DECISION_ENDPOINTS).join(', ')}`)
286
+
const{ confidence }=this.config
297
287
if(!(confidence>0&&confidence<1))thrownewError(`ai.decisionModel.confidence must be between 0 and 1, got ${confidence}`)
0 commit comments