[ 
https://issues.apache.org/jira/browse/CAMEL-26071?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Work on CAMEL-26071 started by Claus Ibsen.
-------------------------------------------
> camel-aws-bedrock - aws-bedrock-agent-runtime: invokeFlow does not convert 
> the body, and an operation picked by the header fails on an endpoint of 
> another operation
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26071
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26071
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-aws2
>    Affects Versions: 4.18.0, 4.22.0, 4.23.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> Found while adding the catalog body types of aws-bedrock-agent-runtime 
> (CAMEL-24961).
> h4. 1. invokeFlow does not convert the body
> invokeFlow takes a String, a FlowInput or a List of FlowInput, and fails for 
> anything else ({{BedrockAgentRuntimeProducer}}, main ed3d719b379c, lines 
> 375-400), while invokeAgent converts the body to a String (line 641). So 
> bytes, a stream or a file from a file consumer fail. Checked on 
> 4.24.0-SNAPSHOT with {{camel run}} against a fake of the AWS API that logs 
> the requests it gets: a byte[] body gives {{IllegalArgumentException: 
> invokeFlow expects the body to be a List<FlowInput>, a single FlowInput or a 
> String when pojoRequest=false. Got: [B}}.
> *Proposed change*: convert the other bodies to a String, as invokeAgent does.
> h4. 2. An operation picked by the header fails on an endpoint of another 
> operation
> The asynchronous client that invokeAgent, invokeInlineAgent and invokeFlow 
> need is only created when the operation option of the endpoint is one of them 
> ({{BedrockAgentRuntimeEndpoint}}, lines 76-83). The 
> {{CamelAwsBedrockAgentRuntimeOperation}} header can pick them on an endpoint 
> of retrieve or retrieveAndGenerate, and then every exchange fails. Checked on 
> 4.24.0-SNAPSHOT with {{camel run}} against a fake of the AWS API that logs 
> the requests it gets: {{IllegalStateException: BedrockAgentRuntimeAsyncClient 
> is not available}}.
> *Proposed change*: create the asynchronous client when an exchange first 
> needs it.
> h4. 3. No operation fails with a NullPointerException
> The operation option has no default, and with no header, {{switch 
> (determineOperation(exchange))}} (line 84) fails with a NullPointerException. 
> Checked on 4.24.0-SNAPSHOT with {{camel run}} against a fake of the AWS API 
> that logs the requests it gets.
> *Proposed change*: fail with a message that says to set the operation option 
> or header.
> h4. Also read in the code, not run
> * modelId and knowledgeBaseId are marked required for every operation 
> ({{BedrockAgentRuntimeConfiguration}}, lines 47-52), but only retrieve and 
> retrieveAndGenerate use them, so tooling flags endpoints of invokeAgent and 
> invokeFlow.
> * The catalog says {{CamelAwsBedrockAgentRuntimeCitations}} is a String; it 
> is a {{List<Citation>}}. The page names a {{bedrockRuntimeClient}} (line 47).
> _Claude Code on behalf of davsclaus_



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

Reply via email to