Claus Ibsen created CAMEL-27783:
-----------------------------------
Summary: camel-spring-ai-chat: component chatModel overwrites the
endpoint one, systemMetadata needs the header, safeguard headers add a second
advisor
Key: CAMEL-27783
URL: https://issues.apache.org/jira/browse/CAMEL-27783
Project: Camel
Issue Type: Bug
Components: camel-spring-ai
Reporter: Claus Ibsen
Fix For: 4.25.0
Found while improving the option descriptions of camel-spring-ai-chat for
CAMEL-23832 (pull request https://github.com/apache/camel/pull/31132).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. The component chatModel overwrites the endpoint chatModel
{{SpringAiChatComponent.createEndpoint}} sets the component-level chatModel
after setProperties.
Proposed change: set it only when the endpoint has none.
h4. 2. systemMetadata is only applied with the CamelSpringAiChatSystemMessage
header
The systemMessage option goes through {{builder.defaultSystem(text)}} without
metadata.
Proposed change: {{defaultSystem(s -> s.text(..).metadata(..))}} when
systemMetadata is set.
h4. 3. Safeguard headers add a second SafeGuardAdvisor
{{applySafeguardHeaderOverrides}} adds a per-request advisor while the endpoint
advisor (safeguardSensitiveWords) stays and runs first, so the failure response
and order headers are not used when the option is also set.
Proposed change: replace the endpoint advisor per request.
h4. 4. Other
{{CamelSpringAiChatMediaData}} is never read. With {{chatClient}} set,
systemMessage, advisors, vectorStore, safeguard* and structuredOutputValidation
are silently ignored (only toolSearch fails fast). structuredOutputValidation
ignores the outputClass/entityClass headers. topK=0 with chatMemoryVectorStore
fails at startup.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)