Claus Ibsen created CAMEL-27807:
-----------------------------------

             Summary: camel-google-vertexai: extra candidates are billed but 
lost, stream/anthropic_version detected by substring
                 Key: CAMEL-27807
                 URL: https://issues.apache.org/jira/browse/CAMEL-27807
             Project: Camel
          Issue Type: Bug
          Components: camel-google
            Reporter: Claus Ibsen
             Fix For: 4.25.0


Found while improving the option descriptions of camel-google-vertexai for 
CAMEL-23832 (pull request https://github.com/apache/camel/pull/31138).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. candidateCount > 1 returns only the first candidate
generateText, generateChatStreaming and generateMultimodal use 
{{GenerateContentResponse.text()}}, which reads only the first candidate; the 
others are billed but lost.
Proposed change: return a List of candidate texts when candidateCount > 1, or 
limit the option to 1.

h4. 2. stream and anthropic_version are detected by a substring search
{{streamRawPredict}} adds stream:true only when the JSON text has no "stream" 
anywhere, and {{buildRawPredictRequestBody}} checks anthropic_version the same 
way, so a prompt containing those words skips the field.
Proposed change: parse the JSON and check the key.

h4. 3. Anthropic requests always send temperature and top_p
{{buildPromptRequest}} for publisher anthropic always sends temperature (0.7) 
and top_p (0.95). According to Anthropic's migration notes, the newest Claude 
models reject a request with both set (not verified against a live endpoint).
Proposed change: send top_p only when the user set it.

h4. 4. Other
The defaults of temperature, topP, topK, maxOutputTokens and candidateCount are 
always sent and override the model's own defaults; rawPredict ignores the 
sampling headers; the ProjectId and Location headers are never read.


_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to