Skip to content

feat(evaluator): add a generic evaluation kind - #5

Merged
dylnslck merged 4 commits into
ByteSliceHQ:mainfrom
reachjalil:feat/jev-evaluator-module
Sep 24, 2026
Merged

dylnslck merged 4 commits into
ByteSliceHQ:mainfrom
reachjalil:feat/jev-evaluator-module

Conversation

@reachjalil

@reachjalil reachjalil commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Stack (2/2) — merge after #6

Order PR What it ships
1/2 #6 defineKind / createKind
2/2 (this) #5 A generic evaluator kind on that builder

Unique files (ignore #6 in the GitHub “Files changed” tab):
reachjalil:feat/define-kind...reachjalil:feat/jev-evaluator-module

This branch is feat/define-kind plus the evaluator commits. Both PRs target main. Merge #6 first, then this.

Delivered value

A durable workflow can score typed questions, write the result on the run log, and branch — the same composition slot as defineAgent, defineWorkflow, and gate().

The thread kind is evaluator. A model id is an argument, not a second definition helper. TypeSafe Jev is one model you can pass; a later model uses the same definition and a different id.

const scoreRefund = defineEvaluator({
  name: 'score-refund',
  model: 'typesafe-ai/jev',
  questions: { /* boolean | choice | score */ },
  skipModel: (input) => (input.amount >= 500 ? { route: 'review', reason: 'skipped' } : undefined),
  route: ({ answers }) => ({ route: 'auto' | 'review', reason: 'model' | 'uncertain' }),
})

defineEvaluator is defineKind('evaluator', def) plus questions, optional model, optional skipModel, and route. Output on the log is evaluator.evaluated (answers, application route string, reason: model | uncertain | skipped | unavailable). A workflow ctx.spawns it; an agent can wrap it with asEvaluatorTool; evaluate() is the inline gate()-shaped wait.

vercelEvaluator({ model }) calls the Vercel AI SDK experimental_evaluate API. Omitting model uses typesafe-ai/jev.

In this diff (unique vs #6)

  • @swirls/looms/evaluator — thread, evaluate effect, stub evaluator, evaluations projection
  • vercelEvaluator() in @swirls/looms/ai-vercel (experimental_evaluate; needs ai 7.0.105+)
  • Stub example: refund score → auto / review / skip-large → maybe spawn a stub agent
  • asEvaluatorTool, docs, minor changeset

Default evaluator is a stub, so CI needs no key.

Not in this PR

Review

  1. Merge or read feat(core): add defineKind and createKind for custom types #6 first
  2. Unique compare link above, then packages/evaluator/src/definitions.ts and examples/evaluator.ts
  3. bun run --filter @looms/examples evaluator

@reachjalil
reachjalil marked this pull request as draft September 17, 2026 19:39
@reachjalil
reachjalil force-pushed the feat/jev-evaluator-module branch from 1f38670 to 7edac6f Compare September 17, 2026 20:00
@reachjalil
reachjalil marked this pull request as ready for review September 17, 2026 21:12
@reachjalil
reachjalil force-pushed the feat/jev-evaluator-module branch from 7edac6f to a59f4b0 Compare September 17, 2026 21:36
@reachjalil

Copy link
Copy Markdown
Contributor Author

Stack 2/2. Merge #6 first.

Unique diff (this PR only): reachjalil:feat/define-kind...reachjalil:feat/jev-evaluator-module

@dylnslck
dylnslck force-pushed the feat/jev-evaluator-module branch from a59f4b0 to e7c2cf3 Compare September 24, 2026 19:35
@dylnslck dylnslck changed the title feat(jev): add TypeSafe Jev as a first-class run kind feat(evaluator): add a generic evaluation kind Sep 24, 2026
@dylnslck

Copy link
Copy Markdown
Contributor

I generalized this off the Jev name. The capability is an evaluation thread: typed boolean, choice, and score questions, then a route and reason on the log. Jev is one model that does that, not the kind.

The package is now @swirls/looms/evaluator with kind evaluator. defineJev and vercelJev() stay as presets that select typesafe-ai/jev. Another model that answers the same questions uses vercelEvaluator({ model }).

Rebased onto main. #6 is still just defineKind / createKind and should merge first.

@dylnslck

Copy link
Copy Markdown
Contributor

Follow-up: the Jev-named helpers are gone from the public API. There is no defineJev, vercelJev, or asJevTool.

Pass the model id on the generic helpers:

defineEvaluator({ name: 'score-refund', model: 'typesafe-ai/jev', questions })
vercelEvaluator({ model: 'typesafe-ai/jev' })

vercelEvaluator() still defaults the model string to typesafe-ai/jev when you omit model. The kind, events, and package stay evaluator.

@dylnslck
dylnslck force-pushed the feat/jev-evaluator-module branch from b586130 to 8502050 Compare September 24, 2026 21:06
dylnslck and others added 4 commits September 24, 2026 15:10
Score typed questions and branch on route and reason.
The thread kind stays evaluator.

Co-authored-by: Cursor <[email protected]>
Select a model with defineEvaluator({ model }).
There is no defineJev, vercelJev, or asJevTool helper.

Co-authored-by: Cursor <[email protected]>
Drop the log-triage sample from the public module.
Call experimental_evaluate directly.

Co-authored-by: Cursor <[email protected]>
@dylnslck
dylnslck force-pushed the feat/jev-evaluator-module branch from 8502050 to cf5f4a6 Compare September 24, 2026 21:11
@dylnslck
dylnslck merged commit a879e8b into ByteSliceHQ:main Sep 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants