Package xyz.tcheeric.jev
package xyz.tcheeric.jev
A Java client for TypeSafe's Jev evaluator.
Jev answers typed questions about a piece of text, the state, with calibrated
probabilities. Build the questions from the three Question types, send
them in one call with JevClient.evaluate(String, java.util.List), and read each
typed Answer back from the returned
Evaluation by the name you gave its question.
try (JevClient jev = new JevClient(JevConfig.of(apiKey))) {
Evaluation result = jev.evaluate("Help! My payouts have been failing for 3 days.",
new Question.Noul("is_urgent", "Does this convey urgency?"),
new Question.Choice("department", "Which team should handle this?",
List.of("billing", "technical", "sales")));
double urgent = result.noul("is_urgent").probability();
String team = result.choice("department").chosen();
}
The library returns full probability distributions and applies no threshold. Deciding what
an answer means for your application stays in your code. Failures are unchecked
JevExceptions carrying an operation and a failure type, and a
JevApiException when the API itself refused the request.
The user guide, the wire format and the security notes are in the project repository.
-
ClassDescriptionAn answer from the evaluator, typed to match the question that produced it.A rating against the question's ordered levels.The answers to one fan-out of questions, keyed by the names the caller gave them, together with what the evaluation cost.An error the API itself reported, carrying the HTTP status and what the API said, so a caller can tell a rejected token from a rejected question without reading prose.The one entry point into the evaluator.Everything the client needs that is not a question: where the evaluator lives, which model answers, how long to wait, and how hard to retry.Every failure this library raises, unchecked, carrying the operation that failed and the kind of failure so a caller can branch on the kind without parsing a message.The single seam between this library's records and the evaluator's HTTP surface: paths, JSON field names and the headers that carry meaning.One entry of the evaluator's model list, as
GET /v1/modelsreports it.A question put to the evaluator about a state.Pick one of a fixed set of options.Is this true.Rate the state against an ordered rubric.How hard, and how politely, to retry.What the evaluator reports it spent answering.