BazaarLinkBazaarLink
登入
文件API 参考SDK 参考Agent 应用AI Skills
章节导航
Typed Evaluations

Run a typed evaluation

Jev 会根据具名问题评估 JSON 状态,并返回 boolean、choice 或 score 类型的答案。使用 Bearer 身份验证调用 POST /v1/evaluations;模型的 context window 为 32K tokens。通过 /v1/models?output_modalities=decisions 或 /v1/models?output_modalities=all 查询 Jev;默认的纯文本模型列表不会列出仅输出 decisions 的模型。Jev 只能通过 evaluations endpoint 使用;聊天格式的 endpoint 会返回 HTTP 400。当前目录单价:每 1M 输入 tokens $0.042,每 1M 输出 tokens $0。账户需要有足够的 credits。

POST/v1/evaluations

验证

Authorization必填
string · header

在 Authorization 标头以 Bearer token 传入 API 密钥。

Body

model
string

The optional evaluation model in the request body. Omit it to use the default typesafe-ai/jev; any other value is rejected as model_not_available.

optional; defaults to typesafe-ai/jev
Example: "typesafe-ai/jev"
state必填
JSON string | object | array

The state or evidence to evaluate. It may be a string, object, or array.

JSON value
Example: "The support agent issued a full refund."
questions必填
record<string, Question>

One or more named questions evaluated in parallel.

type必填
boolean | choice | score

The typed answer requested for this question.

instructions必填
JSON string | object | array

Instructions describing what this question should decide.

criteria
record<string, JSON> | JSON[]

Required for choice questions as an option-to-description record; required for score questions as an ordered array of at least two criteria; optional for boolean questions.

POST /v1/evaluations
curl 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"]
      }
    }
  }'
响应示例

Success. The response includes id, object, model, answers, usage, rounding, and warnings. answers is keyed by question name; choice probabilities use option names as keys. For score questions, score is the expected value over indices 0 through N-1, and probabilities keys are the string indices in criteria order. usage reports input_tokens, output_tokens, and total_tokens; rounding reports probabilityDecimals and scoreDecimals.

{
  "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": []
}
客服
您好!有什么可以协助?
请留下消息,我们会尽快回复。
Run a typed evaluation — BazaarLink API