Updating Bedrock Converse API citations format to handle web citations
Description
This PR adds support for web-based citations in the Bedrock Converse API, enabling the SDK to handle citations from web sources in addition to document-based citations.
Changes:
- Added
WebLocationTypedDict tosrc/strands/types/citations.pywithurlanddomainfields - Updated
CitationLocationunion type to include the newWebLocationtype - Enhanced citation location filtering in
src/strands/models/bedrock.pyto handle web-based citations - Refactored citation metadata processing to use safer dictionary comprehension that only includes fields present in the citation
All citation location types (document-based and web-based) are now supported as per the updated Bedrock Converse API specification.
Related Issues
This was a blocking issue for #1154
Documentation PR
N/A
Type of Change
New feature
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli
- [X] I ran
hatch run prepare
Checklist
- [X] I have read the CONTRIBUTING document
- [X] I have added any necessary tests that prove my fix is effective or my feature works
- [ ] I have updated the documentation accordingly
- [X] 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
- [X] 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.
hi team, any update on this? One of my customer is also looking forward for this feature support to test out Nova Web Grounding.
All types should be back now for backward compatibility.
Closing this PR in favor of a cleaner split:
- #1343 (bug fix): Fixes the CitationLocation tagged union structure issue (#1323)
- #1344 (feature): Adds web and search result citation support (depends on #1343)
This separation keeps bug fixes and features in separate PRs as per best practices.