Bedrock support for remote s3 document #476
Conversation
|
@dumbbellcode I change approach a little to extend this as a separate class for future interpretability. |
Thanks @pushpak1300, since we are going with a new class, i have added a small commit to also support bucketOwner converse parameter |
…cument_bedrock # Conflicts: # src/Gateway/Bedrock/BedrockTextGateway.php # tests/Unit/Gateway/Bedrock/BedrockTextGatewayTest.php
|
AI assisted review:
|
|
I have made the following changes:
|
|
thinking of renaming S3Document to BedrockS3Document as most of it's content is specific to bedrock, what do you think @pushpak1300 ? |
Adds support for passing S3-hosted documents to Bedrock's Converse API by reference, so users don't have to download and re-upload large files inline.
Fixes #475
Usage
Approach
S3Documenttype for S3 location references (it does not have inline content — only a URL and an optional bucket owner).sourceblock:s3LocationforS3Document,bytesfor inline document types. Unsupported document types raise a clear error.Note on contract change
Document::content(): stringis documented as "raw bytes of the file" and every existing subclass honors that.S3Document::content()throws instead, since the bytes never live on the client. Any caller that handles arbitraryDocumentinstances and calls->content()will now need to either type-check first or handle the exception — relevant only for code consumingDocumentpolymorphically (e.g. custom gateways or middleware), not for normalai('bedrock')->text(...)usage.