Expand description
§jev-sdk
A Rust client for the TypeSafe AI System One API.
Jev is a System One model: instead of generating text, it evaluates typed questions against a state and returns structured decisions with calibrated probabilities and confidence — fast enough to sit inside ordinary code paths.
§Quick start
use jev_sdk::{Choice, Noul, Question, Score, TypeSafeClient};
// Reads TYPESAFE_API_KEY from the environment.
let client = TypeSafeClient::from_env()?;
let ticket = "Hi, I've been trying to connect my Stripe account for 3 days \
and it keeps failing. I'm losing sales. Please help ASAP.";
let response = client
.system_one(
ticket,
[
(
"department",
Question::from(Choice::new(
"Which team should handle this",
[
("billing", Some("Payment or subscription issues")),
("technical", Some("Bugs or integration problems")),
("sales", Some("Pricing or account questions")),
],
)),
),
(
"frustration",
Question::from(Score::new(
"How frustrated the customer appears",
["Calm, just stating facts", "Frustrated but civil", "Very angry"],
)),
),
(
"is_urgent",
Question::from(Noul::new("The message conveys urgency or time-sensitivity")),
),
],
)
.await?;
let department = response.choice("department").unwrap();
println!("route to {} (confidence {:.2})", department.choice, department.confidence);
println!("frustration: {:.2}", response.score("frustration").unwrap().score);
println!("urgent: {:.3}", response.noul("is_urgent").unwrap().noul);§Configuration
| Setting | Environment variable | Default |
|---|---|---|
| API key | TYPESAFE_API_KEY | — (required) |
| Model | TYPESAFE_DEFAULT_MODEL | jev-latest |
| Base URL | TYPESAFE_BASE_URL | https://api.typesafe.ai |
Use TypeSafeClient::builder for timeouts, retry policy, extra headers,
or a custom reqwest client. See RetryPolicy for retry behavior
(transient 429/529 responses are retried with exponential backoff by
default).
Structs§
- ApiError
- An unsuccessful HTTP response from the TypeSafe API.
- Choice
- Pick one option from a defined set.
- Choice
Answer - Answer to a choice question.
- Client
Builder - Builds
TypeSafeClients. - List
Models Response - The response to
list_models. - Model
Card - A model available to the account.
- Noul
- A yes/no question. The answer is the probability that the answer is “yes”.
- Noul
Answer - Answer to a noul question: the probability that the answer is “yes”.
- Noul
Criteria - Optional descriptions of the two outcomes of a
Noulquestion. - Retry
Policy - Controls how failed requests are retried.
- Score
- Rate the state along an ordered rubric.
- Score
Answer - Answer to a score question.
- System
OneResponse - The response to a
system_oneevaluation. - Type
Safe Client - An asynchronous client for the TypeSafe AI System One API.
- Usage
- Token usage for a request.
Enums§
- Answer
- One typed answer. The variant matches the type of the question asked.
- Error
- Errors returned by this SDK.
- Question
- A typed question to evaluate against the state.
Constants§
- DEFAULT_
BASE_ URL - Default API root.
- DEFAULT_
MODEL - Default model used when none is configured.
- DEFAULT_
TIMEOUT - Default request timeout.
- ENV_
API_ KEY - Environment variable for the API key.
- ENV_
BASE_ URL - Environment variable for the API root.
- ENV_
DEFAULT_ MODEL - Environment variable for the default model.
Traits§
- Into
Content - Any content that can be sent as part of a question: a plain string or arbitrary JSON structure.
- Into
Description - An optional description for a
Choiceoption.