Recipe catalog / continuation-compare
Compare two musical continuations
continuation-compare is a Jev recipe from the jev-recipes TypeScript package. Which of firstContinuation and secondContinuation better follows the musical context in motif, contour, harmony, and any style supplied? Use it when a generation loop has produced two candidate continuations for a passage and wants a head-to-head preference before committing to one.
Last updated .
Explore this recipe interactively · Source and implementation guide · Markdown version
How do I use continuation-compare in TypeScript?
Install with npm install jev-recipes. Requires Node.js 22.9 or newer and ES modules. Set TYPESAFE_API_KEY in your server environment for live calls, which send input to TypeSafe and use API quota. See the installation guide.
import { continuationCompare } from 'jev-recipes/continuation-compare';
const result = await continuationCompare({
"context": "G major, 4/4. Opening motif: G4 A4 B4 D5 | B4 A4 G4 (half). A rising line to the fifth answered by a stepwise descent home.",
"firstContinuation": "D5 E5 F#5 A5 | F#5 E5 D5 (half). The motif transposed up a fifth, same rhythm, same rise-and-fall contour.",
"secondContinuation": "C#4 (eighth) G#5 (eighth) Bb3 (quarter) rest | Eb5 (dotted half). Wide chromatic leaps in a new, jagged rhythm.",
"style": "Celtic air, lyrical and unhurried",
"minConfidence": 0.8
});
console.log(result);
What input does continuation-compare take?
| Field | Type | Needed |
|---|---|---|
| context | string | Required |
| firstContinuation | string | Required |
| secondContinuation | string | Required |
| style | string | Optional |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"context": {
"type": "string"
},
"firstContinuation": {
"type": "string"
},
"secondContinuation": {
"type": "string"
},
"style": {
"type": "string"
},
"minConfidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"context",
"firstContinuation",
"secondContinuation"
]
},
"result": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"model": {
"type": "string"
},
"usage": {
"type": "object",
"properties": {
"input_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"output_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"input_tokens",
"output_tokens"
],
"additionalProperties": false
},
"status": {
"type": "string",
"enum": [
"ready",
"review"
]
},
"verdict": {
"type": "string",
"enum": [
"first",
"second",
"tie",
"neither",
"unclear"
]
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"probabilities": {
"type": "object",
"propertyNames": {
"type": "string",
"enum": [
"first",
"second",
"tie",
"neither",
"unclear"
]
},
"additionalProperties": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"required": [
"first",
"second",
"tie",
"neither",
"unclear"
]
}
},
"required": [
"model",
"usage",
"status",
"verdict",
"confidence",
"probabilities"
],
"additionalProperties": false
}
}What does a continuation-compare result look like?
This hand-authored response demonstrates the contract. It is not a model accuracy measurement. Run it without an API key: npx jev-recipes demo continuation-compare.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"verdict": "first",
"confidence": 0.91,
"probabilities": {
"first": 0.91,
"second": 0.02,
"tie": 0.02,
"neither": 0.03,
"unclear": 0.02
}
}
Input
See shared options and behavior for client configuration, validation, and errors. Types are inferred from this folder's Zod 4 schemas. style is optional and is omitted from the request when absent.
Result
verdict is first, second, tie, neither, or unclear. first and second name the preferred candidate. tie means both fit about equally. neither means no candidate fits, which is a confident answer rather than a failure.
A result is ready when confidence meets minConfidence and the verdict is not unclear. probabilities covers all five outcomes.
Reuse and calls
Uses the shared comparison helper, which fixes the five outcomes and tells Jev that presentation order is irrelevant. This folder owns the question wording and the four outcome descriptions. A live invocation makes one logical Jev request.
Limits
The comparison is a judgment of musical sense from the written notes and descriptions, not a theory check: whether a continuation stays in the key, how far its leaps reach, and whether it fills the bar are exact questions for application code, which should annotate the text when they matter. A preference between two continuations says nothing about their absolute quality, so first can win against a poor second and still be a weak continuation; neither covers the case where both break with context. Style preference is a matter of taste, so continuations that fit similarly well can come out tie or swap order on different runs.
Example input
demo.json contains editable input and a hand-authored response. After installing jev-recipes, npx jev-recipes demo continuation-compare shows an offline illustration, not an accuracy measurement. Use npx jev-recipes describe continuation-compare to inspect the input and result schemas.
How accurate is continuation-compare?
No verified live accuracy measurement is available. Evaluate representative cases before using this decision in your workflow.
Use the evaluation guide to measure this decision on your own labeled cases.
What are the limits of continuation-compare?
- Compares the two continuations as written. It does not verify key membership, count beats, or check voice leading; do those exactly in application code and describe the results in the text.
- A preferred continuation is only better than the other one supplied; neither may be good.
- Style preference is a judgment, so continuations that fit similarly well can tie or swap on different runs.
Which recipes are related to continuation-compare?
- draft-compare: Use draft-compare to choose between two text drafts under a rubric, not between two musical continuations of a passage.
- action-compare: Use action-compare to compare two next steps against a goal and constraints, rather than two continuations against a musical context.