hn.today

Show HN: Jevlang: Python with a Smart "If"

github.com3 points1 comments
Screenshot of Show HN: Jevlang: Python with a Smart "If"

Jevlang extends Python with a single operator (~) and a jev/case block to let code ask a hosted classifier questions and get back numbers or labels instead of free text. It rewrites .jev files to plain Python at import time, installs an import hook, and returns results as floats or string-like objects that carry .probs, .confidence and .raw. Typical use is decision workflows such as routing support tickets: msg ~ "the customer wants a refund" yields a probability used in an if, and a jev ... case block asks a single multinomial question and dispatches to guarded branches. ask_all batches multiple questions about one value in one API call. A show mode prints the rewritten Python without making API calls.

Answers are typed: a string question gives a probability; a list defines a scale; a dict defines labeled choices. Developers can threshold, rank, or guard branches with confidence, and non-string inputs (dataclasses, pydantic models, JSON) are supported. Every ~ is a paid network call to TypeSafe’s Jev and needs an API key; there’s no built-in caching, retry, or async handling and accuracy is unmeasured. The implementation keeps logic inside ordinary functions and debuggable code, but warns to avoid sending secrets and to guard consequential branches; the project is a tested prototype.

Read on github.com1 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.