No description
  • Scala 99.8%
  • Nix 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Salar Rahmanian 83a1d5cae5
Name OpenAI Decisions in the social preview (#9)
The subtitle read "Jev by TypeSafe AI", which made the library look
Jev-only now that it supports OpenAI Decisions too. It now reads
"JVM · Scala.js · Jev · OpenAI Decisions", in the same outlined Fredoka
500 at 32px, and still sits inside the 40px safe margin. The PNG is
re-rendered from the SVG with headless Chrome, which reproduces the old
PNG pixel for pixel from the old SVG.

The logo itself is vendor-neutral and is unchanged.
2026-10-18 15:01:44 -07:00
.github Name OpenAI Decisions in the social preview (#9) 2026-10-18 15:01:44 -07:00
docs Simplify the client and core, and fix retry and validation bugs (#7) 2026-10-11 22:44:02 -07:00
scripts Simplify the client and core, and fix retry and validation bugs (#7) 2026-10-11 22:44:02 -07:00
verdict4s Support OpenAI Decisions alongside Jev, behind a Vendor value (#6) 2026-10-11 10:25:36 -07:00
verdict4s-client Simplify the client and core, and fix retry and validation bugs (#7) 2026-10-11 22:44:02 -07:00
verdict4s-core Simplify the client and core, and fix retry and validation bugs (#7) 2026-10-11 22:44:02 -07:00
verdict4s-examples/src Support OpenAI Decisions alongside Jev, behind a Vendor value (#6) 2026-10-11 10:25:36 -07:00
.gitignore Scaffold verdict4s: build, CI, publishing and docs 2026-09-20 13:44:05 -07:00
.mill-version Scaffold verdict4s: build, CI, publishing and docs 2026-09-20 13:44:05 -07:00
.scalafmt.conf Scaffold verdict4s: build, CI, publishing and docs 2026-09-20 13:44:05 -07:00
build.mill Simplify the client and core, and fix retry and validation bugs (#7) 2026-10-11 22:44:02 -07:00
CLAUDE.md Simplify the client and core, and fix retry and validation bugs (#7) 2026-10-11 22:44:02 -07:00
CODE_OF_CONDUCT.md Prepare the v0.1.0 release: Java 17 floor, docs on GitHub Pages, contributing guide (#2) 2026-09-25 19:53:15 -07:00
devshell.toml Prepare the v0.1.0 release: Java 17 floor, docs on GitHub Pages, contributing guide (#2) 2026-09-25 19:53:15 -07:00
flake.lock Scaffold verdict4s: build, CI, publishing and docs 2026-09-20 13:44:05 -07:00
flake.nix Scaffold verdict4s: build, CI, publishing and docs 2026-09-20 13:44:05 -07:00
LICENSE Scaffold verdict4s: build, CI, publishing and docs 2026-09-20 13:44:05 -07:00
README.md Support OpenAI Decisions alongside Jev, behind a Vendor value (#6) 2026-10-11 10:25:36 -07:00

verdict4s

CI Release Documentation Maven Central

A Scala 3 client for typed decision models: TypeSafe AI's Jev and OpenAI Decisions. A decision model answers typed questions about your program state with choices, scores and calibrated probabilities instead of text. The same questions and the same typed answers work with either vendor.

Cross-built for the JVM and Scala.js from one source tree.

enum Dept derives Options:
  case Billing, Technical, Sales

val (urgent, team, mood) = client.ask(
  Ask(
    Question.noul("Does this convey urgency?"),
    Question.choice[Dept]("Which team should handle this?"),
    Question.score("How frustrated?", Seq("Calm", "Frustrated", "Very angry"))
  ),
  "Help! My payouts have been failing for 3 days."
)

urgent is a NoulAnswer, team a ChoiceAnswer[Dept], mood a ScoreAnswer — destructured positionally, at exactly the right types, with no casts and no lookups by string.

client comes from Verdict4s.jev[IO](key) or Verdict4s.openAI[IO](key). Nothing else changes between the two vendors. A feature only one vendor has, such as Jev's model list, is a capability on that vendor's client, so the compiler catches a call the other vendor cannot serve.

Why the types matter

The services enforce real limits: a Choice takes at most 255 options, a Score 2 to 10 ordered levels, probabilities live in the unit interval. Those are carried by the types rather than discovered a network round trip later, and each vendor's own stricter rules are checked before a request is sent.

Probability(0.95)   // fine
Probability(1.5)    // does not compile

Questions are validated before anything is sent, and failures accumulate, so a request with three problems reports all three at once.

Install

Requires Java 17 or later on the JVM. The latest <version> is on the Maven Central badge above.

// Mill
def mvnDeps = Seq(mvn"com.softinio::verdict4s::<version>")

// sbt
libraryDependencies += "com.softinio" %%% "verdict4s" % "<version>"
Module Use it when
verdict4s You want a working client in one line. Brings its own transport.
verdict4s-client You already have an http4s Client[F], or want a specific backend.
verdict4s-core You want the types and codecs only, with no effect system at all.

Documentation

Development

Everything runs inside the Nix devshell. nix develop --command <cmd> works non-interactively; the aliases below assume you are already inside it.

mill __.test                              # all 12 targets: 3 modules x {jvm,js} x {3.3.8,3.9.0}
mill "__.jvm[3.9.0].test"                 # one platform, one Scala version
mill "verdict4s-core.jvm[3.3.8].test"     # one module

fmt / fmtCheck                            # scalafmt
testAll                                   # mill __.test
testJvm17                                 # JVM tests on Java 17, the floor, as CI does
testJvm25                                 # JVM tests on Java 25, as CI does
buildDocs / previewDocs                   # Laika site, or serve on :4242
mill verdict4s-examples.compile           # the ZIO / Future / JDK HttpClient examples

Integration tests run against the real services and are gated on each vendor's API key. Without one they report as ignored, so the suite stays green offline:

TYPESAFE_API_KEY=… mill "verdict4s.jvm[3.3.8].test.testOnly" com.softinio.verdict4s.LiveApiIT
OPENAI_API_KEY=…   mill "verdict4s.jvm[3.3.8].test.testOnly" com.softinio.verdict4s.LiveOpenAIIT

LiveOpenAIIT needs an OpenAI account with credits. Without them, the request schema test still passes, because OpenAI checks a body before it checks credit, but every test that reads an answer fails with "the account has no credits".

mill docs.preview holds Mill's workspace lock while it runs; stop it before building anything else.

Releasing

Versions come from git tags. Pushing a v* tag from main runs the release:

git tag v0.1.0 && git push origin v0.1.0
  1. Release publishes the six artifacts (each module for the JVM and Scala.js, all built by Scala 3.3.8) to Maven Central and creates a GitHub release with generated notes.
  2. Documentation then builds the site from the tag, with that version in its dependency lines, and deploys it to https://verdict4s.softinio.dev. It can be re-run by hand for a tag from the Actions tab.

Run the integration tests above before tagging; they are the only check against the live services.

Structure

verdict4s-core/      effect-free: models, Ask, the Vendor trait, Jev and OpenAI codecs
verdict4s-client/    a client over a caller-supplied http4s Client[F]
verdict4s/           batteries included: Ember on JVM, Fetch on Scala.js
verdict4s-examples/  interop examples, compiled by CI, never published
docs/                Laika narrative site

Contributing

GitHub Issues are disabled to encourage direct community contribution. When you encounter bugs or documentation issues, please contribute fixes through Pull Requests instead.

How to contribute: Open a PR with your solution, draft changes, or a test reproducing the issue. We'll collaborate from there to refine and merge improvements.

This approach creates faster fixes while building a stronger, community-driven project where everyone benefits from shared contributions.

Everyone taking part is expected to follow the Code of Conduct.

License

Apache-2.0. See LICENSE.