Skip to content

Conversation

shabie
Copy link

@shabie shabie commented Sep 28, 2025

Description

  • Decode document, image, and video payloads to raw bytes before sending them to Bedrock so base64 strings no longer trigger “detected filetype is PLAIN_TEXT”.
  • Validate document.source input types and fail fast on plain text.
  • Added unit tests covering both base64 and raw byte document uploads and a guard for invalid input.

Related Issues

Type of Change

Bug fix

Testing

  • [ X] I ran hatch test

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@shabie shabie changed the title fix: add helper to handle base64 conversion to raw bytes for boto3 converse_stream fix: add helper to handle base64 conversion to raw bytes for boto3 converse_stream Sep 28, 2025
@shabie
Copy link
Author

shabie commented Sep 30, 2025

@Unshure I think it is a simple fix. Could you kindly have a look?

else: # "auto"
return any(model in self.config["model_id"] for model in _MODELS_INCLUDE_STATUS)

def _coerce_to_bytes(self, value: Any, *, expected_fmt: Optional[str] = None) -> bytes:
Copy link
Member

@pgrayy pgrayy Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not so sure this logic should exist in the BedrockModel provider. The expected type of ["source"]["bytes"] is bytes (src) and so users should be configuring this before passing the payload into Strands. Also, this would be a problem for other model providers as well.

I'm thinking that this logic should go into https://github.com/strands-agents/sdk-python/blob/main/src/strands/multiagent/a2a/executor.py if we are trying to resolve #850.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] A2A Filetype being erroneously detected as PLAIN_TEXT

2 participants