Skip to Content
ModelsJev (TypeSafe)Project integration

Project integration

Two integration methods are available: a coding assistant integrates Jev into the project according to the requirements, or, in a project that already contains TypeSafe code, only two environment variables are changed.

Integration through a coding assistant

When using a coding assistant such as Claude Code, Cursor, or Codex, copy the prompt below and replace the content in < > with the actual requirements; the coding assistant then completes the integration in the project.

Add Jev to my project

After copying, replace the content in < > in step 2 with the actual decision requirements.

I want to add OfoxAI's Jev decision model to this project. I have already created an API key in the OfoxAI console. Please walk me through it step by step. Before each step, tell me what you are doing and what comes next.

[Step 1: store the key safely]
1. Create a .env file in the project containing one line: OFOX_API_KEY= (leave the value empty), and add .env to .gitignore.
2. Tell me where the file is, so I can paste the key into it myself and save it. Do not ask me to send the key in this chat, and do not write the key into code or print it.
3. Wait until I tell you "done" before continuing.

[Step 2: the decisions I need]
- Content to evaluate: <e.g. the text of customer support tickets submitted by users>
- Questions to answer: <e.g. which team should get it (billing and refunds / technical issues / pre-sales questions); whether it is urgent>
- What to do with the result: <e.g. assign automatically when confidence is high enough, otherwise route to a human>

[Step 3: write the code]
4. Use the official OpenAI SDK (run pip install -U openai first; older versions do not have client.decisions) with base_url https://api.ofox.ai/v1, read the key from OFOX_API_KEY in .env, call client.decisions.create(), and use the model typesafe/jev-latest.
5. Choose question types based on my requirements: predicate for yes or no; choice for picking one of several options; score for degree. Put all questions in the questions array of a single request, and give every question a name.
6. The options for choice must cover every case and include a "none of the above" option; write a description for every option.
7. Read results by name. Use confidence for choice and score, and probability for predicate, to decide whether to act automatically. Start with a threshold of 0.7 and make it a config setting so it can be adjusted later. Anything below the threshold goes to a human or a fallback flow.
8. Treat https://ofox.ai/docs/api/decisions as the reference for fields and errors, and https://ofox.ai/docs/develop/models/jev for usage.

[Step 4: test]
9. Run 3 clear-cut samples and 2 ambiguous samples once each, and show me the answer, probability, and confidence for each.
10. When something fails, print the HTTP status, error.message, and request_id, check the error table in the docs, and change only one thing before trying again. If the same error survives two fixes, stop and give me the exact error message and the request_id.

Migrating from TypeSafe

Projects that already use the official TypeSafe SDK, or whose code was written according to the official TypeSafe documentation, need only change the base URL to https://api.ofox.ai/typesafe and replace the API key with an OfoxAI key:

Terminal
export TYPESAFE_BASE_URL="https://api.ofox.ai/typesafe" export TYPESAFE_API_KEY="$OFOX_API_KEY"

Requests are sent to /typesafe/v1/systemone in the same format as the official TypeSafe API (state and questions keyed by question ID; the yes/no question type is noul). For a comparison of the two formats and SDK examples, see Decisions API · TypeSafe native format. New projects are recommended to use /v1/decisions directly.

Last updated on