From the course: Claude Code: Designing Multi-Model AI Systems
Unlock this course with a free trial
Join today to access over 25,600 courses taught by industry experts.
Build AI metrics: Timing, tokens, and routing
From the course: Claude Code: Designing Multi-Model AI Systems
Build AI metrics: Timing, tokens, and routing
We need to measure everything. Every stage timed. Every token counted. Every route recorded. Let's add metrics collection to our pipeline. Here is the prompt. Let's go to the prompts folder and find 42 metrics collection prompt. We are wrapping each stage with timing and adding a metrics flag that shows a per message summary. So we will be looking at route taken. per stage in milliseconds, token costs, cost breakdown, and confidence score. Let's go ahead and create this particular change using this prompt. So I'm going to take this prompt and I will copy it into the cloud code and we will let do its magic here and then we will look at the helpdesk bot to see what changed. We will be looking at every stage. Guardrails, classification, generation will be now timed in the new code. Token counts will be recorded. The route taken will be logged. And there will be a new metrics flag that prints a summary after each message. So let's give it a couple more seconds. It should finish by then…