For the complete documentation index, see llms.txt. This page is also available as Markdown.

upload_files_cloud

imerit_ango.sdk.SDK.

upload_files_cloud(project_id, assets, storage_id, batches, priority)

Import files in cloud storage to your project.

Parameters

  • project_id: string

  • assets: List[dict]

    • A list of asset dictionaries in the [{"data": <URL>, "externalId": "<external_id>"}] format.

    • Assets uploaded with this method can also contain attachments, batches, metadata, and contextData.

Example
public_file = [
    {
        "data": "https://angohub-public-assets.s3.eu-central-1.amazonaws.com/CzXTtJV.jpg",
        "externalId": "aws-public.png",
        "metadata": {
            "width": 1500,
            "height": 1800
        },
        "contextData": {
            "key1": "value1"
        },
        "batches": ["Batch 1", "Batch 2"]
        "attachments": [
            {'type': "IMAGE", 'value': "https://angohub-public-assets.s3.eu-central-1.amazonaws.com/CzXTtJV.jpg"},
            {'type': "TEXT", 'value': "An attachment."}]
    }
]

For image and video attachments, you may provide links to assets in private buckets, provided that you've connected them to Ango Hub. More information on how to do so can be found on the Attachments page.

For Markdown assets, you may directly include the Markdown file as plain text in the data field, like so:

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

markdown_text = """
<div style="margin:10px;display:flex;">
    <div style="width:50%">
        <div style="font-size:13px;font-weight:500;display:flex;">
            <div style="width:100px;color:gray">Hello World!</div>
        </div>
    </div>
</div>
"""

external_id = "100001.md"
batch_name = "Batch-1"

file_paths = []
file_paths.append({"data": markdown_text, "externalId": external_id, "batches": [batch_name]})

response = ango_sdk.upload_files_cloud(project_id=project_id, assets=file_paths)

Batches you specify in the assets dictionary will override the batches you specify in the batches parameter of this function.

  • storage_id: string, Optional, default None

  • batches: List[str], Optional, default None

    • You may add the files being uploaded to one or multiple batches, by passing a list of batch IDs. You may obtain a list of batch IDs available in your project using get_batches function, or create new ones using create_batch function.

  • priority: int, Optional, default 0

    • The new priority value to assign to the uploaded assets.

    • Note: The priority value must be between -1000 and 1000. Higher values indicate higher priority.

Returns:

  • output: dict

    • A dictionary containing the result of the operation.

    • Including a status field indicating whether the request was successful and a data field containing the response payload with updated resources produced by the operation.

The SDK does not set a separate maximum number of assets for one upload_files_cloud call. Imports are still subject to your organization asset quota and project-level asset limits. For very large imports, split assets across multiple smaller calls.

How to verify in Ango Hub?

After successfully executing the upload_files_cloud function, you can validate the changes directly in Ango Hub.

Navigate to: Projects → [Your Project] → Asset

  • Ensure that all assets have been successfully imported and are visible in the project.

Changes made via the SDK are reflected in Ango Hub in near real-time. If updates are not immediately visible, please refresh the page.

Example

Importing a file from a public bucket, and assigning it to a batch:

Importing a file from a private bucket, and assigning it to multiple batches:

Last updated