Recipe catalog / mood-match
Check a passage against a requested mood
Does the described passage deliver requestedMood?
A listener asked for a mood and a passage has been generated or described, and you want to check the passage delivers that mood before playing or committing to it.
Explore this recipe interactively ยท Source and implementation guide
Use mood-match 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 { moodMatch } from 'jev-recipes/mood-match';
const result = await moodMatch({
"requestedMood": "calm, something to relax to",
"passage": "Fast tempo around 160 bpm, driving repeated sixteenth notes in the left hand, diminished and augmented chords with frequent chromatic shifts, sudden accents on off-beats, fortissimo throughout, melody leaping in the high register.",
"minConfidence": 0.8
});
console.log(result);
Input contract
| Field | Type | Needed |
|---|---|---|
| requestedMood | string | Required |
| passage | string | Required |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"requestedMood": {
"type": "string"
},
"passage": {
"type": "string"
},
"minConfidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"requestedMood",
"passage"
]
},
"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"
]
},
"probability": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"verdict": {
"type": "string",
"enum": [
"matches",
"mismatched"
]
}
},
"required": [
"model",
"usage",
"status",
"probability",
"confidence",
"verdict"
],
"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 mood-match.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"probability": 0.04,
"confidence": 0.96,
"verdict": "mismatched"
}
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 two texts as written. It cannot hear the passage and does not know whether the description matches what was played.
- Judges conventional musical affect, not the reaction of any particular listener, who may hear the same passage differently.
- A mismatched verdict flags the passage for a change; it does not say what to change.
Related recipes
- audience-fit: Use audience-fit to check material against a described audience rather than a described musical passage against a requested mood.
- instruction-fit: Use instruction-fit to check whether an instruction's scope covers a task, rather than whether music delivers a feeling.