gnodet-bot commented on code in PR #30521:
URL: https://github.com/apache/camel/pull/30521#discussion_r4647402531


##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AiPanel.java:
##########
@@ -1891,7 +1868,7 @@ private void recordUsage(LlmClient.ChatResponse response, 
long latencyMs, String
                 response.usage().inputTokens(), 
response.usage().outputTokens(),
                 response.usage().totalTokens(), latencyMs,
                 response.stopReason(), Instant.now(),
-                AiUsageSource.TUI, null, questionCounter));
+                AiUsageSource.TUI, null, questionCounter, 0));

Review Comment:
   ⚠️ **Missing cached tokens for TUI requests.** `cachedInputTokens` is 
hardcoded to `0` here, but `response.usage().cachedTokens()` is already in 
scope (it's used at line 1562 for the same response). The CACHED column will 
always show `0` for the TUI's own requests even when the provider returns 
cached token counts (OpenAI, Anthropic, Ollama via `cache_read_input_tokens`).
   
   ```suggestion
                   AiUsageSource.TUI, null, questionCounter, 
response.usage().cachedTokens()));
   ```



##########
docs/user-manual/modules/ROOT/pages/camel-jbang-tui-ai.adoc:
##########
@@ -212,6 +212,16 @@ average time per question (and per request in brackets), 
the model table has an
 the average per request for that model, and the *Time per question* chart next 
to the token chart shows the
 two side by side for each question, so you can see whether a slow answer was 
the model or the tools.
 
+The integration rows count model calls only. At the GenAI observability level 
`detailed` or `full`
+(`camel.aiObservability.level`), an agent run is recorded as an `invoke_agent` 
span with one span per model call
+and one per tool call. The view counts its model calls, and a third summary 
line gives the agent runs, their model
+and tool calls, and the level the spans were recorded at. At the default level 
`basic` agent runs and tool calls are

Review Comment:
   💬 **Readability (low):** This sentence is 33 words with a nested 
parenthetical. Consider splitting:
   
   ```suggestion
   not traced. The summary line tells how to enable them. The *CACHED* column 
shows the input tokens served from the provider's prompt cache, which
   ```
   
   I.e.: end the sentence at "are not traced" and start a new one for the hint.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to