upload_media
check_uploads_by_api
Check if preemptive uploading media files has been implemented for the given API.
Source code in src/prompto/upload_media.py
do_upload_media
async
Upload media files to the relevant API. The media files are uploaded and the experiment file is updated with the uploaded filenames.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_file
|
str
|
Path to the experiment file. |
required |
media_folder
|
str
|
Path to the folder containing the media files. |
required |
output_file
|
str
|
Path to new or updated output file. This can be the same as the input file in which case the input file will be overwritten. No checking of this behaviour is included in this function. It is assumed that the overwrite logic has been implemented elsewhere. |
required |
Source code in src/prompto/upload_media.py
update_experiment_file
update_experiment_file(
prompt_dict_list: list[dict],
uploaded_files: dict[str, str],
output_path: str,
media_location: str,
) -> None
Creates or updates the experiment file with the uploaded filenames. The uploaded filenames are added to the prompt dictionaries.
Parameters:
prompt_dict_list : list[dict] A list of prompt dictionaries containing the data from the original experiment file. uploaded_files : dict[str, str] A dictionary mapping local file paths to their corresponding uploaded filenames. output_path : str The path for the new/updated experiment file. No checking of the overwrite behaviour is included in this function. It is assumed that the overwrite logic has been implemented elsewhere. media_location : str The location of the media files (e.g., “data/media”).