davsclaus opened a new pull request, #30545:
URL: https://github.com/apache/camel/pull/30545

   _Claude Code on behalf of Claus Ibsen_
   
   ## What
   
   A follow-up to 
[CAMEL-27313](https://issues.apache.org/jira/browse/CAMEL-27313): `camel get 
genai` shows the `genai` dev console of an integration in the terminal. Until 
now it was reachable from the Camel TUI, the MCP server and HTTP, but there was 
no plain CLI command for it.
   
   - **Default view:** the level, and counts of model calls, agent runs, tool 
calls and failures, with the tokens. Then a table per provider and model 
(calls, failed, in, cached, out, average time), and the newest runs with their 
model calls and tool calls indented under them (id, age, route, call, tokens, 
time, finish reason).
   - `--content` adds the question of each run (recorded at level `full`).
   - `--id N` shows one run in order: the system message, the question, each 
model call's answer or tool calls, each tool call's arguments and result, then 
the answer. Without messages, it says they are recorded at level `full`.
   - `--json` prints the console's answer as it is. `--limit` sets how many 
calls to list. `--watch` comes from `ActionWatchCommand`.
   - **When something is missing:**
     - an integration without the console gets a hint (set 
`camel.aiObservability.level`) and exit code 0
     - an `--id` the console no longer keeps exits with 3 (`NOT_FOUND`)
   
   It sends the `genai` action of the CLI connector (#30539), the same as the 
TUI and the MCP server.
   
   ## Tried live
   
   A camel-openai agent with an `ai-tool` route on Ollama (`llama3.2`), at 
level `full`, started with plain `camel run`:
   
   ```
   $ camel get genai agent-console
   GenAI level: full   Model calls: 4   Agent runs: 2   Tool calls: 2   Failed: 0
   Tokens: in 676 (cached 404), out 56
   
    PROVIDER  MODEL     CALLS  FAILED  IN   CACHED  OUT  AVG
    openai    llama3.2      4       0  676     404   56  815ms
   
    ID  AGE  ROUTE          CALL                        IN   OUT  TIME     
FINISH
     5   0s  support-agent  invoke_agent support-agent  338   28    437ms  stop
     6                        chat llama3.2             196   15    263ms  
tool_calls
     7                        execute_tool lookupOrder                0ms
     8                        chat llama3.2             142   13    172ms  stop
     ...
   
   $ camel get genai agent-console --id 5
   #5 invoke_agent support-agent   route: support-agent   437ms   tokens: in 
338, out 28
   system: You are a support agent for ACME. Use the tools to look up orders.
   question: What is the status of order A-17? Use the lookupOrder tool, then 
answer in one sentence.
     #6 chat llama3.2   263ms (tool_calls): tool call lookupOrder 
{"orderId":"A-17"}
     #7 execute_tool lookupOrder   0ms: {"orderId":"A-17"} -> 
{"orderId":"A-17","total":49.90,"status":"DELIVERED"}
     #8 chat llama3.2   172ms (stop): The status of order A-17 is DELIVERED.
   answer: The status of order A-17 is DELIVERED.
   ```
   
   `--id 999` answered `No GenAI call with id 999: it may no longer be kept 
(the newest 50 top-level calls are)` and exited with 3.
   
   ## Tests and docs
   
   - `CamelGenAiActionTest`, 8 tests:
     - the default view
     - `--content`
     - `--id`, with the system message from the model call or from the run's 
input (camel-openai)
     - a run without messages
     - an id that is gone
     - no console
     - `--json`
   - `CliHelpGoldenTest` is updated for the new command.
   - Generated: the command metadata and 
`jbang-commands/camel-jbang-get-genai.adoc`.
   - `ai-observability.adoc`: a paragraph on `camel get genai`, plus the 
catalog copy.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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