Verdict4sClient

com.softinio.verdict4s.Verdict4sClient
See theVerdict4sClient companion object
final class Verdict4sClient[F[_]]

A client for the TypeSafe evaluation API.

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.

val client = Verdict4sClient[IO](httpClient, apiKey)

val (urgent, 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."
)

Retries are on by default, matching the official SDKs; see algebra.RetryPolicy to tune or disable them.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def ask[Q <: Tuple, S : Encoder](questions: Ask[Q], state: S): F[Answers[Q]]

Ask a set of questions and get back exactly typed answers.

Ask a set of questions and get back exactly typed answers.

val (urgent, dept, mood) = client.ask(Ask(q1, q2, q3), state)

Attributes

Evaluate a request built by hand.

Evaluate a request built by hand.

The escape hatch: answers come back in the map-based algebra.Evaluation, keyed by whatever question names you chose. Use ask when the questions are known statically.

Attributes

def models: F[List[ModelCard]]

The models available to this account.

The models available to this account.

Attributes

A copy with different settings.

A copy with different settings.

Attributes

A copy drawing retry jitter differently. Mostly useful in tests.

A copy drawing retry jitter differently. Mostly useful in tests.

Attributes

Concrete fields