Documentation menu

JEV: multiple-choice decisions

Ask a question about text, an image, audio or video in PHP and get one of your own options back, with a probability for each, from a local Jev-Omni decision model.

Ask a question about text, an image, an audio file or a video, and get back one of the options you offered, with a probability for each, using a local JEV decision model.

Setup#

Terminal
vendor/bin/loves-ai setup jev
vendor/bin/loves-ai pull akhilaaa3/Jev-Omni

Supported models#

JEV models are decision classifiers: instead of writing an answer, they score every option you give and return a probability for each, so the result is always one of your options. That suits routing, moderation, yes/no checks and triage, where the answer must come from a fixed set.

A JEV model is a chat model with a decision head, shipped as head.pt and decision_config.json beside the weights, e.g. akhilaaa3/Jev-Omni, a Gemma 4 12B model. Chat models without that head are rejected before starting, with an explanation. The model's own Python loader, jev_omni.py, is never run: the runner rebuilds the head from its weights alone.

Jev-Omni is large: a 24 GB pull, and about as much free GPU or unified memory to run. Its authors test it on CUDA GPUs; on Apple Silicon it needs a Mac with 32 GB or more, and on a CPU a single question can take minutes. Decide in a queue job, not in a web request.

From the command line#

Pass the question, then its options. What the question is about is either text, with --state, or a file, with --media.

Terminal
vendor/bin/loves-ai jev akhilaaa3/Jev-Omni "Has the meeting started?" Yes No --state="The meeting starts at 10 AM. It is now 9 AM."
vendor/bin/loves-ai jev akhilaaa3/Jev-Omni "What is on the table?" "A cat" "A dog" "Nothing" --media=photo.jpg
Output
๐Ÿค” Weighing the options with akhilaaa3/Jev-Omniโ€ฆ Perfect time for a cup of tea and a cookie ๐Ÿช
If you wish to see all logs, re-run the command with the "--debug" option.
๐ŸŽ‰ akhilaaa3/Jev-Omni chose: No (98.6%)
      Yes    1.4%
   ๐Ÿ‘‰ No    98.6%

Options#

Option Meaning
--state=TEXT What the question is about, as text
--media=PATH Image, audio or video file the question is about
--modality=KIND image, audio or video (default: told by the file's extension)
--frames=N Frames sampled evenly from a video (default: 16)
--device=DEVICE cpu, cuda, mpsโ€ฆ (default: the best available)
--log-file=PATH Append the runner's output to this file
--debug Show the runner's output while deciding

Give 2 to 256 different options; the model answers best with up to 20. Audio is read up to its first 30 seconds, and decoded by the runner itself, as are videos, with no FFmpeg installation needed.

Defaults come from config/jev.php (log_file).

From PHP#

PHP
use PhpLovesAi\Runner\Jev;

// Finds the runner and the pulled model in the project's .local directory by itself.
$jev = new Jev();

$decision = $jev->decide(
    model: 'akhilaaa3/Jev-Omni',
    question: 'Has the meeting started?',
    options: ['Yes', 'No'],
    state: 'The meeting starts at 10 AM. It is now 9 AM.',
);

$decision->prediction;    // 'No'
$decision->index;         // 1
$decision->confidence;    // 0.986
$decision->probabilities; // ['Yes' => 0.014, 'No' => 0.986]

$mood = $jev->decide(
    model: 'akhilaaa3/Jev-Omni',
    question: 'How does the caller sound?',
    options: ['Happy', 'Neutral', 'Upset'],
    mediaPath: storage_path('app/call.m4a'),
);

Errors#

  • \InvalidArgumentException for fewer than two options, duplicate options or an unknown modality
  • MediaNotFoundException when the media file does not exist
  • BinaryNotInstalledException when setup jev has not been run
  • ModelNotFoundException when the model was not pulled yet
  • UnsupportedModelException when the model has no decision head
  • RunFailedException, with the runner's error output, when the run fails, e.g. when the media cannot be decoded