Skip to content

Add starts-with and ends-with eval assertion types #2

@TheStack-ai

Description

@TheStack-ai

Context

The eval engine (pulser eval) supports 5 assertion types: contains, not-contains, min-length, max-length, matches.

Missing: starts-with and ends-with — the most natural string checks after contains.

Use case

# eval.yaml
tests:
  - name: "output starts with summary"
    input: "Review this code"
    assert:
      - starts-with: "## Summary"
      - ends-with: "recommendation"

Currently requires a regex via matches, which is cumbersome and error-prone.

What to do

  1. Add starts-with and ends-with to the assertion type in src/eval/types.ts
  2. Add the two cases in src/eval/assertions.ts — follow the existing pattern

The existing assertions are just if branches. This is two more.

Files to modify

  • src/eval/types.ts — add to AssertionDef type
  • src/eval/assertions.ts — add two cases

Difficulty: Easy

~15 minutes for someone familiar with TypeScript.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions