Files domain
class yandex_cloud_ml_sdk._files.domain.AsyncFiles
Files domain, which contains API for working with files.
Files is a part of Assistants API, which is the only place you could use it. Provides upload, get and list methods that allow you to work with remote file objects you created earlier.
async upload_bytes(data, *, name=Undefined, description=Undefined, mime_type=Undefined, labels=Undefined, ttl_days=Undefined, expiration_policy=Undefined, timeout=60)
Uploads a byte array as a file.
|
Parameters |
|
|
Return type |
async upload(path, *, name=Undefined, description=Undefined, mime_type=Undefined, labels=Undefined, ttl_days=Undefined, expiration_policy=Undefined, timeout=60)
Uploads a file from a specified path.
|
Parameters |
|
|
Return type |
async get(file_id, *, timeout=60)
Retrieves a file by its ID.
|
Parameters |
|
|
Return type |
async list(*, page_size=Undefined, timeout=60)
Lists Files in the SDK folder.
|
Parameters |
|
|
Return type |
class yandex_cloud_ml_sdk._files.file.AsyncFile
async get_url(*, timeout=60)
Retrieve the URL for the file.
This method constructs a request to get the temporary URL for downloading the file and returns it.
|
Parameters |
timeout (float |
|
Returns |
The URL of the file given as a string. |
|
Return type |
async update(*, name=Undefined, description=Undefined, labels=Undefined, ttl_days=Undefined, expiration_policy=Undefined, timeout=60)
Update the properties of the file.
This method allows updating various properties of the file, such as its name, description, labels, TTL (time-to-live) days, and expiration policy. Note that only the fields explicitly passed will be updated. You can also pass None, which will reset it. Keep in mind that the method is mutating and modifies the file object in-place.
|
Parameters |
|
|
Returns |
The updated instance of the file. |
|
Return type |
async delete(*, timeout=60)
Delete the file.
This method constructs and executes a request to delete the file associated with the current instance.
|
Parameters |
timeout (float |
|
Return type |
None |
async download_as_bytes(*, chunk_size=32768, timeout=60)
Download the file as bytes.
This method retrieves the file’s URL and streams the file’s content as whole (this may overflow the user’s memory), returning it as a byte string.
|
Parameters |
|
|
Returns |
The file contents as bytes. |
|
Return type |
mime_type: str
created_by: str
created_at: datetime
updated_by: str
updated_at: datetime
expires_at: datetime
expiration_config: ExpirationConfig
id: str