aidial_adapter_bedrock/llm/model/stability/storage.py (19 lines of code) (raw):

from aidial_adapter_bedrock.dial_api.storage import FileStorage from aidial_adapter_bedrock.llm.consumer import Attachment async def save_to_storage( storage: FileStorage, attachment: Attachment ) -> Attachment: if ( attachment.type is not None and attachment.type.startswith("image/") and attachment.data is not None ): response = await storage.upload_file_as_base64( "images", attachment.data, attachment.type ) return Attachment( title=attachment.title, type=attachment.type, url=response["url"], ) return attachment