TypeSafe System One classification over OpenAI-like clients, with confidence.
Project details
Jevper offers a unique classification wrapper that extracts the essence of questions, providing probabilistic and confidence-driven answers with an easy integration to any OpenAI-compatible model. It enhances user interactions with hosted or self-hosted LLMs, while remaining independent of TypeSafe APIs, streamlining how messages are understood and categorized.
Jevper offers a robust and type-safe classification wrapper built for OpenAI-compatible models, uniquely providing probabilistic outputs and confidence scores instead of mere text responses. This library serves as an interface between Python programs and hosted language models, enabling queries that yield structured answers while preserving the power of LLMs.
state with typed output responses such as noul, choice, and score, which include clear probabilities and confidence levels.jevper operates independently from the hosted TypeSafe API and can interface seamlessly with any model exposing the required methods, including self-hosted models like llama.cpp.Here’s a brief demonstration of how to use jevper with an OpenAI model:
from openai import OpenAI
from jevper import Choice, SystemOneClient
client = SystemOneClient(OpenAI(), model="gpt-5.6-terra", method="logprobs")
response = client.system_one(
state="I was charged twice for the same subscription this month.",
questions={
"intent": Choice(
instructions="Pick the intent of the message.",
criteria={
"billing": "money, invoices, refunds, charges",
"technical": "errors, crashes, login or performance problems",
"sales": "pricing, plans, purchasing, upgrades",
},
)
},
)
answer = response.answers["intent"]
print(answer.choice) # Outputs: "billing"
print(answer.probabilities) # Outputs: {"billing": 0.88, "technical": 0.08, "sales": 0.03}
print(answer.confidence) # Outputs: 0.83
jevper supports three classification types that correspond to the Jev API:
The library features various methods for decision-making, including:
auto: Automatically decides the best method between logprobs and structured JSON based on provider capabilities.logprobs: Fetches probability distributions over labels for nuanced response generation.grammar: Allows for GBNF grammar structures in requesting data from the provider.jevper includes comprehensive testing features, ensuring functionality against local stub servers and easy verification of responses. The codebase is maintained with strict testing protocols, ensuring reliability in production environments.
Further documentation is available, covering API specifications, method details, reasoning configurations, and examples. More insights can be found in the API Docs, Methods Guide, and other relevant sections of the repository.
Comments
0Start the conversation
Share the first comment.