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

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

Описание и применение

Чат‑бот на Node.js, использующий OpenAI /v1/chat/completions для оценки кандидатов по рубрике, теперь гарантирует однократную запись результата, валидирует 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