gemini_media
delete_uploaded_files
Delete all previously uploaded files from the Gemini API.
Source code in src/prompto/apis/gemini/gemini_media.py
list_uploaded_files
List all previously uploaded files to the Gemini API.
Source code in src/prompto/apis/gemini/gemini_media.py
remote_file_hash_base64
Convert a remote file’s SHA256 hash (stored as a hex-encoded UTF-8 bytes object) to a base64-encoded string.
Source code in src/prompto/apis/gemini/gemini_media.py
upload_media_files
Upload media files to the Gemini API.
Parameters:
files_to_upload : set[str] Set of absolute, local, paths of files to upload.
Returns:
dict[str, str] Dictionary mapping local file paths to their corresponding uploaded filenames.
Source code in src/prompto/apis/gemini/gemini_media.py
upload_single_file
async
Upload the file at ‘file_path’ if it hasn’t been uploaded yet. If a file with the same SHA256 (base64-encoded) hash exists, returns its name. Otherwise, uploads the file, waits for it to be processed, and returns the new file’s name. Raises a ValueError if processing fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the file to be uploaded. |
required |
already_uploaded_files
|
dict[str, str]
|
Dictionary mapping file hashes to filenames of already uploaded files. |
required |
Returns:
| Type | Description |
|---|---|
A tuple containing:
|
|
Source code in src/prompto/apis/gemini/gemini_media.py
wait_for_processing
async
Poll until the file is no longer in the ‘PROCESSING’ state. Returns the updated file object.