Migrating from Jev
Use this checklist before switching traffic:
- Set
TYPESAFE_BASE_URLto your Jein origin andTYPESAFE_API_KEYto a Jein API key. Keep your existingsystemOneorsystem_onecall. - Use
jev-latest(the SDK default),jev-preview,jev-1.13.0, orlaya-latestfor language routing. English resolves tolaya-0.3.20; detected non-English resolves tolaya-multilingual-0.3.20. To select a checkpoint explicitly uselaya-0.3.20,laya-multilingual, orlaya-multilingual-0.3.20. See models. - Measure every question's state room. English has a 512-token sequence; the exact room is
511 − len(head + options sequence)for that question. Simple choice and noul questions leave about 476 state tokens. Multilingual has a 2048-token window and about 1975–2014 state tokens of room. Longer instructions and options reduce either limit. - Split long state into smaller, self-contained chunks and send only the relevant chunk per call. Jein rejects state that would truncate; it never silently cuts it.
- Keep each call at or below 32 questions and the selected model's processed-token cap: 3,500 English or 6,000 multilingual. The processed cost is
number of questions × longest per-question Laya sequence length, so many questions with long states hit the cap sooner. A 32-question call can exceed the SDK's 10-second default timeout on a busy CPU worker; prefer smaller batches. - Handle 402 monthly free allowance exhaustion by checking
/app/usageand waiting for the UTC reset, or email [email protected]. Jev does not have this response. - Handle 429 account rate/in-flight limits and 529 worker busy/startup with
Retry-Afterandretry-after-ms; branch onx-jein-error-code. The SDK retries these by default, so set an overall deadline. - Compare outputs: Jein answers carry no Jev
actionobject (action.act_probability), and noul answers carry noconfidence; readnouldirectly. Multilingual confidence is uncalibrated, and its English quality was lower in a 12-case check. The two checkpoints use different tokenizers, so token counts and state limits differ. The model card evaluates about 50 languages; its “100+” claim is unverified. - Pin SDK versions while migrating: Python
typesafe-sdk==0.7.1; JavaScript@typesafe-ai/[email protected]. Roll back by restoring the previous Jev base URL and Jev key; keep keys separate.
GET /v1/models lists every name a request may use, including the jev-latest (SDK default), jev-preview, and jev-1.13.0 compatibility aliases, so a client can validate against it. Existing SDK calls and the /v1/systemone route are unchanged.
To check a state before switching, paste it into the Sandbox for a token count, or send the request: if the state does not fit, the state_too_long error tells you the room each question leaves.
Try the migrated request locally:
curl --fail --silent "$TYPESAFE_BASE_URL/v1/systemone" -H "Authorization: Bearer $TYPESAFE_API_KEY" -H 'Content-Type: application/json' -d '{"model":"jev-latest","state":"Hi, I was billed twice for March. Please refund the duplicate.","questions":{"department":{"type":"choice","instructions":"Which team should handle this?","criteria":{"billing":"Payment issues","technical":"Bugs","sales":"Sales questions"}}}}' | python3 -c 'import json,sys; r=json.load(sys.stdin); assert r["model"] == "laya-multilingual-0.3.20" and "department" in r["answers"]'