Skip to main content

File Tags and File Utilities

File Tagging

The Ganymede SDK offers methods to interact with file tags from the flow editor in ganymede_sdk.file_tag. Configuration of tag types and access from agents is detailed on the Tagging Files page.

add_file_tag

Adds a file tag to a file.

  • param input_file_path: str - The name of the file to tag. The file path can be obtained from the keys in the dictionary returned by the retrieve_files for Ganymede class or by calling the get_gcs_uri method.
  • param tag_type_id: str - The name of the tag type to apply to the file. This corresponds with the tag type created on the Manage Tag Types tab of the Files page in the Ganymede UI.
  • param display_value: str - Value to apply to the tag.
  • param tag_id: Optional[str] - The tag id to apply to the file. If not provided, the tag will be created.
  • param url: Optional[str] - URL associated with the file Tag, which can be used to link the tag to external sources
  • param bucket: Optional[str] - The bucket to use for the file uri; either "input" or "output"

get_file_tags

Gets all tags for a file.

  • param input_file_path: Path to the file for listing tags. This path is the GCS URI, which can be obtained by passing the file path to the get_gcs_uri function.
  • param bucket: Optional[str] - The bucket to use for the file uri; either "input" or "output"

delete_file_tag

Deletes all tags of type tag_type_id from the specified file.

  • param tag_type_id: str - Tag type to delete
  • param input_file_path: Path to the file for listing tags. This path is the GCS URI, which can be obtained by passing the file path to the get_gcs_uri function.
  • param bucket: Optional[str] - The bucket to use for the file uri; either "input" or "output"

delete_specific_file_tag

Deletes a specific tag from a File.

  • param tag_type_id: str - Tag type to delete
  • param tag_value: str - Value of the specific tag to delete
  • param file_uri: Path to the file for listing tags. This path is the GCS URI, which can be obtained by passing the file path to the get_gcs_uri function.
  • param bucket: Optional[str] - The bucket to use for the file uri; either "input" or "output"

upsert_file_tag

Add or replace a file tag on a file.

  • param input_file_path: str - The name of the file to tag. The file path can be obtained from the keys in the dictionary returned by the retrieve_files for Ganymede class.
  • param tag_type_id: str - The name of the tag type to apply to the file. This corresponds with the tag type created on the Manage Tag Types tab of the Files page in the Ganymede UI.
  • param display_value: str - Value to apply to the tag.
  • param tag_id: Optional[str] - The tag id to apply to the file. If not provided, the tag will be created.
  • param url: Optional[str] - URL associated with the file Tag, which can be used to link the tag to external sources
  • param bucket: Optional[str] - The bucket to use for the file uri; either "input" or "output"

File Utilities

The Ganymede SDK offers methods to interact with files in the Ganymede platform in ganymede_sdk.storage.

get_file_url

Retrieve File URL associated with the specified file.

  • param filename : str - Path to the file within the bucket, without a leading slash
  • param bucket: str - Bucket that the file is in; either 'input' or 'output'

get_gcs_uri

Retrieve GCS URI associated with file path.

  • param file_path : str - Path to the file within the bucket, without a leading slash. The file path can be obtained using the list_files method
  • param bucket_type: str - Bucket that the file is in; either 'input' or 'output'