TypeSafe AI Provider connects the AI module to TypeSafe AI System One models, starting with Jev.
Jev is not a large language model. It does not generate text. You give it state (text or JSON) and a set of typed questions, and it returns typed answers with calibrated probabilities. Your code owns the workflow; the model supplies the judgment. This makes it a good fit for routing, classification, ranking, verification and guardrails, where you want a decision your code can act on rather than prose you have to parse.
Question types
- Noul: whether a condition holds. Returns the probability of "yes".
- Choice: which of a defined set of options fits. Returns the chosen option, a probability per option and a confidence value.
- Score: where on an ordered scale something sits. Returns a probability-weighted level, a probability per level and a confidence value.
All independent questions about the same state are sent in one request and answered in parallel.
What the module provides
- A Decision operation type for the AI module, with
DecisionInput,
DecisionResponseand typed question and answer value objects. Any provider can implement it. - A TypeSafe AI provider (
typesafeai) with automatic model discovery, retries with backoff, and errors mapped to the AI module's exceptions. - Text classification support: the labels you pass become a choice question and the probabilities become confidence scores.
- Moderation support: each configured policy category is asked as a yes/no question and content is flagged at a threshold you set. Jev can gate other providers' chat requests through the AI module's external moderation settings.
- A Decision Explorer page for the AI API Explorer, to try state and questions in the browser and copy the equivalent PHP.
- An automators submodule with field automators for boolean, list and numeric fields that ask a typed question instead of parsing JSON out of a chat reply.
Example
use Drupal\ai_provider_typesafeai\OperationType\Decision\DecisionInput; use Drupal\ai_provider_typesafeai\TypeSafeAi\ChoiceQuestion; use Drupal\ai_provider_typesafeai\TypeSafeAi\NoulQuestion; use Drupal\ai_provider_typesafeai\TypeSafeAi\ScoreQuestion; $provider = \Drupal::service('ai.provider')->createInstance('typesafeai'); $input = new DecisionInput( ['ticket' => ['subject' => 'Charged twice', 'message' => $message]], [ 'refund_requested' => new NoulQuestion('Is the customer asking for money back in `ticket.message`?'), 'team' => new ChoiceQuestion('Which team should handle `ticket`?', [ 'billing' => 'Charges, invoices, refunds or subscriptions', 'technical' => 'Bugs, errors or integration problems', 'sales' => 'Pricing, plans or account questions', ]), 'frustration' => new ScoreQuestion('How frustrated does the customer appear?', [ 'Calm and matter-of-fact', 'Frustrated but civil', 'Very angry or threatening to leave', ]), ], ); 'frustration' => new ScoreQuestion('How frustrated does the customer appear?', [ 'Calm and matter-of-fact', 'Frustrated but civil', 'Very angry or threatening to leave', ]), ], ); $response = $provider->decision($input, 'jev-latest', ['my_module'])->getNormalized(); if ($response->getNoul('refund_requested')->isLikely(0.7)) { // Open a refund case. } $team = $response->getChoice('team'); if ($team->isConfident(0.8)) { // Route to $team->getChoice(); otherwise send to a person. } $level = $response->getScore('frustration')->getMostLikelyLevel();
Thresholds stay in your code. Answers carry the raw probabilities, so policy can change without another request.
Requirements
- Drupal 10.5 or 11.2 and later.
- AI 1.4 or later.
- Key, to store the API key.
- A TypeSafe AI account and API key.
Installation and configuration
- Install with Composer:
composer require drupal/ai_provider_typesafeai, then enable the module. - Create a Key holding your TypeSafe API key at Configuration » System » Keys.
- Select the key at Configuration » AI » Provider settings » TypeSafe AI. The form validates the key against the API and sets Jev as the default for the Decision, Text classification and Moderation operation types where no default exists.
- Optionally enable AI API Explorer to use the Decision Explorer, and TypeSafe AI Decision Automators to use the field automators (requires AI Automators).
Documentation
- The module README covers each operation type, the automators and the moderation gate.
- TypeSafe AI documentation covers question design, confidence and patterns such as routing, reranking and guardrails.
Notes
- Model aliases such as
jev-latestmove when a new release ships. Pin a version id if your thresholds must stay stable. - Each moderation category costs one question per call. Trim the default category list if cost matters.
- Do not configure the TypeSafe provider to moderate its own requests; the AI module's moderation gate would recurse.
Contact us
Contact Skvare for AI integration with your CMS or CiviCRM systems.
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
More in the AI ecosystem
Most installed first
Activity
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 1.0.x-dev | Dev | 10–11 | Sep 17, 2026 |