TypeSafe AI can be tested in Playground first, then integrated via API or official SDK. The shortest process is: log in to the console to get the API Key, put the content to be checked into the state, select jev-latest, and then define Noul, Choice, or Score in the questions. Keep the key in the server environment variable; do not write it into web code or submit it to the repository.
First, use Playground to verify how the question is written
Paste a customer service message as a state, then add a "Is it urgent?" Noul question. Then add a department choice and sentiment score to observe probability distribution. If the results are unstable, first clarify the instructions and criteria, rather than immediately piling up more background.
Which fields are needed for API requests
{ "state": "付款连续失败三天,请尽快处理", "model": "jev-latest", "questions": { "department": { "type": "choice", "instructions": "应由哪个团队处理?", "criteria": { "billing": "支付、账单或退款", "technical": "故障、接口或集成" } }, "is_urgent": { "type": "noul", "instructions": "消息是否明确表达紧急性?" } } }Requests are sent to POST /v1/systemone and authenticated with Bearer Tokens. Responses use the question ID, such as reading answers.department.choice and candidate probabilities. Production environments should also record the actual model version in the response to facilitate troubleshooting after upgrades.
How to choose between Python and JavaScript
The Python SDK requires Python 3.10 or above and can install typesafe-sdk; JavaScript can use the official typesafe-ai/sdk. Both read keys from TYPESAFE_API_KEY environment variables and call jev-latest by default. If you already have a backend framework, you can choose the language your team currently uses, without needing to switch to a separate TypeSafe tech stack.
The first access should not be executed automatically
- A set of real desensitization samples including normal, fuzzy, and extreme conditions was prepared.
- Each question only determines one thing, leaving the calculation of amount and date comparison to the code.
- First, record results and confidence, without triggering real business actions.
- Adjust the criteria based on the misjudged sample, then set automatic pass and manual verification thresholds.
- Fixed model versions for regression testing, validated before switching to new aliases.
If encountering 401, prioritize checking the key and Authorization header; If encountering 429, avoid based on the retry time in the response. Retrying a failed request infinitely immediately will only make rate limiting last longer.