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

   ## Description
   
   [CAMEL-27177](https://issues.apache.org/jira/browse/CAMEL-27177): `converse` 
and `converseStream` of `aws-bedrock` read the conversation only from the 
`CamelAwsBedrockConverseMessages` header, a `List` of AWS SDK `Message` 
objects. The body was never used, although the code comment said "from header 
or body". So a route without Java code (YAML or XML DSL, a Kamelet) could not 
call `converse`. With it went the guardrail endpoint options 
(`guardrailIdentifier`, `guardrailVersion`, `guardrailTrace`), which apply only 
to `converse`, `converseStream` and `applyGuardrail`. Every such call failed 
with `Converse operation requires messages in header 
CamelAwsBedrockConverseMessages`.
   
   - `converse` and `converseStream`: when the header is not set, the body as 
text is sent as one user message.
   - `applyGuardrail`: when `CamelAwsBedrockGuardrailContent` is not set, the 
body as text is checked, as one text content block.
   - The headers keep precedence, so existing routes are unchanged. Without a 
header and a body, the error now says `... in header X or a text body`.
   - Not changed: `pojoRequest=true` (the SDK request in the body), the system 
prompt, inference config and tool config headers.
   - The `@BodyType` of these three operations is now TEXT, with an updated 
description. The two header descriptions and the component doc (with a YAML 
example) are updated. The catalog, its doc copy and the endpoint DSL are 
regenerated.
   
   Needed for `operation: converse` (the same prompt for every model, with a 
guardrail) in the `aws-bedrock-text-sink` Kamelet (apache/camel-kamelets#3280).
   
   ## Tests
   
   - `BedrockConverseTextBodyTest`, on mocked sync and async clients:
     - a text body becomes one user message for `converse`, with the endpoint 
guardrail options applied and the answer text as the body
     - the same for `converseStream`
     - the messages header wins over the body
     - no header and no body fails with the new message
   - `BedrockApplyGuardrailTest`: the text body is checked, the content header 
wins over it, and neither fails.
   
   Without the producer change, 5 of the 11 tests in these two classes fail. 
All 196 unit tests of the module pass.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 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