module aixplain.factories.file_factory
Global Variables
- MB_1
- MB_25
- MB_50
- MB_300
class FileFactory
classmethod check_storage_type
check_storage_type(input_link: Any) → <enum 'StorageType'>
Check whether a path is a URL (s3 link or HTTP link), a file or a textual content
Args:
input_link
(Any): path to be checked
Returns:
StorageType
: URL, TEXT or FILE
classmethod create
create(
local_path: str,
tags: Optional[List[str]] = None,
license: Optional[License] = None,
is_temp: bool = False
) → str
Uploads a file to an S3 bucket.
Args:
local_path
(Text): The local path of the file to upload.tags
(List[Text], optional): tags of the filelicense
(License, optional): the license for the fileis_temp
(bool): specify if the file that will be upload is a temporary file
Returns:
Text
: The S3 path where the file was uploaded.
Raises:
FileNotFoundError
: If the local file is not found.Exception
: If the file size exceeds the maximum allowed size.
classmethod to_link
to_link(data: Union[str, Dict], **kwargs) → Union[str, Dict]
If user input data is a local file, upload to aiXplain platform
Args:
data
(Union[Text, Dict]): input data
Returns:
Union[Text, Dict]
: input links/texts