Jev

Overview

The Jev connector enables your AI Colleagues to integrate with TypeSafe's Jev model, facilitating structured decision-making such as yes/no checks, classification, routing and scoring within automated workflows.

Jev is TypeSafe's evaluation model, designed to assess content against typed questions and return structured answers with probabilities and confidence scores, rather than free-form text. The Jev connector allows Leena AI to make fast, consistent judgments — for example, whether a request is urgent, which team should handle it, or how frustrated an employee is — that AI Colleagues can act on directly.

API Details

Leena AI integrates with Jev via REST APIs.

Documentation link: https://docs.typesafe.ai/api

Setup

The Jev connector uses API Key authentication.

Prerequisites

Before setting up the Jev connector, ensure you have:

  • A TypeSafe account (or use Leena AI's built-in authentication)
  • Access to the TypeSafe Console for API key generation (optional)
  • Understanding of the question types supported by Jev (Noul, Choice and Score)
  • Access to your Leena AI workspace with connector management permissions

Get credentials

Here is how to create an API key in the TypeSafe Console:

  1. Sign in to TypeSafe: Log in to your account at TypeSafe Console
  2. Navigate to API Keys section: Open the API keys page in the console
  3. Create New API Key:
    • Create a new API key
    • Name your key: Use a descriptive name like "Leena AI Integration" or "Production Backend"
  4. Save and Note Credentials:
    • Copy your API key immediately
    • Store the key securely
🚧

Critical Security Notice: Store your API key securely and don't share it. If your key is lost or exposed, create a new one in the TypeSafe Console and update the connection in Leena AI.

Add connection

Here is how to add a connection on Leena AI:

  1. Log in to your Leena AI workspace
  2. Navigate to Settings > Integrations
  3. Search for "Jev" and select it from the list to add its new connector
  4. Start configuring the connector:

Model: Choose from available Jev models:

  • jev-latest: Always uses TypeSafe's current production Jev model (default, recommended)
  • jev-preview: TypeSafe's preview model, for testing upcoming changes before they reach jev-latest
  • jev-1.13.0: A fixed model version, for results that stay consistent over time

Auth type: Choose between:

  • API key: Use your own TypeSafe API key
  • Leena AI auth key: Use Leena AI's managed authentication (no additional configuration required)

API key: If using your own key, paste your TypeSafe API key in the configuration field

  1. Test Connection: Click Test connection to verify that Leena AI can reach TypeSafe with the selected authentication
  2. Save Configurations:
    • Ensure the key is valid and active
    • Click Save to complete the connector setup
    • The connector will be saved and ready to use
👍

Tip: jev-latest can change when TypeSafe releases a new model. If an AI Colleague's behavior depends on stable scores or thresholds, select a fixed version such as jev-1.13.0.

Actions

The following actions are supported for the Jev connector:

Evaluate

Evaluates content (the state) against one or more typed questions and returns a structured answer for each question. The Agent can leverage the tool (workflow), which has been designed to classify, route, score or check content — such as employee messages, tickets or form data — before deciding what to do next.

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescription
StateThe content to evaluate. Plain text (for example, an employee's message) or JSON (for example, a ticket, chat transcript or form data)
QuestionsArray of one or more questions to evaluate against the state

Question Structure:

Each question in the questions array must follow this structure:

NameRequiredDescription
Question IDYesUnique key for the question (e.g. is_urgent). The answer is returned under this key. Must be unique within the call
TypeYesQuestion type (values: noul, choice or score)
InstructionsYesThe question to ask (e.g. "Does this message express urgency?"). Plain text or JSON
Criteria (JSON)Depends on typeDefines the possible answers. Required for choice and score, optional for noul

Question Types:

TypeDescriptionCriteria Format
Noul (yes/no)Returns a probability from 0 (no) to 1 (yes)Optional. JSON object with "true" and "false" keys describing each answer, e.g. {"true": "Urgent", "false": "Not urgent"}
ChoiceSelects one option from a defined set, with the probability of each option and a confidence scoreRequired. JSON object mapping each option to a description, e.g. {"billing": "Payments", "technical": "Bugs"}. 1 to 255 options
ScoreRates content on an ordered scale, returning a probability-weighted score and a confidence scoreRequired. JSON array of 2 to 10 levels, ordered lowest to highest, e.g. ["Calm", "Frustrated", "Very angry"]

Confidence Guidelines:

ValueDescriptionUse Case
Above 0.8High confidenceAct on the answer automatically
0.5 – 0.8Moderate confidenceAct, but log for review
Below 0.5Low confidenceRoute to a human for review

These ranges are a starting point. Adjust them to suit how critical the decision is.

Here is a sample JSON input:

//Yes/No Check (Noul)
{
  "payload": {
    "state": "My salary hasn't been credited for 3 days and I can't pay rent. Please help ASAP.",
    "questions": [
      {
        "id": "is_urgent",
        "type": "noul",
        "instructions": "Does this message express urgency?",
        "criteria": "{\"true\": \"Urgent\", \"false\": \"Not urgent\"}"
      }
    ]
  }
}

//Routing (Choice)
{
  "payload": {
    "state": "I can't log in to my laptop after the latest update.",
    "questions": [
      {
        "id": "department",
        "type": "choice",
        "instructions": "Which team should handle this request?",
        "criteria": "{\"payroll\": \"Salary, payslips and deductions\", \"it\": \"Devices, access and software\", \"hr\": \"Leave, policies and benefits\"}"
      }
    ]
  }
}

//Sentiment Rating (Score)
{
  "payload": {
    "state": "This is the third time I'm asking about my reimbursement. Nobody has replied.",
    "questions": [
      {
        "id": "frustration",
        "type": "score",
        "instructions": "How frustrated is the employee?",
        "criteria": "[\"Calm\", \"Frustrated\", \"Very angry\"]"
      }
    ]
  }
}

//Structured State with Multiple Questions
{
  "payload": {
    "state": "{\"ticket_id\": \"TKT-10482\", \"subject\": \"Salary not credited\", \"message\": \"My salary hasn't been credited for 3 days and I can't pay rent. Please help ASAP.\"}",
    "questions": [
      {
        "id": "is_urgent",
        "type": "noul",
        "instructions": "Does this ticket express urgency?"
      },
      {
        "id": "department",
        "type": "choice",
        "instructions": "Which team should handle this ticket?",
        "criteria": "{\"payroll\": \"Salary, payslips and deductions\", \"it\": \"Devices, access and software\", \"hr\": \"Leave, policies and benefits\"}"
      },
      {
        "id": "frustration",
        "type": "score",
        "instructions": "How frustrated is the employee?",
        "criteria": "[\"Calm\", \"Frustrated\", \"Very angry\"]"
      }
    ]
  }
}

Response

Upon successful evaluation, the action returns:

  • An answer for each question, returned under its Question ID
  • Question type for each answer (noul, choice or score)
  • For Noul: probability that the answer is yes (0 to 1)
  • For Choice: the selected option, the probability of each option and a confidence score (0 to 1)
  • For Score: the probability-weighted score (which can fall between levels, e.g. 1.3), a legend mapping each level index to its label, the probability of each level and a confidence score (0 to 1)
  • Model version used for evaluation
  • Token usage information (input tokens and output tokens)

Here is a sample JSON response:

{
  "model": "jev-1.13.0",
  "answers": {
    "is_urgent": {
      "type": "noul",
      "noul": 0.96
    },
    "department": {
      "type": "choice",
      "choice": "payroll",
      "probabilities": { "payroll": 0.94, "it": 0.01, "hr": 0.05 },
      "confidence": 0.9
    },
    "frustration": {
      "type": "score",
      "score": 1.3,
      "legend": { "0": "Calm", "1": "Frustrated", "2": "Very angry" },
      "probabilities": { "0": 0.02, "1": 0.66, "2": 0.32 },
      "confidence": 0.71
    }
  },
  "usage": { "input_tokens": 412, "output_tokens": 38 }
}

Error Handling

StatusDescription
400Invalid input, such as a duplicate Question ID, missing instructions, criteria that isn't valid JSON, or criteria outside the allowed limits (1–255 Choice options, 2–10 Score levels)
401The API key is invalid or missing
422TypeSafe rejected the request as malformed
429TypeSafe rate limit exceeded. Retry after a short wait
529TypeSafe is temporarily overloaded. Retry after a short wait

Each request times out after 60 seconds.


Did this page help you?