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

   https://issues.apache.org/jira/browse/CAMEL-26424
   
   camel ask sends `"think": false` only on Ollama's own API. With 
`--api-type=openai` it sent nothing about thinking. The Qwen 3.5, 3.6 and 3.8 
models think by default, so with a local OpenAI-compatible server (Ollama's 
/v1, llama.cpp server, vLLM, LM Studio) every answer started with a hidden 
reasoning phase.
   
   **The change**
   - OpenAI-format requests to a local server (`isLocalEndpoint()`) now turn 
thinking off. This covers the chat of `camel ask`, and the generate of `camel 
explain` and `camel overview`.
     - `"reasoning_effort": "none"`: Ollama's /v1 reads it, and vLLM maps it to 
`enable_thinking=false`.
     - `"chat_template_kwargs": {"enable_thinking": false}`: llama.cpp server 
and vLLM read it.
   - Hosted endpoints (OpenAI, Azure, watsonx) get neither field. There is no 
new option: the Ollama path has none either.
   - A server that refuses a request with these fields (400 or 422) gets the 
same request again with one field less:
     - first without `reasoning_effort`, as a server may not know the value 
none;
     - then also without `chat_template_kwargs`.
     - The field whose removal made the request work is left out from then on. 
An error for another reason is reported once, as before.
   
   **Measured** with Ollama 0.40.12 on its /v1 endpoint, qwen3.6:35b-mlx 
loaded, `chatWithTools` with one tool, a 300 s timeout, one run each (Mac mini 
M4 Pro):
   
   | Question | main | this PR |
   |---|---|---|
   | In one sentence: what does the Camel Split EIP do? | no answer: about 
24,000 tokens of reasoning until the timeout (the default of camel ask is 120 
s) | 0.8 s, 23 tokens |
   | Which routes does the integration have? | 1.0 s, the tool call, with the 
reasoning as the answer text | 0.5 s, the tool call |
   
   **Tests**
   - `LlmClientChatTest`: 6 new tests. They cover the fields with a local 
server (chat and generate), no fields for hosted endpoints, a refusal of one 
field, a refusal of both, and a refusal for another reason.
   - `FakeLlmServer` keeps all the questions it answered, and can give a 
different status for each reply.
   - The LlmClient and Ask tests in camel-jbang-core: 125 tests pass.
   
   🤖 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