LLM evaluation

Handle and assert on streaming output

Hard120 pts~45 min
  • Streaming
  • Server-sent events
Practice app · Acme Support Assistant

A deterministic LLM-style support assistant with retrieval (RAG), JSON mode, safety policies and tool calls, exposed via UI and API.

BASE_URL
/api/practice
Console app
/lab/ai-testing-handle-and-assert-on-streaming-output

Your starter code already declares BASE_URL — call the API relative to it.

Objective

Consume a server-sent-event stream, rebuild the answer and compare it with the non-streamed response.

Your task

  1. 1Ask "How long does standard shipping take?" with stream: true.
  2. 2Assert Content-Type is text/event-stream and the body ends with a "data: [DONE]" line.
  3. 3Parse every "data: {…}" line and concatenate the delta values.
  4. 4Send the same request with stream: false and assert the concatenated text equals output_text.

Acceptance criteria

  • POST /ai/chat returns 200
  • Streaming is requested
  • At least 3 assertions pass

LLM evaluation · AI Testing · Output validation