gnodet commented on PR #23346:
URL: https://github.com/apache/camel/pull/23346#issuecomment-4515200403

   ## New: `camel ask` command and shared LlmClient
   
   _Claude Code on behalf of Guillaume Nodet_
   
   ### `LlmClient` — shared LLM HTTP client
   
   Extracted from `Explain` into a reusable `LlmClient` supporting three API 
types with auto-detection:
   
   1. **Ollama** — local models via `camel infra` or `localhost:11434`
   2. **OpenAI-compatible** — any OpenAI API endpoint (OpenAI, Azure OpenAI, 
vLLM, LM Studio, etc.)
   3. **Anthropic** — both direct API (`api.anthropic.com`) and Vertex AI 
(`rawPredict` endpoint)
   
   Auto-detection from environment variables:
   - `ANTHROPIC_API_KEY` → Anthropic direct API
   - `CLOUD_ML_REGION` + `ANTHROPIC_VERTEX_PROJECT_ID` → Vertex AI (auth via 
`gcloud auth print-access-token`)
   - `OPENAI_API_KEY` → OpenAI
   
   No new dependencies — uses `java.net.http.HttpClient` directly.
   
   ### `camel ask` — AI-powered runtime inspection
   
   Sends a question to an LLM with tool-calling support, letting the LLM 
inspect a running Camel process and return an informed answer.
   
   **Agent loop:** user question → LLM with tool definitions → LLM calls tools 
→ execute tools → results back to LLM → repeat until text answer.
   
   **13 read-only tools:** `get_context`, `get_routes`, `get_health`, 
`get_endpoints`, `get_inflight`, `get_blocked`, `get_consumers`, 
`get_properties`, `get_route_source`, `get_route_dump`, `get_route_structure`, 
`get_top_processors`, `trace_control`
   
   **Two modes:**
   - **One-shot:** `camel ask "what routes are running?" --show-tools`
   - **Interactive chat:** `camel ask` — enters a JLine `ask>` prompt with 
conversation context maintained across turns
   
   ### Refactored `Explain`
   
   `Explain` now delegates all LLM interaction to `LlmClient`, gaining 
Anthropic/Vertex AI support for free.


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