Skip to content

Download

Namespace: E2E.Decision.Sdk

public sealed class Download

The AI SDK’s Download type: the function Create(CreateDownloadOptions) returns. Called with a single URL, it downloads that URL. Called with an array of requests, it behaves like the default experimental_download of decide: URLs the model supports are passed through (null), all others are downloaded. A Download converts to a DownloadFunction, so it can be passed as ExperimentalDownload.

Inheritance: object

View source

DownloadAsync(IReadOnlyList<DownloadRequest>, CancellationToken)

Section titled “DownloadAsync(IReadOnlyList<DownloadRequest>, CancellationToken)”
public Task<IReadOnlyList<DownloadedFile?>> DownloadAsync(IReadOnlyList<DownloadRequest> requests, CancellationToken cancellationToken = default)

Downloads every URL the model does not support, and answers null for the others.

Parameters

Name Type Description
requests IReadOnlyList<DownloadRequest>
cancellationToken CancellationToken

Returns: Task<IReadOnlyList<DownloadedFile>>

public Task<DownloadedFile> DownloadAsync(Uri url, CancellationToken cancellationToken = default)

Downloads a single URL. Throws DownloadException when the download fails.

Parameters

Name Type Description
url Uri
cancellationToken CancellationToken

Returns: Task<DownloadedFile>

implicit operator DownloadFunction(Download)

Section titled “implicit operator DownloadFunction(Download)”
public static implicit operator DownloadFunction(Download download)

Converts to the array form, for ExperimentalDownload.

Parameters

Name Type Description
download Download

Returns: DownloadFunction