davsclaus opened a new pull request, #27981: URL: https://github.com/apache/camel/pull/27981
Fourteenth batch of [CAMEL-23688](https://issues.apache.org/jira/browse/CAMEL-23688) (test coverage of the CLI commands): `camel ask` with a question (34% line coverage before). Its tests covered the confirmation of calls and the note about a small model; the loop of a question (the answer, the tool calls, the failures) was not tested. ### Tests - `AskLoopTest` (new), against `FakeLlmServer` playing Ollama, with no running integration: the answer is the output, the tools the model calls are run and their results are in the next question (with `--show-tools`), a failed call of the LLM, no answer within `--max-iterations`, and `--show-stats`. - `FakeLlmServer.reply(path, status, bodies...)` replies in sequence (the first request gets the first body, the last body answers the rest), such as a tool call and then the answer. ### Bugs the tests found - **`camel ask` exited with `0` without an answer when the call of the LLM failed**, such as an error of the model (`500`) or a refused connection: the client answers a failed call with the `error` stop reason and no text, which the loop took as the final answer. Now `1`, after the error of the client and `Failed to get response from LLM` on stderr. - **The output of a question mixed diagnostics into the answer**: `Using <model> (...) to answer your question...`, `Target: ...`, the note about a small model, the `[tool]`/`[result]` lines of `--show-tools`, the stats of `--show-stats` and the correction note were printed on stdout. They go to stderr, as with `camel explain`, so a script or an AI agent reads the answer only. The interactive chat is unchanged. The user-visible changes are in the 4.24 upgrade guide, and the AI page of the CLI says what the output of a question is. `mvn test` of the ask, LLM client, explain, harden and overview tests of camel-jbang-core: all pass. The new tests were checked against the code before the fix: 4 fail. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DDRLJAyf8cDXSg8iX785My -- 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]
