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

   ## Summary
   
   Add IBM watsonx.ai (Bob AI) as a new AI provider for the Camel JBang TUI/CLI 
AI prompt feature (F8).
   
   ### What changed
   
   - **`LlmClient.java`**: Added `ApiType.watsonx` with auto-detection via 
`WATSONX_APIKEY` and `WATSONX_URL` environment variables. Reuses the OpenAI 
wire format since the watsonx model gateway (`/ml/gateway/v1/chat/completions`) 
is OpenAI-API-compatible. Includes watsonx-specific URL normalization, model 
listing via the gateway models endpoint, and default model 
(`ibm/granite-3.1-8b-instruct`) / URL (`https://us-south.ml.cloud.ibm.com`).
   - **`AiProviderSelector.java`**: Added watsonx to the provider switch popup 
choices.
   - **`AiPanel.java`**: Updated the "no LLM reachable" error message to 
mention `WATSONX_APIKEY`.
   - **`Ask.java` / `Explain.java`**: Updated `--api-type` and `--api-key` CLI 
help descriptions to include watsonx.
   - **`LlmClientWatsonxTest.java`** *(new)*: 10 unit tests covering URL 
normalization (chat and models paths), region support, API type enum, and 
OpenAI-format delegation.
   - **`AiProviderSelectorTest.java`**: Updated all provider-list expectations 
to include watsonx; added test for watsonx default de-duplication.
   
   ### Design decisions
   
   1. **New `ApiType.watsonx`** (not piggybacked on `openai`) — gives watsonx 
first-class visibility in the TUI settings and switch popup, matching the JIRA 
request.
   2. **Reuses OpenAI wire format** — the watsonx model gateway is explicitly 
OpenAI-API-compatible, so `generate()`, `chatWithTools()`, and response parsing 
delegate to the existing OpenAI-format methods.
   3. **Bearer auth** — watsonx uses standard `Authorization: Bearer <apikey>` 
(same as OpenAI, not Azure's `api-key` header).
   4. **Auto-detection priority** — watsonx is tried after OpenAI but before 
Ollama, since it requires dedicated env vars (`WATSONX_APIKEY`).
   5. **`WATSONX_APIKEY`** (not `WATSONX_API_KEY`) — follows IBM's documented 
environment variable naming convention.
   
   ### Environment variables
   
   | Variable | Required | Description |
   |----------|----------|-------------|
   | `WATSONX_APIKEY` | Yes | IBM Cloud API key for watsonx.ai |
   | `WATSONX_URL` | No | Base URL (defaults to 
`https://us-south.ml.cloud.ibm.com`) |
   
   ### How to test
   
   ```bash
   export WATSONX_APIKEY=<your-key>
   export WATSONX_URL=https://us-south.ml.cloud.ibm.com  # optional
   
   # CLI
   camel ask "what routes are running?" --api-type=watsonx
   camel explain my-route.yaml --api-type=watsonx
   
   # TUI: press F8, then use provider switch to select watsonx
   ```
   
   _Claude Code on behalf of gnodet_
   
   Generated with [Claude Code](https://claude.ai/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