This repository was archived by the owner on Jun 17, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Scaffold behavioral evals in 'pc init' #96
Closed
Closed
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7f899c9
Scaffold behavioral evals in 'pc init'
jamsea 58d5eda
Add tests for behavioral evals scaffolding
jamsea 3d2e0f7
Add changelog entry for behavioral evals scaffolding
jamsea 80db8d2
Make --evals tri-state so explicit flags beat --config values
jamsea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| ## Testing your bot (evals) | ||
|
|
||
| This project includes a behavioral eval scenario (`server/evals/scenario.yaml`). It | ||
| drives a text conversation with your bot and uses an LLM judge to check the replies. | ||
|
|
||
| 1. **Run the bot with the eval transport** (terminal 1, from `server/`): | ||
|
|
||
| ```bash | ||
| uv run bot.py -t eval | ||
| ``` | ||
|
|
||
| 2. **Run the scenario** (terminal 2, from `server/`): | ||
|
|
||
| ```bash | ||
| uv run pipecat eval run evals/scenario.yaml | ||
| ``` | ||
|
|
||
| {% if llm_service in ['openai_llm', 'openai_responses_llm'] %} | ||
| The judge uses OpenAI (`OPENAI_API_KEY` from your `.env`). | ||
| {% else %} | ||
| The judge runs locally via [Ollama](https://ollama.com). Install it and pull the | ||
| model first (`ollama pull gemma2:9b`), or switch the scenario's judge to OpenAI. | ||
| {% endif %} | ||
|
|
||
| Edit `evals/scenario.yaml` to add turns and checks for your own use case. See the | ||
| [Pipecat evals docs](https://docs.pipecat.ai) for the full scenario format, | ||
| including audio-mode scenarios and function call assertions. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/pipecat_cli/templates/server/evals/scenario.yaml.jinja2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Behavioral eval scenario for {{ project_name }}. | ||
| # | ||
| # Run it in two terminals (both from server/): | ||
| # 1. uv run bot.py -t eval | ||
| # 2. uv run pipecat eval run evals/scenario.yaml | ||
| # | ||
| # Each turn optionally sends a `user:` message, then asserts `expect:` events in | ||
| # order (response, llm_started, llm_response, function_call, user_transcription). | ||
| # Expectations support `within_ms` (latency budget), `text_contains` (substring), | ||
| # and `eval` (a natural-language criterion graded by the judge LLM below). | ||
| name: {{ project_name | replace('-', '_') }}_smoke | ||
|
|
||
| judge: | ||
| eval: | ||
| {% if llm_service in ['openai_llm', 'openai_responses_llm'] %} | ||
| service: openai # uses OPENAI_API_KEY from your .env | ||
| model: gpt-4o | ||
| # Or run the judge locally with Ollama (https://ollama.com, then `ollama pull gemma2:9b`): | ||
| # service: ollama | ||
| # model: gemma2:9b | ||
| {% else %} | ||
| service: ollama # local judge: install Ollama (https://ollama.com), then `ollama pull gemma2:9b` | ||
| model: gemma2:9b | ||
| # Or use OpenAI as the judge (requires OPENAI_API_KEY in your .env): | ||
| # service: openai | ||
| # model: gpt-4o | ||
| {% endif %} | ||
|
|
||
| turns: | ||
| # Wait for the bot's on-connect greeting before speaking. | ||
| - expect: | ||
| - event: response | ||
| eval: "the bot opens the conversation in some way (a greeting, an introduction, or an offer to help)" | ||
|
|
||
| - user: "What is the capital of France?" | ||
| expect: | ||
| - event: response | ||
| eval: "the response says the capital of France is Paris" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.