Skip to course content
Free LangChain course

LangChain for LLM Applications and RAG

Module 09 Activity

Scenario

The chain is correct and takes seconds. This is about what the person waiting sees, and what your logs collect while they wait.

What you build

A streamed response with both latency numbers measured, a safe broken-stream path, and logging that redacts on the way in.

Steps

  1. Switch to stream and accumulate the chunks rather than calling twice.
  2. Measure time to first chunk and time to completion separately, and report p50 and p95 for both.
  3. Attach a callback that records timings and token counts. Confirm it changes nothing about the result.
  4. Simulate a stream failing midway. Mark the partial content incomplete, do not persist it, and retry the whole request.
  5. Redact structured identifiers on the way into your logs, and keep the debugging metadata in full.
  6. State plainly what your redaction does not catch.

Evidence to hand in

Review checklist