Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Observing AI Features: Traces, Cost and Latency (Summary)

You’ve finished Observing AI Features: Traces, Cost and Latency. Now you can:

  • Log every request with an ID and a timer
  • Trace every request through retrieval, model calls and tool calls
  • Find the step that caused a bad answer from its trace
  • Keep personal data out of what you record
  • Report cost and latency per request with percentiles

What You Built

  • Every request has an ID, a JSON log line and a trace, a span per step. In the lesson’s run, the storage rule kept 34 of 200 traces in a day.
  • The Forcella trace showed where the answer went wrong: retrieval passed a report 6 days older than the closure.
  • The Forcella eval case went from 0 of 5 passes to 5 of 5.

What You Measured

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

00:00 You’ve finished Observing AI Features: Traces, Cost and Latency. You can log every request with an ID and a timer, trace it through retrieval, model calls and tool calls, find the step behind a bad answer, keep personal data out of the record, and report cost and latency with percentiles.

00:22 Each request got an ID, a JSON log line, and a trace, a span per step. In the lesson’s run, the rule kept 34 of 200 traces in a day. The Forcella trace showed retrieval passing a report 6 days older than the closure.

00:40 The Forcella case went from 0 of 5 passes to 5 of 5.

00:46 Patterns alone left details in 378 of 412 questions in a simulated week, so traces record fields instead. Priced call by call, the pricing lesson’s day cost 67 cents per thousand questions.

01:04 On the stand-in day, the wait for the first words had a p50 of 1,178 milliseconds and a p95 of 3,215.

01:16 In the project, you found what tripled the bill and which step sent a hiker to a full hut.

01:24 One trace per request, a span per step. Keep every failure and flagged answer, plus a sample, for a limited time. For a wrong answer, find the first wrong step, replay it, and add an eval case.

01:38 Redact before you record. Price every call from its usage. Report percentiles, not averages.

01:48 What if a model call is slow or fails? The next course on this path takes that up. A related course, Concurrency, Failures and Cancellation in Async Code, covers deadlines and cancellation.

02:02 Thanks for working through the course, and congratulations.

Become a Member to join the conversation.