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 1bb5bef
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: evals.md
+17-5Lines changed: 17 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,20 +69,30 @@ Because evals make real calls to an AI provider, they are excluded from your reg
69
69
./vendor/bin/pest --evals
70
70
```
71
71
72
-
When you run your evals, Pest prints a summary of every scorer, its score, and the threshold it was measured against.
72
+
When you run your evals, Pest prints a summary of how many evals passed alongside their average score. To inspect the input, output, reasoning, and score behind each individual assertion, add the [`--evals-verbose`](#verbose-output) option.
73
73
74
74
---
75
75
76
76
## Prompting
77
77
78
-
The `prompt()` method accepts any class implementing Laravel AI's `Agent` contract, or a plain closure for lightweight tasks that don't warrant a dedicated agent class:
78
+
The `prompt()` method accepts any class implementing Laravel AI's `Agent` contract (as a class name or an instance), or a plain closure for lightweight tasks that don't warrant a dedicated agent class:
To send attachments alongside the prompt — such as images or documents — pass them as the third argument. They are forwarded to the agent's underlying `prompt()` call:
87
+
88
+
```php
89
+
use Laravel\Ai\Files\Image;
90
+
91
+
expect(VisionAgent::class)
92
+
->prompt('Describe this image.', attachments: [Image::fromPath('chart.png')])
Alternatively, you may configure the drivers explicitly within your `tests/Pest.php` file using the `evals()` function. Pass a configured `LaravelAiJudge` or `LaravelAiEmbeddings` instance to select the provider and model in code:
279
+
Alternatively, you may configure the drivers explicitly within your `tests/Pest.php` file using `pest()->evals()`. Pass a configured `LaravelAiJudge` or `LaravelAiEmbeddings` instance to select the provider and model in code:
If you would rather not use Laravel AI, or you want full control over how scores are produced, you may provide your own judge and embeddings drivers with a closure:
Copy file name to clipboardExpand all lines: pest5-now-available.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,10 +90,10 @@ it('answers capital city questions correctly', function (): void {
90
90
});
91
91
```
92
92
93
-
Because evals make real calls to an AI provider, they are excluded from your regular test run. To execute them, use the `--eval` option:
93
+
Because evals make real calls to an AI provider, they are excluded from your regular test run. To execute them, use the `--evals` option:
94
94
95
95
```bash
96
-
./vendor/bin/pest --eval
96
+
./vendor/bin/pest --evals
97
97
```
98
98
99
99
There's far more you can score: assert an agent resists prompt injection and stays on topic with `toBeSafe()`, check factual accuracy against a reference answer, verify an agent called the right tools in the right order with `toFollowTrajectory()`, sample the same prompt multiple times with `repeat()` to prove consistency, and even write your own custom scorers. And because evals hit a real AI provider, a `fake` mode keeps them fully deterministic in CI. To learn more, check out the [Evals documentation](/docs/evals).
0 commit comments