Type Safe
Back to integrations
Community exampleNeeds reviewAvailable2026-09-28

Jev with Spring AI

A static Java boundary pattern for consuming an already validated Jev decision beside a Spring AI application without claiming native provider support.

Prerequisites

  • A Java 17 or newer application
  • A separately obtained and validated Jev decision
  • A calibrated confidence threshold
  • A human-review handler

Implementation steps

  1. 1Receive an already validated Jev decision through an application boundary.
  2. 2Verify a non-null choice and confidence, and check the threshold range before invoking the policy.
  3. 3Apply the pure Java decision policy.
  4. 4Send low-confidence outcomes to human review.
  5. 5Pass accepted actions into the surrounding Spring AI workflow.
  6. 6Keep provider-specific transport outside this example.
Server example
public record JevDecision(String choice, double confidence) {}

public enum RouteAction { ACCEPT, HUMAN_REVIEW }

public final class JevDecisionPolicy {
    private JevDecisionPolicy() {}

    public static RouteAction route(JevDecision decision, double threshold) {
        if (decision == null) {
            throw new IllegalArgumentException("decision is required");
        }
        if (decision.choice() == null || decision.choice().isBlank()) {
            throw new IllegalArgumentException("choice is required");
        }
        if (!Double.isFinite(decision.confidence()) ||
            decision.confidence() < 0.0 || decision.confidence() > 1.0) {
            throw new IllegalArgumentException("confidence must be between 0 and 1");
        }
        if (!Double.isFinite(threshold) || threshold < 0.0 || threshold > 1.0) {
            throw new IllegalArgumentException("threshold must be between 0 and 1");
        }
        return decision.confidence() < threshold
            ? RouteAction.HUMAN_REVIEW
            : RouteAction.ACCEPT;
    }
}

Production checks

  • Spring AI OpenAI-compatible configuration does not imply TypeSafe compatibility.
  • Keep TypeSafe transport in a dedicated adapter if one is implemented later.
  • Validate decisions, make downstream actions idempotent, and retain an audit trail.
  • Pin Java and Spring AI versions and verify behavior before release.
  • Do not log sensitive inputs or decision payloads.

Limitations and verification notes

Spring AI documents OpenAI-compatible chat configuration, while TypeSafe System One uses its own decision API. No native TypeSafe provider is documented for Spring AI, so this page is an application-boundary pattern, not a drop-in provider integration.

Sources

This guide is independently maintained by Type Safe. Check the provider’s current documentation, versions, and terms before use.