zio-typesafe-ai
Scala 3 / ZIO client for System One, typed end to end, asking several questions per round trip and returning a NamedTuple of answers.
Overview
zio-typesafe-ai is an Apache-2.0 Scala 3 library for TypeSafe's Jev and System One API, built on ZIO HTTP's Client. It is typed end to end with no raw JSON or string lookups: several questions go in one round trip as a NamedTuple, and the typed answer comes back keyed and shaped like the questions. Illegal states are unrepresentable, since Choice and Score criteria cannot be built out of range (1 to 255 options, 2 to 10 levels) and every probability is a type provably within 0 to 1.
The client reads the same environment variables as the official SDKs or can be configured explicitly. Composable middleware, using the same operators as ZIO HTTP, adds logging, retries, metrics, tracing or policy checks; for example, a middleware can retry on rate-limit errors. Documentation is on javadocs.dev.
What the decision model decides
| Type | Question | Answers |
|---|---|---|
| Yes / no | Yes/no question about the state | yes · no |
| Choice | Choice with 1 to 255 options | — |
| Score | Score with 2 to 10 levels | — |
How it works
- Add the library and provide TypeSafeAI.Client.live.
- Ask a NamedTuple of questions.
- Receive a NamedTuple of typed answers.
- Add middleware for retries, logging or metrics.
Strengths
- Compile-time guarantees on criteria and probabilities.
- Multiple questions per round trip.
- Composable middleware.
Caveats
- Scala 3 and ZIO only.
- Requires a TypeSafe key.
Getting started
libraryDependencies += "com.jamesward" %% "zio-typesafe-ai" % "<version>"At a glance
- Type
- Library
- Status
- beta
- Language
- Scala
- Runtime
- ZIO library
- Has code
- yes
- License
- Apache-2.0
Use cases and integrations
How curated lists describe it
Scala ecosystem: ZIO client for TypeSafe AI with a typed DSL over Jev decisions.
yibie/awesome-jevCommunity ZIO client with a small DSL for noul / choice / score.
AnotiaWang/awesome-decision-modelsA Scala 3 / ZIO client that asks typed Noul, Choice, and Score questions in one round-trip and returns a NamedTuple of answers.
logicrw/awesome-jev-projectsScala 3 / ZIO client for the System One API: typed end-to-end, several questions per round-trip via NamedTuple.
hellogumbo/awesome-jev
Frequently asked questions
How are multiple questions handled?
As a NamedTuple in one round trip, with answers in the same shape.
Can criteria be invalid?
No, out-of-range criteria cannot be constructed.
Can I add retries?
Yes, with composable middleware.
Related projects
Hack Club's lightweight LLM proxy, listed for adding a Jev forwarding endpoint behind its auth, limits and usage logging.
MCP serverproductionTypeScriptAx, a DSPy-style multi-language LLM framework, listed with a native TypeSafe provider for Boolean, Choice, Score and raw Jev questions.
PluginproductionTypeScriptEffect TypeScript library whose @effect/ai-typesafe package maps classify, probability and rating operations to Jev questions.
ProjectproductionTypeScriptPHP monorepo whose Polyglot module adds a TypeSafe driver for typed Noul, Choice and Score decisions alongside LLM inference.
ProjectproductionPHPGo MCP server giving any client typed Jev decisions via OpenRouter or TypeSafe, with validated answers and no paid retries.
MCP serverproductionGoSimon Willison's LLM plugin that adds Jev as a model for yes/no, choice and score questions from the command line.
PluginproductionPython