Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

OpenAI API Endpoint for Building Node Chatbots — Reliable Candidate Rubric Scoring

说明与用途

使用 OpenAI /v1/chat/completions 的 Node.js 聊天机器人现在能够保证每个候选人仅生成一次评分记录,验证 JSON 输出,并优雅地处理速率限制。

问题

How to reliably score candidates using OpenAI chat completions while ensuring idempotency, validation, and rate‑limit handling in a Node.js chatbot.

结果

The chatbot now produces deterministic, validated scores with a single record per candidate, handles retries safely, and respects rate limits.

工作流

  • Generate a unique requestId for the scoring job
  • Persist candidateId, rubricRevision, candidateText, and requestId in a durable store
  • Call OpenAI /v1/chat/completions with Idempotency-Key header
  • On 429, read Retry-After or apply exponential backoff with jitter, retry up to 4 times
  • Validate HTTP status and parse JSON schema against rubric contract
  • Reject out‑of‑range scores, missing evidence, or invalid decisions
  • Store raw response per retention policy, but only keep validated score as the record

证据

Create a stable application request ID from the scoring job, not from the HTTP attempt.

来源

Read Retry-After when it exists. Otherwise use exponential backoff with jitter and a small maximum attempt count.

来源

Parse and validate the result against the rubric contract.

来源

  • 记录日期: 2026-10-26T00:41:11.366Z