Python · typesafe-sdk
Use the official typesafe-sdk Python package against EasyJev: pip install, TypeSafeClient with your sk- key and our base_url, Noul/choice/score questions, error mapping and request_id tracing.
Install
pip install typesafe-sdkCreate the client
from typesafe_sdk import TypeSafeClient client = TypeSafeClient( api_key="sk-your-key", # EasyJev console -> API Keys base_url="https://api.easyjev.online", # the only other edit )
Both values can also come from environment variables: TYPESAFE_API_KEY and TYPESAFE_BASE_URL.
The three question types
Noul (yes/no) — returns a calibrated probability of “yes” in [0, 1]. Best for gates: is this a refund request? is this spam?
from typesafe_sdk import Noul result = client.system_one( state="User asks: can I get a refund for order #1024?", questions={"refund": Noul(instructions="Is this a refund request?")}, ) print(result.nouls["refund"].noul) # probability of "yes", e.g. 0.97
Choice (single pick) — pick one named candidate from up to 255 options with per-candidate probabilities. Ideal for routing and classification.
from typesafe_sdk import Choice result = client.system_one( state="Ticket: my order #1024 arrived damaged", questions={ "route": Choice( instructions="Pick the team that should handle this ticket", criteria={ "billing": "Refunds, charges, payment issues", "support": "Order status, delivery, damaged items", "sales": "Pre-sale questions, quotes", }, ) }, ) print(result.choices["route"].choice) # e.g. "support"
Score (ordinal) — score against 2–10 ordered levels and get a value that interpolates between them. Ideal for severity and quality rubrics.
from typesafe_sdk import Score result = client.system_one( state="Comment: this product changed my life, best purchase ever!!", questions={ "severity": Score( instructions="Rate how urgent moderation is", criteria=["benign", "minor", "review", "block"], ) }, ) print(result.scores["severity"].score) # e.g. 0.25 (between benign and minor)
Error handling
The SDK raises its official exception classes unchanged; EasyJev maps every gateway error onto the same class hierarchy you would see against the official API. Every response also carries request_id (header X-Request-Id) — include it when contacting support.
from typesafe_sdk import errors try: result = client.system_one( state="...", questions={"q": {"type": "noul", "instructions": "..."}}, model="typesafe/jev-latest", ) except errors.AuthenticationError: ... # 401/403: wrong or disabled sk- key except errors.RateLimitError: ... # 429: RPM/TPM limit hit, back off and retry except errors.APIError as e: ... # other gateway errors; e carries the unified error body