Skip to content

Repository files navigation

jev-ql

Query unstructured data with calibrated semantic SQL and cognitive syntax.

npm install jev-ql

Quick start

import jevql from 'jev-ql';

const rows = await jevql`
  from ${tickets}
  where status is open
  ask "immediate production outage?" as is_outage > 0.7
  tag as billing, security, infrastructure
  top 10 by is_outage
`;

jevql compiles natural language and SQL queries with single-pass semantic primitives and relational pushdown filtering. That's the whole API.

Cognitive syntax

tickets: status = open
? "immediate outage?" > 0.7
team = security | infrastructure | billing
severity = minor .. moderate .. critical
top 5

Minimal syntax designed for human working memory with pattern guards and zero LLM prompt escaping.

Group by semantic choice

const breakdown = await jevql(`
  SELECT
    CHOICE(body, 'Category', ['bug', 'feature', 'billing']) AS category,
    COUNT(*) AS count,
    AVG(SCORE(body, 'Frustration', ['calm', 'annoyed', 'furious'])) AS avg_frustration
  FROM 'tickets.json'
  GROUP BY category
  ORDER BY count DESC
`);

Aggregates unstructured text across categorical distributions in a single pass.

Relational pushdown

const plan = await db.explain(`
  SELECT id FROM tickets
  WHERE status = 'open'
    AND priority = 'P1'
    AND NOUL(text, 'Security exploit?') > 0.85
`);

Deterministic SQL filters execute first, pruning non-matching rows ($0 cost) before calling the AI engine.

Confidence gating

const safeActions = await jevql(`
  SELECT customer,
         CHOICE(body, 'Action', ['refund', 'rebook', 'triage']) AS action,
         CONFIDENCE(CHOICE(body, 'Action', ['refund', 'rebook', 'triage'])) AS conf,
         PROB(CHOICE(body, 'Action', ['refund', 'rebook', 'triage']), 'refund') AS refund_prob
  FROM data
  WHERE CONFIDENCE(CHOICE(body, 'Action', ['refund', 'rebook', 'triage'])) > 0.8
`, tickets);

CONFIDENCE() measures distribution peakedness for escalation policies. PROB() extracts calibrated probability floats for individual outcomes.

Python SDK

from jevql import JevQLDatabase

db = JevQLDatabase(tickets)
results = db.query("""
  tickets: status = open
  ? "urgent security breach?" > 0.8
  team = security | tech
  top 5
""")

Zero-dependency Python implementation mirroring identical AST planning and pushdown semantics.

CLI

jevql script.jevql                 # Run query directly
jevql                              # Interactive REPL shell (Tab auto-completion)
jevql -f tickets.json -q "from data where status is open top 5"

Demo

npm run demo
npm test
npm run playground

Runs the multi-mode demonstration, executes unit tests, and launches the interactive workbench at http://localhost:3456.

Related

License

MIT © Hemanth.HM

About

PostgreSQL-compatible query language powered by TypeSafe Jev System One models

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages