Skip to content

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.

LibrarybetaApache-2.0

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

TypeQuestionAnswers
Yes / noYes/no question about the stateyes · no
ChoiceChoice with 1 to 255 options—
ScoreScore with 2 to 10 levels—

How it works

  1. Add the library and provide TypeSafeAI.Client.live.
  2. Ask a NamedTuple of questions.
  3. Receive a NamedTuple of typed answers.
  4. 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

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 serverproductionTypeScript
  • Ax, a DSPy-style multi-language LLM framework, listed with a native TypeSafe provider for Boolean, Choice, Score and raw Jev questions.

    PluginproductionTypeScript
  • Effect TypeScript library whose @effect/ai-typesafe package maps classify, probability and rating operations to Jev questions.

    ProjectproductionTypeScript
  • PHP monorepo whose Polyglot module adds a TypeSafe driver for typed Noul, Choice and Score decisions alongside LLM inference.

    ProjectproductionPHP
  • Go MCP server giving any client typed Jev decisions via OpenRouter or TypeSafe, with validated answers and no paid retries.

    MCP serverproductionGo
  • Simon Willison's LLM plugin that adds Jev as a model for yes/no, choice and score questions from the command line.

    PluginproductionPython