A client for a decision API: Jev, OpenAI Decisions, or any other Vendor.
Code written against this trait works with every vendor. The questions, Ask and the typed answers are the same whichever one answers them:
def triage[F[_]](
client: Verdict4sClient[F]
): F[(NoulAnswer, ChoiceAnswer[Dept])] =
client.ask(
Ask(
Question.noul("Does this convey urgency?"),
Question.choice[Dept]("Which team should handle this?")
),
"Help! My payouts have been failing for 3 days."
)
triage(Verdict4sClient.jev[IO](httpClient, typesafeKey))
triage(Verdict4sClient.openAI[IO](httpClient, openAIKey))
What only one vendor offers is a separate capability trait, mixed into that vendor's client: ModelCatalog on JevClient, SafetyIdentity on OpenAIClient. Ask for exactly what you use, and the compiler stops a call the chosen vendor cannot serve:
def report[F[_]](using c: Verdict4sClient[F] & ModelCatalog[F]) = c.models
Takes an http4s Client[F] rather than building one. That single decision buys every backend and every platform without this library owning any of them — Ember, Fetch, Blaze, Netty, the JDK client — and it is why the test suite needs no network: Client.fromHttpApp serves routes in memory, so the same tests run on the JVM and on Node.
Retries are on by default, matching the official SDKs; see algebra.RetryPolicy to tune or disable them.
Attributes
- Companion
- object
- Graph
-
- Supertypes
- Known subtypes
-
class JevClient[F]class OpenAIClient[F]