Can someone explain how JEV is different from a simple embeddings model?
How is JEV any different from using an embeddings model? I really will appreciate if someone can explain this to me - because I have yet to see the difference. I'll even give you my JEV server for free! It uses ollama, you install ollama pull nomic-embed-text:latest. % python3 ./jev_embedding.py "How high is the sky?" find_phone: 0.38 volume: 0.41 calendar: 0.44 tell_the_time: 0.49 weather: 0.53 % python3 ./jev_embedding.py "I had this thing on my anus. The doctor burned it off with a laser." weather: 0.35 tell_the_time: 0.36 calendar: 0.37 volume: 0.38 find_phone: 0.43 % python3 ./jev_embedding.py "can you help me locate my phone." volume: 0.38 weather: 0.40 calendar: 0.43 tell_the_time: 0.53 find_phone: 0.89 % python3 ./jev_embedding.py "Hello Cleveland! I can't HEAR you" weather: 0.37 calendar: 0.40 tell_the_time: 0.44 find_phone: 0 volume: 0.56 #!/usr/bin/env python3 """ jev_embedding.py — minimal showcase of the embedding-based intent router, excised from jarvis_workflow.py. Given a phrase on the command line, it embeds the phrase and every example utterance (via the local Ollama embedding model), then prints the cosine similarity of the phrase to each intent — the raw routing signal — instead of running a handler and speaking an answer. python3 jev_embedding.py "How high is the sky?" """ import sys import requests # --- Config (same endpoint/model as jarvis_workflow.py) --- OLLAMA_EMBED_URL = "http://localhost:11434/api/embeddings" INTENT_EMBED_MODEL = "nomic-embed-text" # --- The five cases to detect --- # label -> example utterances, matched by similarity. INTENTS = { "volume": [ "turn the volume up", "make it quieter", "set the volume to seven", ], "tell_the_time": [ "what time is it", "can you tell me the time", ], "weather": [ "how's the weather going to be today", "will it rain today", "do I need a raincoat", ], "find_phone": [ "find my phone", "where's my phone", "ring my phone", ], "calendar": [ "when is my next meeting", "what's coming up on the calendar tomorrow", ], } def _embed(text): """Return a unit-normalised embedding (list of floats) from the Ollama model.""" r = requests.post(OLLAMA_EMBED_URL, json={"model": INTENT_EMBED_MODEL, "prompt": text}, timeout=10) vec = r.json().get("embedding") if not vec: raise RuntimeError("no embedding returned") norm = (sum(x * x for x in vec)) ** 0.5 or 1.0 return [x / norm for x in vec] def _cosine(a, b): """Cosine of two unit vectors is their dot product.""" return sum(x * y for x, y in zip(a, b)) def score_intents(text): """Best cosine similarity of text to each intent's example utterances.""" q = _embed(text) return {label: max(_cosine(q, _embed(ex)) for ex in examples) for label, examples in INTENTS.items()} if name == "main": if len(sys.argv) < 2: print('Usage: python3 jev_embedding.py "your phrase"') sys.exit(1) phrase = " ".join(sys.argv[1:]) scores = score_intents(phrase) for label, score in sorted(scores.items(), key=lambda kv: kv[1]): print(f"{label}: {score:.2f}")