jevrecipes

Recipe catalog / passage-mood

Identify a passage's mood

passage-mood is a Jev recipe from the jev-recipes TypeScript package. What mood does the described musical passage express? Use it when a musical passage is described in text, such as mode, tempo, register, and dynamics, and you need one of a fixed set of moods to compare against a request or to log what was played.

Last updated .

Explore this recipe interactively · Source and implementation guide · Markdown version

How do I use passage-mood 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 { passageMood } from 'jev-recipes/passage-mood';

const result = await passageMood({
  "passage": "D minor, slow tempo around 52 bpm, melody in the low-middle register moving mostly by step and descending at the end of each phrase, sustained chords in the left hand, dynamics piano throughout, frequent suspensions that resolve downward.",
  "minConfidence": 0.8
});
console.log(result);

What input does passage-mood take?

FieldTypeNeeded
passagestringRequired
minConfidencenumberOptional
Full input and result schemas
{
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "passage": {
        "type": "string"
      },
      "minConfidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "required": [
      "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"
        ]
      },
      "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
  }
}

What does a passage-mood 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 passage-mood.

{
  "model": "demo-fixture",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0
  },
  "status": "ready",
  "verdict": "sad",
  "confidence": 0.88,
  "probabilities": {
    "happy": 0,
    "sad": 0.88,
    "calm": 0.07,
    "energetic": 0,
    "tense": 0.02,
    "romantic": 0.02,
    "unclear": 0.01
  }
}

Input

See shared options and behavior for client configuration, validation, and errors. Types are inferred from this folder's Zod 4 schemas.

Result

verdict is one of happy, sad, calm, energetic, tense, romantic, unclear. unclear means the supplied facts do not establish a decision and always requires review.

A result is ready when confidence meets minConfidence and the verdict is not unclear. Inspect the verdict as well as the status: a ready result can name an outcome your application treats as negative. probabilities covers every verdict.

Reuse and calls

Uses the shared choice helper for the Jev call and response parsing. This folder owns its question, verdict criteria, and review policy. A live invocation makes one logical Jev request.

Limits

The label is the conventional affect of the musical features the text describes, which is not a claim about how any real listener felt or what the performer meant. Because the recipe reads a description rather than audio, a vague or inaccurate description gives a mood about the words, and sparse descriptions land on unclear. Mixed passages resolve to one dominant mood, so application code that needs a blend should describe the passage in sections and call the recipe on each.

Example input

demo.json contains editable input and a hand-authored response. After installing jev-recipes, npx jev-recipes demo passage-mood shows an offline illustration, not an accuracy measurement. Use npx jev-recipes describe passage-mood to inspect the input and result schemas.

How accurate is passage-mood?

Fixture only

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 passage-mood?