JevClient

org.llm4s.jev.JevClient
See theJevClient companion object
final class JevClient extends AutoCloseable

A client for TypeSafe's Jev decision model (https://docs.typesafe.ai/api.md).

Jev is not a chat model. It takes a state and named, typed JevQuestions and answers each with a typed JevAnswer: the probability of a yes, the selected option with a distribution, a score along ordered levels. So this client is not an LLMClient and returns no Completion; it has no streaming and no conversation.

val decision = for
 config   <- JevConfigLoader.default()
 client   <- JevClient(config)
 response <- client.evaluate(JevRequest("Charged twice; please refund", Map("urgent" -> JevQuestion.noul("Is this urgent?"))))
 urgent   <- response.noul("urgent")
yield urgent.probability

evaluate is blocking and returns every failure as a org.llm4s.types.Result: an invalid request is a ValidationError before anything is sent, a rejected key an AuthenticationError, a rate limit a RateLimitError carrying the delay the server asked for, an outage a ServiceError, a transport failure a NetworkError or TimeoutError, a response that does not match the API a ProcessingError, and an interrupt a CancelledError. Transient failures are retried as the config's JevRetryPolicy says. The API key is never printed or logged, and is masked in an error wherever the server echoed it verbatim, JSON-escaped or URL-encoded (a partial echo of the key is not recognised).

'''No idempotency key.''' TypeSafe's documentation describes no idempotency key or other de-duplication mechanism, so this client does not invent one: each attempt of a retried request is a new, billable call. A header the caller attaches with JevRequest#withHeader is sent unchanged on every attempt.

The client is thread-safe. close releases the HTTP connections it owns.

Attributes

Companion
object
Graph
Supertypes
trait AutoCloseable
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def close(): Unit

Releases the HTTP connections this client owns; a client built over an HTTP client you passed leaves it open.

Releases the HTTP connections this client owns; a client built over an HTTP client you passed leaves it open.

Attributes

Definition Classes
AutoCloseable

Asks request's questions about its state.

Asks request's questions about its state.

Attributes

Returns

the answers, or the error described on JevClient