Recipe catalog / continuation-compare
Compare two musical continuations
Which of firstContinuation and secondContinuation better follows the musical context in motif, contour, harmony, and any style supplied?
A generation loop has produced two candidate continuations for a passage and wants a head-to-head preference before committing to one.
Explore this recipe interactively ยท Source and implementation guide
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);
Input contract
| 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
}
}Saved example result
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
}
}
Evaluation evidence
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.
Limitations
- 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.
Related recipes
- 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.