Skip to content

File management

Upload file

The uploadFile() function uploads a document to a specified directory and assigns it a unique id. This function takes a local file path, a destination directory in aws and the bucket name in aws as input parameters and returns the unique id assigned to the uploaded document.

1
2
3
4
5
6
7
8
9
from blipper import Blipper

blip_obj = Blipper(blipper_api_key="lqqRYOOnSerIOP973hjskR", model="galileo")

bucket = "myfiles_bucket"
dest_dir = "docs"
filepath = "assets/example.pdf"

blip_obj.uploadFile(src_file=filepath, dest_dir=dest_dir, bucket=bucket)

This function is useful when you want to upload a file and track it with a unique id. The unique id returned by this function can be used for future reference to the uploaded document.

Delete file

The delete_file() function deletes a document from aws using key and bucket values mentioned by the user.

1
2
3
4
5
from blipper import Blipper

blip_obj = Blipper(blipper_api_key="lqqRYOOnSerIOP973hjskR", model="galileo")

blip_obj.deleteFile(file_id="docs/example.pdf")

This function is useful when you want to delete a file completely from the file manager.

Get all files

The getAllFiles() function returns all the files present in the file manager. This helps the user to have a quick look at the name of the file and the directory in which it is present. Since it is a GET function, no parameters are needed to execute this function.

1
2
3
4
5
from blipper import Blipper

blip_obj = Blipper(blipper_api_key="lqqRYOOnSerIOP973hjskR", model="galileo")

blip_obj.getAllFiles()

getFileType

The getFileType() function retrieves the type of a file based on its file ID. It requires the file ID as input and returns the file type.

1
2
3
4
5
6
7
from blipper import Blipper

blip_obj = Blipper(blipper_api_key="lqqRYOOnSerIOP973hjskR", model="galileo")

file_id = "docs/file123.docx"

result = blip_obj.getFileType(file_id=file_id)

categorizeFile

The categorizeFile() function categorizes a file based on the provided options. It requires the file ID and a list of options to categorize the file.

1
2
3
4
5
6
7
8
from blipper import Blipper

blip_obj = Blipper(blipper_api_key="lqqRYOOnSerIOP973hjskR", model="galileo")

file_id = "docs/file123.pdf"
options = ["option1", "option2", "option3"]

result = blip_obj.categorizeFile(file_id=file_id, options=options)