BazaarLinkBazaarLink
Sign in
DocsAPI ReferenceSDK ReferenceAgentic UsageAI Skills
Contents

Structured evaluations (Jev)

Structured evaluations (Jev)

Jev evaluates a JSON state against named questions and returns answers typed as boolean, choice, or score. Use it when an application needs explicit criteria turned into machine-readable evaluation results.

Evaluation and judgement only
Jev does not support chat. Send Jev requests to POST /v1/evaluations; sending one to POST /v1/chat/completions returns HTTP 400.
POST/v1/evaluations

Call this endpoint with your BazaarLink API key. Full URL: https://api.bazaarlink.ai/v1/evaluations.

Field reference

model
string
Optional. Defaults to typesafe-ai/jev when omitted. Any other model ID returns HTTP 400 with code model_not_available.
state
string | object | array
Required. Provide a JSON string, object, or array as the state to evaluate. Serialized state and questions above 32,000 tokens return context_length_exceeded.
questions
record<string, Question>
Required. A non-empty object of named questions. Each question name becomes a key in the response answers object.
type
boolean | choice | score
Required for each question; one of boolean, choice, or score.
instructions
string | object | array
Required for each question. A JSON string, object, or array describing what to decide.
criteria
object | array
Depends on type: optional for boolean and, when supplied, an object whose keys are only true or false; required as a non-empty object for choice; required as an ordered array of at least two entries for score.

Answer types

  • boolean — criteria is optional; when supplied, only true and false keys are accepted. The answer contains a numeric probability.
  • choice — criteria must be a non-empty object mapping option names to JSON criteria. The answer contains a string choice; probabilities are keyed by option names.
  • score — criteria must be an ordered array with at least two entries. The numeric score is the expected value over the indices 0..N-1 in criteria order; probabilities are keyed by those indices as strings.

Request examples

curl --fail-with-body https://api.bazaarlink.ai/v1/evaluations \
  -H "Authorization: Bearer $BAZAARLINK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "typesafe-ai/jev",
  "state": "The support agent issued a full refund and apologised for the delay.",
  "questions": {
    "refunded": {
      "type": "boolean",
      "instructions": "Was a refund issued?"
    },
    "tone": {
      "type": "choice",
      "instructions": "Tone of the agent?",
      "criteria": {
        "apologetic": "The agent apologises",
        "neutral": "No emotional language",
        "hostile": "The agent is rude"
      }
    },
    "quality": {
      "type": "score",
      "instructions": "How complete was the resolution?",
      "criteria": [
        "poor",
        "partial",
        "complete"
      ]
    }
  }
}'

Successful response example

The sample response contains id, object, model, answers, usage, rounding, and warnings. answers is keyed by question name. usage contains input_tokens, output_tokens, and total_tokens; rounding shows probabilityDecimals and scoreDecimals. warnings is an array and is empty in this example. In answers, choice probabilities use option names as keys, while score probabilities use criteria indices as string keys.

{
  "id": "eval-a3d350e5-2705-4a9b-be7c-838fa4e4eb2b",
  "object": "evaluation",
  "model": "typesafe-ai/jev",
  "answers": {
    "refunded": {
      "type": "boolean",
      "probability": 0.99
    },
    "tone": {
      "type": "choice",
      "choice": "apologetic",
      "probabilities": {
        "apologetic": 1,
        "neutral": 0,
        "hostile": 0
      }
    },
    "quality": {
      "type": "score",
      "score": 1.98,
      "probabilities": {
        "0": 0,
        "1": 0.02,
        "2": 0.98
      }
    }
  },
  "usage": {
    "input_tokens": 394,
    "output_tokens": 74,
    "total_tokens": 468
  },
  "rounding": {
    "probabilityDecimals": 2,
    "scoreDecimals": 2
  },
  "warnings": []
}

Chat endpoint error response

Sending Jev to a chat endpoint returns HTTP 400. The fields and values below match the route handler; message is shown as a placeholder and its actual text is supplied by the server.

{
  "error": {
    "message": "<server-generated message>",
    "type": "invalid_request_error",
    "code": 400
  }
}
Support
Hi! How can we help you?
Send a message and we'll get back to you soon.
Structured evaluations (Jev) | BazaarLink