feat(types): add native audio content block support #1515
+68
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add native audio content block support to the SDK's type system, following the established pattern for video, image, and document content.
Changes
Types (
src/strands/types/media.py):AudioFormatliteral type (mp3,wav,flac,ogg,webm)AudioSourceTypedDict withbytesattributeAudioContentTypedDict withformatandsourceattributesContentBlock (
src/strands/types/content.py):audio: AudioContentfield to theContentBlockTypedDictBedrock Provider (
src/strands/models/bedrock.py):_format_request_message_content()following the video patternLlamaCpp Provider (
src/strands/models/llamacpp.py):AudioContenttypes instead ofcast(Dict[str, Any], content)Tests (
tests/strands/models/test_bedrock.py):test_format_request_filters_audio_content_blockstestBenefits
cast(Dict[str, Any], content)workaroundsUsage Example
Related Issues
Closes #866
Documentation PR
No documentation changes required - this adds types that follow existing patterns.
Type of Change
New feature
Testing
hatch run prepare(formatter + linter + mypy + tests)test_format_request_filters_audio_content_blocksChecklist