Senior Backend Engineer / Stage 11 · AI-backed services
Validate and stream a model response
Handle tool schemas, timeouts and usage caps with a mock provider.
"Already know" meets prerequisites. "Not relevant" removes the topic from your total but leaves what builds on it waiting.
Self-check
- Feed a mock provider fixtures for a valid answer, refusal, malformed tool arguments and a disconnected stream. Decide which cases may update the UI and which may invoke a tool. Add a timeout and a usage budget.
- Evidence to include: Assert that partial JSON never invokes a tool, retries do not duplicate side effects, and budget exhaustion produces a clear local outcome. Avoid hard-coding a current model name or price in the lesson; neither is needed for the mock exercise.
Try it without the material first, then compare. Save your answer in your notes below. Report a problem with this self-check
Learning activities
2 activities- Not doneStructured model outputs (opens another site)
How to constrain a model's completed output to a JSON Schema, and how refusals still come back outside it. The same idea exists in other providers' APIs.
20 min - Not doneStreaming API responses (opens another site)
Streaming a response over server-sent events, so partial text can be shown before the full result is validated.
10 min