Andrea Cosentino created CAMEL-23462:
----------------------------------------

             Summary: Camel-AWS-Bedrock: invoke*Model operations silently 
produce no output when pojoRequest body has wrong type
                 Key: CAMEL-23462
                 URL: https://issues.apache.org/jira/browse/CAMEL-23462
             Project: Camel
          Issue Type: Bug
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino


The {{invokeTextModel}}, {{invokeImageModel}}, and {{invokeEmbeddingsModel}} 
methods in {{BedrockProducer}} only act when {{pojoRequest=true}} AND the body 
is an {{InvokeModelRequest}}. If the body is any other type, the method 
silently returns without setting any response, leaving the user with a {{null}} 
body and no error.

The {{converse}} and {{applyGuardrail}} paths properly throw an 
{{IllegalArgumentException}} for the same condition; the three invoke 
operations should be consistent.

*Reproduction:*
# Configure an {{aws-bedrock}} endpoint with {{pojoRequest=true}} and a valid 
{{modelId}}.
# Send any body that is not an {{InvokeModelRequest}} (e.g., {{String}}, 
{{Map}}).
# Observe: no exception, output body is {{null}}.
# Expected: {{IllegalArgumentException}} with a clear message indicating the 
required body type.

*Files:*
* 
{{components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockProducer.java:122-164}}
 ({{invokeTextModel}})
* 
{{components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockProducer.java:166-212}}
 ({{invokeImageModel}})
* 
{{components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockProducer.java:214-257}}
 ({{invokeEmbeddingsModel}})

*Suggested fix:*
* Add an {{else throw new IllegalArgumentException(...)}} branch in each of the 
three operations to mirror the {{converse}} behavior.


----
_Filed by Claude Code on behalf of Andrea Cosentino._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to