Skip to content

Report Generation (SQS Consumer → AI Analysis → Report Storage)

Worker generates an interview report from snapshot and transcript, or marks insufficient evidence without LLM.

Sequence

sequenceDiagram
  autonumber
  participant Settle as settlement.service
  participant SQS as SQS report-generate
  participant Lambda as report-generate handler
  participant Gen as report-generation.service
  participant OpenAI as OpenAI API
  participant Mongo as MongoDB

  Settle->>SQS: publishReportGenerate
  SQS->>Lambda: message
  Lambda->>Gen: generateReport
  Gen->>Mongo: claim report PROCESSING
  alt too short or few answers
    Gen->>Mongo: insufficient_evidence COMPLETED
  else AI path
    Gen->>OpenAI: chat completions json_schema
    OpenAI-->>Gen: structured report
    Gen->>Mongo: COMPLETED report fields
  end

Steps

  1. Settlement enqueues { interviewId, organizationId } after first successful credit settlement.
  2. Lambda loads the interview and atomically claims the report document as processing.
  3. Very short interviews or too few answers get a completed insufficient-evidence report without LLM.
  4. Otherwise structured OpenAI output becomes scores, recommendation, and skill assessments.
  5. Recruiters poll or fetch report status and content when generation completes.

Sophia AI Interview Platform — Internal Documentation