Recipe catalog / mood-request
Identify a requested mood
What mood does the listener's message ask to hear?
A listener's message asks for a feeling from a musical performance and you need one of a fixed set of moods to steer the next passage.
Explore this recipe interactively ยท Source and implementation guide
Use mood-request 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 { moodRequest } from 'jev-recipes/mood-request';
const result = await moodRequest({
"message": "long day, can we get something soft and dreamy? trying to wind down before bed",
"minConfidence": 0.8
});
console.log(result);
Input contract
| Field | Type | Needed |
|---|---|---|
| message | string | Required |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"message": {
"type": "string"
},
"minConfidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"message"
]
},
"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": [
"happy",
"sad",
"calm",
"energetic",
"tense",
"romantic",
"unclear"
]
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"probabilities": {
"type": "object",
"propertyNames": {
"type": "string",
"enum": [
"happy",
"sad",
"calm",
"energetic",
"tense",
"romantic",
"unclear"
]
},
"additionalProperties": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"required": [
"happy",
"sad",
"calm",
"energetic",
"tense",
"romantic",
"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 mood-request.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"verdict": "calm",
"confidence": 0.9,
"probabilities": {
"happy": 0.01,
"sad": 0.02,
"calm": 0.9,
"energetic": 0.01,
"tense": 0.01,
"romantic": 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
- Labels the mood the message asks for, not the mood the listener is in. A listener who says they are sad may be asking for cheerful music.
- Messages that ask for a tempo, style, or piece without naming a feeling land on unclear rather than being translated into a mood.
- Mixed or contradictory requests collapse to the mood pressed most or to unclear; the recipe returns one label.
Related recipes
- emotion-kind: Use emotion-kind to label the emotion the writer expresses, rather than the mood they ask the music to take on.
- turn-intent: Use turn-intent to find out what a message is doing conversationally before asking which mood it requests.