-
Notifications
You must be signed in to change notification settings - Fork 0
Feat: Adopt TypeScript Template Literals for Custom Evaluator Prompts #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
…t templates Add TypeScript/JavaScript support for custom evaluator prompts using the same subprocess pattern as code judges. Changes: - Add PromptTemplateInputSchema and definePromptTemplate to @agentv/eval - Update orchestrator to execute .ts/.js prompt files as subprocesses - Add config and resolvedPromptPath to LlmJudgeEvaluatorConfig - Skip validation for executable prompt templates in evaluator parser - Add unit tests for PromptTemplateInputSchema - Add integration tests for executable prompt templates - Add example in examples/features/prompt-template-sdk/ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4e912bd to
40e8fc6
Compare
Move OpenSpec to archive after implementation is complete. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Archive change to openspec/changes/archive/2026-01-28-adopt-ts-template-prompts/ - Create new spec openspec/specs/custom-evaluator-prompts/ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Reuse CodeJudgeInputSchema for PromptTemplateInputSchema (consistent payloads) - Add timeout support to executePromptTemplate (prevents hanging scripts) - Validate non-empty output from prompt templates - Throw error for missing .ts/.js prompt template files (fail-fast) - Update tests to reflect required fields Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…lates
Change executable prompt templates to use explicit script arrays instead
of auto-detecting runtime by file extension. This matches the code_judge
pattern for consistency.
Before:
prompt: ../prompts/custom-evaluator.ts # ambiguous runtime
After:
prompt:
script: [bun, run, ../prompts/custom-evaluator.ts]
config: { ... }
Benefits:
- Consistent with code_judge pattern (one mental model)
- No ambiguity about runtime (user explicitly specifies bun/node/python)
- Future-proof (works with any runtime without code changes)
- Aligns with "Built-ins for Primitives Only" design principle
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Maintains backward compatibility for users who were using --eval-id. Shows deprecation warning when used. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reverts to --eval-id as the primary flag for filtering eval cases. This aligns with Jest/Vitest convention (--testNamePattern) where the flag name describes what is being filtered, not the action. Removes --filter alias to keep the CLI simple and match existing docs. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document the new definePromptTemplate SDK for creating dynamic LLM judge prompts with TypeScript. Includes YAML configuration example and available context fields. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Add
definePromptTemplateSDK wrapper to@agentv/evalthat mirrorsdefineCodeJudge. Update orchestrator to execute .ts/.js prompt files as subprocesses.Changes
SDK (
@agentv/eval):PromptTemplateInputSchemainpackages/eval/src/schemas.tsdefinePromptTemplatewrapper inpackages/eval/src/prompt-template.tsdefinePromptTemplate,PromptTemplateInput,PromptTemplateInputSchema,PromptTemplateHandlerCore (
@agentv/core):LlmJudgeEvaluatorConfigto includeconfigandresolvedPromptPathexecutePromptTemplatefunction inorchestrator.tsresolveCustomPromptto detect and execute.ts/.jsfilesTesting:
PromptTemplateInputSchema(14 tests)Example:
examples/features/prompt-template-sdk/with TypeScript prompt template exampleTest plan
bun run buildpassesbun run typecheckpassesbun run lintpassesbun testpasses (369 tests)🤖 Generated with Claude Code