Skip to content
This repository was archived by the owner on Jun 17, 2026. It is now read-only.

Scaffold behavioral evals in 'pc init' - #96

Closed
jamsea wants to merge 4 commits into
mainfrom
jh/init-evals-scaffolding
Closed

Scaffold behavioral evals in 'pc init'#96
jamsea wants to merge 4 commits into
mainfrom
jh/init-evals-scaffolding

Conversation

@jamsea

@jamsea jamsea commented Jun 11, 2026

Copy link
Copy Markdown

What this does

Adds opt-in scaffolding for Pipecat's new behavioral eval framework (pipecat-ai/pipecat#4655) when creating a project.

For cascade bots on standard transports (daily, smallwebrtc, websocket, twilio, telnyx, plivo, exotel):

  • Eligible projects get evals on by default: the wizard shows "Behavioral evals: Yes (recommended)" in its defaults summary, and asks "Include behavioral evals?" under feature customization. Non-interactive runs use --evals/--no-evals or an "evals" key in --config JSON.
  • The generated bot gets an "eval" entry in transport_params, so uv run bot.py -t eval works.
  • The project ships server/evals/scenario.yaml: a text-mode smoke scenario (greeting check + a question graded by an LLM judge). The judge follows the project LLM: openai when the bot uses OpenAI (key is already in .env), otherwise local Ollama with a commented OpenAI alternative.
  • The pipecat-ai dependency gains the cli extra, so uv run pipecat eval run evals/scenario.yaml works.
  • README gains a "Testing your bot (evals)" section, and the next-steps output gets a "Run evals" line.

Realtime mode and the Daily PSTN / Twilio+Daily SIP special flows reject --evals with a validation error (they don't go through the unified create_transport path).

⚠️ Release coupling

The eval framework merged into pipecat main on June 11 but is not in a release yet (latest is v1.3.0). Until the next pipecat release:

  • generated evals projects get an unknown-extra warning from uv, and -t eval doesn't exist
  • the new evals configs are deliberately left out of the slow "installable" tests

Keep this as a draft until that release ships.

Testing

  • uv run pytest -m "not slow": 448 passed (new generation configs for both judge variants, plus 4 new validator tests)
  • Manual smoke tests: OpenAI judge variant, Ollama judge variant, --no-evals baseline (no eval traces in bot.py/pyproject/README), realtime rejection, --dry-run JSON includes enable_evals
  • Registry regenerated with uv run scripts/update_registry.py (diff is the single new evals entry in FEATURE_IMPORTS)

🤖 Generated with Claude Code

jamsea added 3 commits June 11, 2026 11:04
For cascade bots on standard transports, 'pc init' can now include
Pipecat's behavioral eval framework (pipecat-ai/pipecat#4655):

- New 'enable_evals' feature: wizard question (default yes when
  eligible), '--evals/--no-evals' flag, and an 'evals' key in
  --config JSON. Realtime mode and the Daily PSTN / Twilio+Daily SIP
  flows reject it with a validation error.
- The generated bot exposes an 'eval' transport entry, so
  'uv run bot.py -t eval' works.
- New 'server/evals/scenario.yaml': a text-mode smoke scenario. The
  judge follows the project LLM (openai when the bot uses OpenAI,
  otherwise local Ollama with a commented openai alternative).
- The pipecat-ai dependency gains the 'cli' extra so
  'uv run pipecat eval run evals/scenario.yaml' works.
- README gains a 'Testing your bot (evals)' section.

Requires the pipecat release after 1.3.0.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds opt-in scaffolding for Pipecat behavioral evals during pc init project generation, including generated scenario YAML, bot transport wiring, dependency extras, README guidance, and validation/test coverage.

Changes:

  • Introduces an enable_evals feature flag across interactive prompts, non-interactive config/CLI, validation, and project generation.
  • Adds templates for server/evals/scenario.yaml plus an evals README block and bot -t eval transport exposure.
  • Extends registry/import generation and updates tests to cover evals scenarios and validation errors.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/test_project_generation.py Adds generation assertions for evals scaffolding (scenario YAML, bot transport, pyproject extras, README section).
tests/test_config_validator.py Adds validator tests for rejecting evals in unsupported mode/transports and JSON field inclusion.
src/pipecat_cli/templates/server/evals/scenario.yaml.jinja2 New scenario template for behavioral eval harness with OpenAI/Ollama judge selection.
src/pipecat_cli/templates/server/bot_cascade.py.jinja2 Adds optional "eval" transport_params entry using WebsocketServerParams when evals enabled.
src/pipecat_cli/templates/README.md.jinja2 Conditionally includes an evals README block when evals enabled.
src/pipecat_cli/templates/_readme_blocks/evals.jinja2 New README block documenting how to run evals.
src/pipecat_cli/registry/service_metadata.py Adds evals feature definition for import generation.
src/pipecat_cli/registry/service_loader.py Includes evals feature imports when enabled.
src/pipecat_cli/registry/_imports.py Adds generated import for WebsocketServerParams under the evals feature.
src/pipecat_cli/prompts/questions.py Adds evals eligibility logic, config flag, and interactive prompt wiring.
src/pipecat_cli/generators/project.py Generates evals files, injects feature flags, adds cli extra, and prints next-steps eval commands.
src/pipecat_cli/config_validator.py Validates --evals constraints and includes enable_evals in built config and JSON.
src/pipecat_cli/commands/init.py Adds --evals/--no-evals, config-file merging, and passes evals into validation.
scripts/imports/import_generator.py Adds explicit module mapping for WebsocketServerParams for deterministic import regeneration.
CHANGELOG.md Documents the new pc init eval scaffolding capability and release coupling note.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/pipecat_cli/commands/init.py Outdated
Comment thread src/pipecat_cli/commands/init.py Outdated
Comment thread src/pipecat_cli/commands/init.py Outdated
Comment thread src/pipecat_cli/prompts/questions.py
Addresses Copilot review feedback: with a plain bool default, an
explicit --no-evals could not override "evals": true in a --config
file (the or-merge always preferred the file). The flag now defaults
to None, the file value only applies when the flag is omitted, and
the resolved value is coerced to bool before validation.

Adds CLI-level tests covering flag-vs-file precedence.
@jamsea
jamsea requested review from aconchillo and markbackman June 11, 2026 03:30
@markbackman

markbackman commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

The CLI is moving into Pipecat and this repo and package are being deprecated.

We can add the evals to it, but let's follow this commit exactly:
pipecat-ai/pipecat@1164c37

Mind reworking this to align? For example, let's remove server/evals/scenario.yaml.

@jamsea

jamsea commented Jun 11, 2026

Copy link
Copy Markdown
Author

@markbackman thanks for the info I'll rework this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants